Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

Commit

Permalink
Fixing code style
Browse files Browse the repository at this point in the history
  • Loading branch information
xeviknal committed May 28, 2020
1 parent 1a26faf commit c23d76c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
24 changes: 13 additions & 11 deletions src/components/Link/IstioObjectLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,13 @@ interface Props {
query?: string;
}

export const GetIstioObjectUrl = (name: string, namespace: string, type: string, subType?: string, query?: string): string => {
export const GetIstioObjectUrl = (
name: string,
namespace: string,
type: string,
subType?: string,
query?: string
): string => {
const istioType = IstioTypes[type];
let to = '/namespaces/' + namespace + '/' + Paths.ISTIO;

Expand All @@ -23,7 +29,7 @@ export const GetIstioObjectUrl = (name: string, namespace: string, type: string,
}

if (!!query) {
to = to + '?' + query;
to = to + '?' + query;
}

return to;
Expand All @@ -47,16 +53,12 @@ export class ReferenceIstioObjectLink extends React.Component<Props> {
}
}

class IstioObjectLink extends React.Component<Props> {
render() {
const { name, namespace, type, subType, query } = this.props;
class IstioObjectLink extends React.Component<Props> {
render() {
const { name, namespace, type, subType, query } = this.props;

return (
<Link to={GetIstioObjectUrl(name, namespace, type, subType, query)}>
{this.props.children}
</Link>
)
}
return <Link to={GetIstioObjectUrl(name, namespace, type, subType, query)}>{this.props.children}</Link>;
}
}

export default IstioObjectLink;
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ class ServiceInfoDestinationRules extends React.Component<ServiceInfoDestination

yamlLink(destinationRule: DestinationRule) {
return (
<IstioObjectLink name={destinationRule.metadata.name} namespace={destinationRule.metadata.namespace || ''} type={'destinationrule'} query={'list=yaml'}>
<IstioObjectLink
name={destinationRule.metadata.name}
namespace={destinationRule.metadata.namespace || ''}
type={'destinationrule'}
query={'list=yaml'}
>
View YAML
</IstioObjectLink>
);
Expand All @@ -61,7 +66,11 @@ class ServiceInfoDestinationRules extends React.Component<ServiceInfoDestination

overviewLink(destinationRule: DestinationRule) {
return (
<IstioObjectLink name={destinationRule.metadata.name} namespace={destinationRule.metadata.namespace || ''} type={'destinationrule'}>
<IstioObjectLink
name={destinationRule.metadata.name}
namespace={destinationRule.metadata.namespace || ''}
type={'destinationrule'}
>
{destinationRule.metadata.name}
</IstioObjectLink>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,24 @@ class ServiceInfoVirtualServices extends React.Component<ServiceInfoVirtualServi

overviewLink(virtualService: VirtualService) {
return (
<IstioObjectLink name={virtualService.metadata.name} namespace={virtualService.metadata.namespace || ''} type={'virtualservice'}>
<IstioObjectLink
name={virtualService.metadata.name}
namespace={virtualService.metadata.namespace || ''}
type={'virtualservice'}
>
{virtualService.metadata.name}
</IstioObjectLink>
);
}

yamlLink(virtualService: VirtualService) {
return (
<IstioObjectLink name={virtualService.metadata.name} namespace={virtualService.metadata.namespace || ''} type={'virtualservice'} query={'list=yaml'}>
<IstioObjectLink
name={virtualService.metadata.name}
namespace={virtualService.metadata.namespace || ''}
type={'virtualservice'}
query={'list=yaml'}
>
View YAML
</IstioObjectLink>
);
Expand Down

0 comments on commit c23d76c

Please sign in to comment.