Skip to content

Commit c6284d5

Browse files
committed
chore: run lint
1 parent 9410942 commit c6284d5

File tree

13 files changed

+280
-222
lines changed

13 files changed

+280
-222
lines changed

src/components/camel-app-details/CamelAppDetails.tsx

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
import * as React from 'react';
22
import { CamelAppKind } from '../../types';
3-
import { Card, CardBody, DescriptionList, DescriptionListDescription, DescriptionListGroup, DescriptionListTerm, TextList, TextListItem } from '@patternfly/react-core';
3+
import {
4+
Card,
5+
CardBody,
6+
DescriptionList,
7+
DescriptionListDescription,
8+
DescriptionListGroup,
9+
DescriptionListTerm,
10+
TextList,
11+
TextListItem,
12+
} from '@patternfly/react-core';
413
import { useTranslation } from 'react-i18next';
514
import { K8sGroupVersionKind, ResourceLink } from '@openshift-console/dynamic-plugin-sdk';
615
import { camelAppGVK } from '../../const';
@@ -43,7 +52,6 @@ const CamelAppDetails: React.FC<CamelAppDetailsProps> = ({ obj: camelInt }) => {
4352
/>
4453
</h4>
4554

46-
4755
<DescriptionList
4856
columnModifier={{
4957
default: '1Col',
@@ -55,21 +63,29 @@ const CamelAppDetails: React.FC<CamelAppDetailsProps> = ({ obj: camelInt }) => {
5563
</DescriptionListGroup>
5664
<DescriptionListGroup>
5765
<DescriptionListTerm>
58-
<PopoverCamelHealth popoverBody={t("Health") + " :"} />
59-
66+
<PopoverCamelHealth popoverBody={t('Health') + ' :'} />
6067
</DescriptionListTerm>
6168
<DescriptionListDescription>
62-
<CamelAppHealth health={camelInt.status.sliExchangeSuccessRate?.status ? camelInt.status.sliExchangeSuccessRate?.status : ""} />
69+
<CamelAppHealth
70+
health={
71+
camelInt.status.sliExchangeSuccessRate?.status
72+
? camelInt.status.sliExchangeSuccessRate?.status
73+
: ''
74+
}
75+
/>
6376
</DescriptionListDescription>
6477
</DescriptionListGroup>
65-
{camelInt.status.sliExchangeSuccessRate ?
78+
{camelInt.status.sliExchangeSuccessRate ? (
6679
<DescriptionListGroup>
6780
<DescriptionListTerm>{t('Percentage of success rate')}:</DescriptionListTerm>
6881
<DescriptionListDescription>
6982
<TextList>
7083
<TextListItem>
7184
<strong>{t('Sampling interval')}: </strong>
72-
{formatDuration(camelInt.status.sliExchangeSuccessRate.samplingInterval / 1000000, { omitSuffix: true })}
85+
{formatDuration(
86+
camelInt.status.sliExchangeSuccessRate.samplingInterval / 1000000,
87+
{ omitSuffix: true },
88+
)}
7389
</TextListItem>
7490
<TextListItem>
7591
<strong>{t('Failed exchanges')}: </strong>
@@ -86,20 +102,22 @@ const CamelAppDetails: React.FC<CamelAppDetailsProps> = ({ obj: camelInt }) => {
86102
</TextList>
87103
</DescriptionListDescription>
88104
</DescriptionListGroup>
89-
: <></>}
105+
) : (
106+
<></>
107+
)}
90108
</DescriptionList>
91109
</CardBody>
92110
</Card>
93111

94112
<ul className="list-group">
95113
{camelInt.status.pods
96114
? camelInt.status.pods.map((pod, i) => {
97-
return (
98-
<li key={i} className="list-group-item">
99-
<CamelAppStatusPod obj={camelInt} pod={pod} />
100-
</li>
101-
);
102-
})
115+
return (
116+
<li key={i} className="list-group-item">
117+
<CamelAppStatusPod obj={camelInt} pod={pod} />
118+
</li>
119+
);
120+
})
103121
: ''}
104122
</ul>
105123
</div>

src/components/camel-app-details/CamelAppHealthPopover.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { Button, Popover, PopoverPosition, PopoverProps } from "@patternfly/react-core";
2+
import { Button, Popover, PopoverPosition, PopoverProps } from '@patternfly/react-core';
33
import { Trans, useTranslation } from 'react-i18next';
44
import CamelAppHealth from '../camel-list-page/CamelAppHealth';
55

@@ -32,15 +32,17 @@ export const PopoverCamelHealth: React.FC<PopoverCamelHealthProps> = ({
3232
bodyContent={() => (
3333
<div>
3434
<div>
35-
<Trans t={t}>
36-
<h4>Service Level Indicator</h4>
37-
38-
<CamelAppHealth health='Error'/>: &gt; 10 % failed exchanges<br/>
39-
<CamelAppHealth health='Warning'/>: &gt; 5 % failed exchanges<br/>
40-
<CamelAppHealth health='OK'/>: healthy<br/>
41-
<CamelAppHealth health='Unknown'/>: no informations<br/>
42-
43-
</Trans>
35+
<Trans t={t}>
36+
<h4>Service Level Indicator</h4>
37+
<CamelAppHealth health="Error" />: &gt; 10 % failed exchanges
38+
<br />
39+
<CamelAppHealth health="Warning" />: &gt; 5 % failed exchanges
40+
<br />
41+
<CamelAppHealth health="OK" />: healthy
42+
<br />
43+
<CamelAppHealth health="Unknown" />: no informations
44+
<br />
45+
</Trans>
4446
</div>
4547
</div>
4648
)}
@@ -51,10 +53,13 @@ export const PopoverCamelHealth: React.FC<PopoverCamelHealthProps> = ({
5153
shouldClose={shouldClose}
5254
shouldOpen={shouldOpen}
5355
>
54-
<Button variant="link" isInline className="pf-v5-c-button pf-m-plain details-item__popover-button">
56+
<Button
57+
variant="link"
58+
isInline
59+
className="pf-v5-c-button pf-m-plain details-item__popover-button"
60+
>
5561
{popoverBody}
5662
</Button>
5763
</Popover>
5864
);
5965
};
60-

src/components/camel-app-details/CamelAppStatusPod.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const CamelAppStatusPod: React.FC<CamelAppStatusPodProps> = ({ obj: camelInt, po
5656
<DescriptionListTerm>{t('Uptime')}:</DescriptionListTerm>
5757
<DescriptionListDescription>{durationFull}</DescriptionListDescription>
5858
</DescriptionListGroup>
59-
{camelPod.runtime ?
59+
{camelPod.runtime ? (
6060
<DescriptionListGroup>
6161
<DescriptionListTerm>{t('Runtime')}:</DescriptionListTerm>
6262
<DescriptionListDescription>
@@ -76,8 +76,10 @@ const CamelAppStatusPod: React.FC<CamelAppStatusPodProps> = ({ obj: camelInt, po
7676
</TextList>
7777
</DescriptionListDescription>
7878
</DescriptionListGroup>
79-
: <></>}
80-
{camelPod.runtime?.exchange ?
79+
) : (
80+
<></>
81+
)}
82+
{camelPod.runtime?.exchange ? (
8183
<DescriptionListGroup>
8284
<DescriptionListTerm>{t('Exchange')}:</DescriptionListTerm>
8385
<DescriptionListDescription>
@@ -101,9 +103,11 @@ const CamelAppStatusPod: React.FC<CamelAppStatusPodProps> = ({ obj: camelInt, po
101103
</TextList>
102104
</DescriptionListDescription>
103105
</DescriptionListGroup>
104-
: <></>}
106+
) : (
107+
<></>
108+
)}
105109

106-
{camelPod.observe ?
110+
{camelPod.observe ? (
107111
<DescriptionListGroup>
108112
<DescriptionListTerm>{t('Endpoints')}:</DescriptionListTerm>
109113
<DescriptionListDescription>
@@ -119,7 +123,9 @@ const CamelAppStatusPod: React.FC<CamelAppStatusPodProps> = ({ obj: camelInt, po
119123
</TextList>
120124
</DescriptionListDescription>
121125
</DescriptionListGroup>
122-
: <></>}
126+
) : (
127+
<></>
128+
)}
123129
</DescriptionList>
124130
</CardBody>
125131
</Card>

src/components/camel-app-resources/CamelAppPods.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ const CamelAppPods: React.FC<CamelAppPodsProps> = ({ obj: camelInt }) => {
2929
camelInt.spec.selector,
3030
);
3131

32-
const { available : availableHawtioConsolePlugin } = useHawtioConsolePlugin();
33-
32+
const { available: availableHawtioConsolePlugin } = useHawtioConsolePlugin();
33+
3434
if (loadedPods && CamelAppPods.length > 0) {
3535
CamelAppPods.forEach((pod) => {
3636
pods.push({

src/components/camel-app-resources/CamelAppRoutes.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const CamelAppRoutes: React.FC<CamelAppRoutesProps> = ({ obj: camelAppOwner }) =
2020

2121
const routes: Resources[] = [];
2222

23-
2423
const { CamelAppRoutes, loaded: loadedRoutes } = useCamelAppRoutes(
2524
camelAppOwner.metadata.namespace,
2625
camelAppOwner.metadata.name,

src/components/camel-app-resources/useCamelAppResources.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ export const useCamelAppServices = (
130130
},
131131
});
132132

133-
// Selector only works on labels, so we need to filter
134-
const filteredData = resources.services.data.filter(service => {
135-
const selector = service.spec.selector as ServiceSelector;
136-
if (appName == selector.app){
137-
return true;
138-
}
139-
return false;
133+
// Selector only works on labels, so we need to filter
134+
const filteredData = resources.services.data.filter((service) => {
135+
const selector = service.spec.selector as ServiceSelector;
136+
if (appName == selector.app) {
137+
return true;
138+
}
139+
return false;
140140
});
141141

142142
return {
@@ -170,13 +170,15 @@ export const useCamelAppRoutes = (
170170
const servicesNames: string[] = [];
171171

172172
if (resources.services.loaded && resources.services.data.length > 0) {
173-
resources.services.data.filter(service => {
174-
const selector = service.spec.selector as ServiceSelector;
175-
if (appName == selector.app){
176-
return true;
177-
}
178-
return false;
179-
}).forEach((service) => servicesNames.push(service.metadata.name));
173+
resources.services.data
174+
.filter((service) => {
175+
const selector = service.spec.selector as ServiceSelector;
176+
if (appName == selector.app) {
177+
return true;
178+
}
179+
return false;
180+
})
181+
.forEach((service) => servicesNames.push(service.metadata.name));
180182
}
181183

182184
if (resources.routes.data.length > 0) {

src/components/camel-app-resources/useHawtio.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const useHawtioConsolePlugin = (): {
1818
isList: false,
1919
});
2020

21-
const available = loaded && HawtioConsolePluginResource != null
21+
const available = loaded && HawtioConsolePluginResource != null;
2222

2323
return { available };
2424
};
Lines changed: 52 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,66 @@
1-
import { ColoredIconProps, GreenCheckCircleIcon, RedExclamationCircleIcon, YellowExclamationTriangleIcon } from '@openshift-console/dynamic-plugin-sdk';
1+
import {
2+
ColoredIconProps,
3+
GreenCheckCircleIcon,
4+
RedExclamationCircleIcon,
5+
YellowExclamationTriangleIcon,
6+
} from '@openshift-console/dynamic-plugin-sdk';
27
import { Icon } from '@patternfly/react-core';
38
import { UnknownIcon } from '@patternfly/react-icons';
49
import * as React from 'react';
510
import { css } from '@patternfly/react-styles';
611
import { useTranslation } from 'react-i18next';
712

813
type CamelAppHealthProps = {
9-
health: string;
14+
health: string;
1015
};
1116

1217
const CamelAppHealth: React.FC<CamelAppHealthProps> = ({ health }) => {
13-
const { t } = useTranslation('plugin__camel-openshift-console-plugin');
14-
// FIXME: manage undefined
15-
switch (health.toLowerCase()) {
16-
case 'ok':
17-
return (
18-
<><GreenCheckCircleIcon title={t(health)} />&nbsp;&nbsp;{t(health)}</>
19-
);
20-
case 'warning':
21-
return (
22-
<><YellowExclamationTriangleIcon title={t(health)} />&nbsp;&nbsp;{t(health)}</>
23-
);
24-
case 'error':
25-
return (
26-
<><RedExclamationCircleIcon title={t(health)} />&nbsp;&nbsp;{t(health)}</>
27-
);
28-
default:
29-
return (
30-
<><GrayUnknownIcon title={t('Unknown')} />&nbsp;&nbsp;{t('Unknown')}</>
31-
);
32-
}
33-
34-
}
18+
const { t } = useTranslation('plugin__camel-openshift-console-plugin');
19+
// FIXME: manage undefined
20+
switch (health.toLowerCase()) {
21+
case 'ok':
22+
return (
23+
<>
24+
<GreenCheckCircleIcon title={t(health)} />
25+
&nbsp;&nbsp;{t(health)}
26+
</>
27+
);
28+
case 'warning':
29+
return (
30+
<>
31+
<YellowExclamationTriangleIcon title={t(health)} />
32+
&nbsp;&nbsp;{t(health)}
33+
</>
34+
);
35+
case 'error':
36+
return (
37+
<>
38+
<RedExclamationCircleIcon title={t(health)} />
39+
&nbsp;&nbsp;{t(health)}
40+
</>
41+
);
42+
default:
43+
return (
44+
<>
45+
<GrayUnknownIcon title={t('Unknown')} />
46+
&nbsp;&nbsp;{t('Unknown')}
47+
</>
48+
);
49+
}
50+
};
3551

3652
export const GrayUnknownIcon: React.FC<ColoredIconProps> = ({ className, title, size }) => {
37-
const icon = (
38-
<UnknownIcon
39-
data-test="unknown-icon"
40-
className={css('unknown-icon', className)}
41-
title={title}
42-
/>
43-
);
44-
if (size) {
45-
return <Icon size={size}>{icon}</Icon>;
46-
}
47-
return icon;
53+
const icon = (
54+
<UnknownIcon
55+
data-test="unknown-icon"
56+
className={css('unknown-icon', className)}
57+
title={title}
58+
/>
59+
);
60+
if (size) {
61+
return <Icon size={size}>{icon}</Icon>;
62+
}
63+
return icon;
4864
};
4965

50-
51-
export default CamelAppHealth;
66+
export default CamelAppHealth;

0 commit comments

Comments
 (0)