Skip to content

Commit 3d025a5

Browse files
callmevladikMykolaMarusenko
authored andcommitted
feat: Update pipelines table and filter (#319)
1 parent 8fc4431 commit 3d025a5

File tree

27 files changed

+383
-633
lines changed

27 files changed

+383
-633
lines changed

src/constants/pipelineTypes.ts

-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ export enum PIPELINE_TYPES {
44
REVIEW = 'review',
55
DEPLOY = 'deploy',
66
CLEAN = 'clean',
7-
AUTOTEST_RUNNER = 'autotestRunner',
87
}

src/k8s/groups/Tekton/PipelineRun/hooks/useCreateAutotestRunnerPipelineRun.ts

-50
This file was deleted.

src/k8s/groups/Tekton/PipelineRun/utils/createAutotestRunnerPipelineRunInstance/index.test.ts

-2
This file was deleted.

src/k8s/groups/Tekton/PipelineRun/utils/createAutotestRunnerPipelineRunInstance/index.ts

-67
This file was deleted.

src/k8s/groups/Tekton/PipelineRun/utils/createBuildPipelineRunInstance/index.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import { GIT_PROVIDERS } from '../../../../../../constants/gitProviders';
2+
import { PIPELINE_TYPES } from '../../../../../../constants/pipelineTypes';
23
import { createRandomString } from '../../../../../../utils/createRandomString';
34
import { PipelineRunKubeObjectConfig } from '../../config';
5+
import {
6+
PIPELINE_RUN_LABEL_SELECTOR_CODEBASE,
7+
PIPELINE_RUN_LABEL_SELECTOR_CODEBASE_BRANCH,
8+
PIPELINE_RUN_LABEL_SELECTOR_PIPELINE_TYPE,
9+
} from '../../labels';
410
import { PipelineRunKubeObjectInterface } from '../../types';
511
import { generateBuildPipelineRef } from '../index';
612

@@ -55,9 +61,9 @@ export const createBuildPipelineRunInstance = ({
5561
namespace,
5662
name: `${trimmedPipelineRunNameStartValue}-build-${createRandomString(4)}`,
5763
labels: {
58-
'app.edp.epam.com/codebasebranch': codebaseBranchMetadataName,
59-
'app.edp.epam.com/codebase': codebaseName,
60-
'app.edp.epam.com/pipelinetype': 'build',
64+
[PIPELINE_RUN_LABEL_SELECTOR_CODEBASE_BRANCH]: codebaseBranchMetadataName,
65+
[PIPELINE_RUN_LABEL_SELECTOR_CODEBASE]: codebaseName,
66+
[PIPELINE_RUN_LABEL_SELECTOR_PIPELINE_TYPE]: PIPELINE_TYPES.BUILD,
6167
},
6268
annotations: {
6369
'argocd.argoproj.io/compare-options': 'IgnoreExtraneous',

src/k8s/groups/Tekton/PipelineRun/utils/createDeployPipelineRunInstance/index.test.ts

-56
This file was deleted.

src/k8s/groups/Tekton/PipelineRun/utils/createDeployPipelineRunInstance/index.ts

-55
This file was deleted.

src/pages/component-details/components/CodebaseBranchesList/components/CodebaseBranch/components/Details/index.tsx

+23-57
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,19 @@
11
import { Grid, Typography } from '@mui/material';
22
import React from 'react';
3-
import { useForm } from 'react-hook-form';
43
import { PIPELINE_TYPES } from '../../../../../../../../constants/pipelineTypes';
5-
import { PIPELINE_RUN_LABEL_SELECTOR_PIPELINE_TYPE } from '../../../../../../../../k8s/groups/Tekton/PipelineRun/labels';
6-
import { PipelineRunKubeObjectInterface } from '../../../../../../../../k8s/groups/Tekton/PipelineRun/types';
7-
import { FormSelect } from '../../../../../../../../providers/Form/components/FormSelect';
4+
import { FilterContextProvider } from '../../../../../../../../providers/Filter';
85
import { ResourceActionListContextProvider } from '../../../../../../../../providers/ResourceActionList';
9-
import { capitalizeFirstLetter } from '../../../../../../../../utils/format/capitalizeFirstLetter';
6+
import { getDefaultNamespace } from '../../../../../../../../utils/getDefaultNamespace';
107
import { rem } from '../../../../../../../../utils/styling/rem';
118
import { PipelineRunList } from '../../../../../../../../widgets/PipelineRunList';
9+
import {
10+
FILTER_CONTROLS,
11+
matchFunctions,
12+
} from '../../../../../../../../widgets/PipelineRunList/constants';
1213
import { usePermissionsContext } from '../../../../../../providers/Permissions/hooks';
1314
import { DetailsProps } from './types';
1415

15-
const pipelineRunTypes = Object.entries(PIPELINE_TYPES).filter(
16-
([, value]) => value !== PIPELINE_TYPES.DEPLOY && value !== PIPELINE_TYPES.AUTOTEST_RUNNER
17-
);
18-
const pipelineRunTypeSelectOptions = pipelineRunTypes.map(([, value]) => ({
19-
label: capitalizeFirstLetter(value),
20-
value: value,
21-
}));
22-
23-
const filterPipelineRunsByType = (
24-
pipelineRunType: PIPELINE_TYPES,
25-
pipelineRuns: PipelineRunKubeObjectInterface[]
26-
) =>
27-
pipelineRunType === PIPELINE_TYPES.ALL
28-
? pipelineRuns
29-
: pipelineRuns.filter(
30-
({ metadata: { labels } }) =>
31-
labels[PIPELINE_RUN_LABEL_SELECTOR_PIPELINE_TYPE] === pipelineRunType
32-
);
33-
3416
export const Details = ({ pipelineRuns }: DetailsProps) => {
35-
const [pipelineRunType, setPipelineRunType] = React.useState<PIPELINE_TYPES>(PIPELINE_TYPES.ALL);
36-
const filteredPipelineRunsByType = React.useMemo(
37-
() => filterPipelineRunsByType(pipelineRunType, pipelineRuns.all),
38-
[pipelineRunType, pipelineRuns.all]
39-
);
40-
41-
const {
42-
register,
43-
control,
44-
formState: { errors },
45-
} = useForm();
46-
4717
const { pipelineRun: pipelineRunPermissions } = usePermissionsContext();
4818

4919
return (
@@ -53,29 +23,25 @@ export const Details = ({ pipelineRuns }: DetailsProps) => {
5323
<Grid item>
5424
<Typography variant={'h6'}>Pipeline Runs</Typography>
5525
</Grid>
56-
{!!pipelineRuns?.all?.length ? (
57-
<Grid item style={{ minWidth: rem(300), marginLeft: 'auto' }}>
58-
<FormSelect
59-
{...register('type', {
60-
onChange: ({ target: { value } }) => setPipelineRunType(value),
61-
})}
62-
control={control}
63-
errors={errors}
64-
name={'type'}
65-
label={'Type'}
66-
options={pipelineRunTypeSelectOptions}
67-
defaultValue={PIPELINE_TYPES.ALL}
68-
/>
69-
</Grid>
70-
) : null}
7126
<Grid item xs={12}>
7227
<ResourceActionListContextProvider>
73-
<PipelineRunList
74-
pipelineRuns={filteredPipelineRunsByType}
75-
isLoading={pipelineRuns.all === null}
76-
filterFunction={null}
77-
permissions={pipelineRunPermissions}
78-
/>
28+
<FilterContextProvider
29+
entityID={`PIPELINE_RUN_LIST_BRANCH_DETAILS::${getDefaultNamespace()}`}
30+
matchFunctions={matchFunctions}
31+
saveToLocalStorage
32+
>
33+
<PipelineRunList
34+
pipelineRuns={pipelineRuns.all}
35+
isLoading={pipelineRuns.all === null}
36+
permissions={pipelineRunPermissions}
37+
pipelineRunTypes={[
38+
PIPELINE_TYPES.ALL,
39+
PIPELINE_TYPES.REVIEW,
40+
PIPELINE_TYPES.BUILD,
41+
]}
42+
filterControls={[FILTER_CONTROLS.PIPELINE_TYPE, FILTER_CONTROLS.STATUS]}
43+
/>
44+
</FilterContextProvider>
7945
</ResourceActionListContextProvider>
8046
</Grid>
8147
</Grid>

src/pages/configuration/pages/codemie/providers/DynamicData/provider.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const DynamicDataContextProvider: React.FC = ({ children }) => {
4444
() => ({
4545
codemieQuickLink: {
4646
data: codemieQuickLink,
47-
isLoading: codemieQuickLink === null,
47+
isLoading: codemieQuickLink === null && !codemieQuickLinkError,
4848
error: codemieQuickLinkError,
4949
},
5050
codemie: {

0 commit comments

Comments
 (0)