Skip to content

Commit 78fd81d

Browse files
committed
run yarn lint --fix
Signed-off-by: Atif Ali <atali@redhat.com>
1 parent bfc0491 commit 78fd81d

24 files changed

+635
-389
lines changed

src/components/topology/console/PodsOverview.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as React from 'react';
22
import { useTranslation } from 'react-i18next';
3-
import { Grid, GridItem } from '@patternfly/react-core';
43
import { Link } from 'react-router-dom-v5-compat';
54
import * as _ from 'lodash';
65

76
import { PodPhase, ResourceLink, StatusComponent } from '@openshift-console/dynamic-plugin-sdk';
87
import { ExtPodKind } from '@openshift-console/dynamic-plugin-sdk-internal/lib/extensions/console-types';
8+
import { Grid, GridItem } from '@patternfly/react-core';
99

1010
import { PodTraffic } from './pod-traffic';
1111
import { ContainerStatus } from './types';

src/components/topology/sidebar/DeploymentSideBarDetails.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ type DeploymentSideBarDetailsProps = {
205205

206206
export const DeploymentSideBarDetails: React.FC<DeploymentSideBarDetailsProps> = ({
207207
rollout: d,
208-
rolloutKind: rolloutKind,
209208
}) => {
210209
const { t } = useTranslation();
211210
const model = getK8sModel(d);

src/components/utils/gitops-utils.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export const getApplicationsListBaseURI = () => {
4141
export class RetryError extends Error {}
4242

4343
export class TimeoutError extends Error {
44-
constructor(url: any, ms: any, ...params: any[]) {
45-
super(`Call to ${url} timed out after ${ms}ms.`); //å ...params);
44+
constructor(url: any, ms: any) {
45+
super(`Call to ${url} timed out after ${ms}ms.`);
4646
// Dumb hack to fix `instanceof TimeoutError`
4747
Object.setPrototypeOf(this, TimeoutError.prototype);
4848
}
@@ -64,7 +64,7 @@ const getCSRFToken = () =>
6464
.map((c) => c.slice(cookiePrefix.length))
6565
.pop();
6666

67-
export const validateStatus = async (response: Response, url, method, retry) => {
67+
export const validateStatus = async (response: Response, url, method) => {
6868
console.log('VALIDATE STATUS - RESPONSE STATUS IS ' + response.status);
6969
console.log('VALIDATE STATUS - RESPONSE TEXT IS ' + response.text);
7070
console.log('VALIDATE STATUS - RESPONSE BODY IS ' + response.body);
@@ -101,7 +101,6 @@ export const validateStatus = async (response: Response, url, method, retry) =>
101101
// retry 409 conflict errors due to ClustResourceQuota / ResourceQuota
102102
// https://bugzilla.redhat.com/show_bug.cgi?id=1920699
103103
if (
104-
retry &&
105104
method === 'POST' &&
106105
response.status === 409 &&
107106
['resourcequotas', 'clusterresourcequotas'].includes(json.details?.kind)
@@ -129,7 +128,7 @@ export const validateStatus = async (response: Response, url, method, retry) =>
129128
});
130129
};
131130

132-
export const coFetchInternal = async (url, options, timeout, retry) => {
131+
export const coFetchInternal = async (url, options, timeout) => {
133132
const allOptions = _.defaultsDeep({}, initDefaults, options);
134133
if (allOptions.method !== 'GET') {
135134
allOptions.headers['X-CSRFToken'] = getCSRFToken();
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
import * as React from 'react';
22
import { useParams } from 'react-router-dom-v5-compat';
3+
34
import AppSetNavPage from '../appset/AppSetNavPage';
45

56
const ApplicationSetDetailsPage: React.FC = () => {
67
const { name, ns } = useParams<{ name: string; ns: string }>();
78

8-
return (
9-
<AppSetNavPage
10-
name={name}
11-
namespace={ns}
12-
kind="ApplicationSet"
13-
/>
14-
);
9+
return <AppSetNavPage name={name} namespace={ns} kind="ApplicationSet" />;
1510
};
1611

1712
export default ApplicationSetDetailsPage;

src/gitops/components/appset/AppSetDetailsTab.tsx

Lines changed: 79 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
import * as React from 'react';
22
import { RouteComponentProps } from 'react-router';
3-
import { ApplicationSetKind, ApplicationSetModel } from '../../models/ApplicationSetModel';
4-
import {
5-
Badge,
6-
PageSection,
7-
Title,
8-
DescriptionList,
9-
Flex,
10-
FlexItem,
11-
} from '@patternfly/react-core';
12-
import BaseDetailsSummary, { DetailsDescriptionGroup } from '../shared/BaseDetailsSummary/BaseDetailsSummary';
13-
import { getAppSetGeneratorCount, getAppSetStatus } from '../../utils/gitops';
14-
import { useK8sWatchResource, ResourceLink } from '@openshift-console/dynamic-plugin-sdk';
3+
4+
import { ResourceLink, useK8sWatchResource } from '@openshift-console/dynamic-plugin-sdk';
5+
import { Badge, DescriptionList, Flex, FlexItem, PageSection, Title } from '@patternfly/react-core';
6+
157
import { ApplicationKind, ApplicationModel } from '../../models/ApplicationModel';
16-
import { Conditions } from '../../utils/components/Conditions/Conditions';
8+
import { ApplicationSetKind, ApplicationSetModel } from '../../models/ApplicationSetModel';
179
import HealthStatus from '../../Statuses/HealthStatus';
10+
import { Conditions } from '../../utils/components/Conditions/Conditions';
11+
import { getAppSetGeneratorCount, getAppSetStatus } from '../../utils/gitops';
12+
import BaseDetailsSummary, {
13+
DetailsDescriptionGroup,
14+
} from '../shared/BaseDetailsSummary/BaseDetailsSummary';
15+
1816
import './AppSetDetailsTab.scss';
1917

2018
type AppSetDetailsTabProps = RouteComponentProps<{ ns: string; name: string }> & {
@@ -23,30 +21,32 @@ type AppSetDetailsTabProps = RouteComponentProps<{ ns: string; name: string }> &
2321

2422
const AppSetDetailsTab: React.FC<AppSetDetailsTabProps> = ({ obj }) => {
2523
const namespace = obj?.metadata?.namespace;
26-
if (!obj) return null;
2724

28-
const status = obj.status || {};
29-
const spec = obj.spec || {};
30-
const totalGenerators = getAppSetGeneratorCount(obj);
31-
const appSetStatus = getAppSetStatus(obj);
32-
3325
// Get applications to count generated apps
3426
const [applications] = useK8sWatchResource<ApplicationKind[]>({
3527
groupVersionKind: {
3628
group: ApplicationModel.apiGroup,
3729
version: ApplicationModel.apiVersion,
3830
kind: ApplicationModel.kind,
3931
},
40-
namespace: namespace || obj.metadata?.namespace,
32+
namespace: namespace || obj?.metadata?.namespace,
4133
isList: true,
4234
});
4335

36+
if (!obj) return null;
37+
38+
const status = obj.status || {};
39+
const spec = obj.spec || {};
40+
const totalGenerators = getAppSetGeneratorCount(obj);
41+
const appSetStatus = getAppSetStatus(obj);
42+
4443
// Count applications owned by this ApplicationSet
45-
const generatedAppsCount = applications?.filter(app =>
46-
app.metadata?.ownerReferences?.some(owner =>
47-
owner.kind === obj.kind && owner.name === obj.metadata?.name
48-
)
49-
).length || 0;
44+
const generatedAppsCount =
45+
applications?.filter((app) =>
46+
app.metadata?.ownerReferences?.some(
47+
(owner) => owner.kind === obj.kind && owner.name === obj.metadata?.name,
48+
),
49+
).length || 0;
5050

5151
return (
5252
<>
@@ -66,52 +66,60 @@ const AppSetDetailsTab: React.FC<AppSetDetailsTabProps> = ({ obj }) => {
6666
<Flex flex={{ default: 'flex_2' }} direction={{ default: 'column' }}>
6767
<FlexItem>
6868
<DescriptionList className="pf-c-description-list">
69-
<DetailsDescriptionGroup
70-
title="Status"
71-
help="Current health status of the ApplicationSet."
72-
>
73-
<HealthStatus status={appSetStatus} />
74-
</DetailsDescriptionGroup>
75-
76-
<DetailsDescriptionGroup
77-
title="Generated Apps"
78-
help="Number of applications generated by this ApplicationSet."
79-
>
80-
<Badge isRead color="blue">{generatedAppsCount} application{generatedAppsCount !== 1 ? 's' : ''}</Badge>
81-
</DetailsDescriptionGroup>
82-
83-
<DetailsDescriptionGroup
84-
title="Generators"
85-
help="Number of generators configured in this ApplicationSet."
86-
>
87-
<Badge isRead color="grey">{totalGenerators} generator{totalGenerators !== 1 ? 's' : ''}</Badge>
88-
</DetailsDescriptionGroup>
89-
90-
<DetailsDescriptionGroup
91-
title="App Project"
92-
help="Argo CD project that this ApplicationSet belongs to."
93-
>
94-
<ResourceLink
95-
namespace={obj?.metadata?.namespace}
96-
groupVersionKind={{
97-
group: 'argoproj.io',
98-
version: 'v1alpha1',
99-
kind: 'AppProject',
100-
}}
101-
name={spec.template?.spec?.project || 'default'}
102-
/>
103-
</DetailsDescriptionGroup>
104-
105-
{spec.template?.spec?.source?.repoURL && (
106-
<DetailsDescriptionGroup
107-
title="Repository"
108-
help="Git repository URL where the ApplicationSet configuration is stored."
109-
>
110-
<a href={spec.template.spec.source.repoURL} target="_blank" rel="noopener noreferrer">
111-
{spec.template.spec.source.repoURL}
112-
</a>
113-
</DetailsDescriptionGroup>
114-
)}
69+
<DetailsDescriptionGroup
70+
title="Status"
71+
help="Current health status of the ApplicationSet."
72+
>
73+
<HealthStatus status={appSetStatus} />
74+
</DetailsDescriptionGroup>
75+
76+
<DetailsDescriptionGroup
77+
title="Generated Apps"
78+
help="Number of applications generated by this ApplicationSet."
79+
>
80+
<Badge isRead color="blue">
81+
{generatedAppsCount} application{generatedAppsCount !== 1 ? 's' : ''}
82+
</Badge>
83+
</DetailsDescriptionGroup>
84+
85+
<DetailsDescriptionGroup
86+
title="Generators"
87+
help="Number of generators configured in this ApplicationSet."
88+
>
89+
<Badge isRead color="grey">
90+
{totalGenerators} generator{totalGenerators !== 1 ? 's' : ''}
91+
</Badge>
92+
</DetailsDescriptionGroup>
93+
94+
<DetailsDescriptionGroup
95+
title="App Project"
96+
help="Argo CD project that this ApplicationSet belongs to."
97+
>
98+
<ResourceLink
99+
namespace={obj?.metadata?.namespace}
100+
groupVersionKind={{
101+
group: 'argoproj.io',
102+
version: 'v1alpha1',
103+
kind: 'AppProject',
104+
}}
105+
name={spec.template?.spec?.project || 'default'}
106+
/>
107+
</DetailsDescriptionGroup>
108+
109+
{spec.template?.spec?.source?.repoURL && (
110+
<DetailsDescriptionGroup
111+
title="Repository"
112+
help="Git repository URL where the ApplicationSet configuration is stored."
113+
>
114+
<a
115+
href={spec.template.spec.source.repoURL}
116+
target="_blank"
117+
rel="noopener noreferrer"
118+
>
119+
{spec.template.spec.source.repoURL}
120+
</a>
121+
</DetailsDescriptionGroup>
122+
)}
115123
</DescriptionList>
116124
</FlexItem>
117125
</Flex>

src/gitops/components/appset/AppSetNavPage.tsx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
import * as React from 'react';
2-
import { useK8sWatchResource, HorizontalNav } from '@openshift-console/dynamic-plugin-sdk';
3-
import { ApplicationSetKind, ApplicationSetModel } from '../../models/ApplicationSetModel';
4-
import { Spinner, Bullseye } from '@patternfly/react-core';
5-
import DetailsPageHeader from '../shared/DetailsPageHeader/DetailsPageHeader';
2+
3+
import { HorizontalNav, useK8sWatchResource } from '@openshift-console/dynamic-plugin-sdk';
4+
import { Bullseye, Spinner } from '@patternfly/react-core';
5+
66
import { useApplicationSetActionsProvider } from '../../hooks/useApplicationSetActionsProvider';
7+
import { ApplicationSetKind, ApplicationSetModel } from '../../models/ApplicationSetModel';
78
import { useGitOpsTranslation } from '../../utils/hooks/useGitOpsTranslation';
9+
import DetailsPageHeader from '../shared/DetailsPageHeader/DetailsPageHeader';
10+
import ResourceYAMLTab from '../shared/ResourceYAMLTab/ResourceYAMLTab';
11+
812
import AppSetDetailsTab from './AppSetDetailsTab';
9-
import GeneratorsTab from './GeneratorsTab';
1013
import AppsTab from './AppsTab';
1114
import ApplicationSetEventsTab from './EventsTab';
12-
import ResourceYAMLTab from '../shared/ResourceYAMLTab/ResourceYAMLTab';
15+
import GeneratorsTab from './GeneratorsTab';
1316

1417
type AppSetPageProps = {
1518
name: string;
@@ -39,11 +42,11 @@ const AppSetNavPage: React.FC<AppSetPageProps> = ({ name, namespace, kind }) =>
3942
name: t('Details'),
4043
component: AppSetDetailsTab,
4144
},
42-
{
43-
href: 'yaml',
44-
name: t('YAML'),
45-
component: ResourceYAMLTab,
46-
},
45+
{
46+
href: 'yaml',
47+
name: t('YAML'),
48+
component: ResourceYAMLTab,
49+
},
4750
{
4851
href: 'generators',
4952
name: t('Generators'),
@@ -54,11 +57,11 @@ const AppSetNavPage: React.FC<AppSetPageProps> = ({ name, namespace, kind }) =>
5457
name: t('Applications'),
5558
component: AppsTab,
5659
},
57-
{
58-
href: 'events',
59-
name: t('Events'),
60-
component: ApplicationSetEventsTab,
61-
},
60+
{
61+
href: 'events',
62+
name: t('Events'),
63+
component: ApplicationSetEventsTab,
64+
},
6265
],
6366
[t],
6467
);

src/gitops/components/appset/AppsTab.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import * as React from 'react';
22
import { RouteComponentProps } from 'react-router';
3-
import { ApplicationSetKind } from '../../models/ApplicationSetModel';
3+
44
import { PageSection } from '@patternfly/react-core';
5+
6+
import { ApplicationSetKind } from '../../models/ApplicationSetModel';
57
import ApplicationList from '../shared/ApplicationList';
8+
69
import './AppsTab.scss';
710

811
type AppsTabProps = RouteComponentProps<{ ns: string; name: string }> & {
@@ -15,7 +18,7 @@ const AppsTab: React.FC<AppsTabProps> = ({ obj }) => {
1518

1619
return (
1720
<PageSection>
18-
<ApplicationList
21+
<ApplicationList
1922
namespace={namespace}
2023
hideNameLabelFilters={false}
2124
showTitle={false}

src/gitops/components/appset/EventsTab.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as React from 'react';
22
import { RouteComponentProps } from 'react-router';
3+
34
import { ApplicationSetKind } from '../../models/ApplicationSetModel';
45
import EventsTab from '../shared/EventsTab/EventsTab';
56

src/gitops/components/appset/Generators.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import * as React from 'react';
2+
3+
import ClusterGenerator from './generators/ClusterGenerator';
4+
import GenericGenerator from './generators/GenericGenerator';
25
import GitGenerator from './generators/GitGenerator';
36
import ListGenerator from './generators/ListGenerator';
47
import MatrixGenerator from './generators/MatrixGenerator';
5-
import UnionGenerator from './generators/UnionGenerator';
68
import MergeGenerator from './generators/MergeGenerator';
7-
import ClusterGenerator from './generators/ClusterGenerator';
8-
import GenericGenerator from './generators/GenericGenerator';
9+
import UnionGenerator from './generators/UnionGenerator';
910

1011
interface GeneratorsProps {
1112
generators: any[];
@@ -47,5 +48,3 @@ const Generators: React.FC<GeneratorsProps> = ({ generators }) => {
4748
};
4849

4950
export default Generators;
50-
51-

0 commit comments

Comments
 (0)