Skip to content

Commit

Permalink
flux: namespace filter for sources and image automation
Browse files Browse the repository at this point in the history
Signed-off-by: Matthijs Galesloot <[email protected]>
  • Loading branch information
mgalesloot committed Nov 13, 2024
1 parent 4484408 commit 628ce68
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
7 changes: 6 additions & 1 deletion flux/src/image-automation/ImageAutomationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import {
Link,
Loader,
SectionBox,
SectionFilterHeader,
ShowHideLabel,
} from '@kinvolk/headlamp-plugin/lib/components/common';
import { KubeObject } from '@kinvolk/headlamp-plugin/lib/lib/k8s/cluster';
import { useFilterFunc } from '@kinvolk/headlamp-plugin/lib/Utils';
import { Link as MuiLink } from '@mui/material';
import React from 'react';
import CheckIfFluxInstalled, { useFluxControllerAvailableCheck } from '../checkflux';
Expand Down Expand Up @@ -135,6 +137,7 @@ function ImageUpdateAutomationList(props: { resourceClass: KubeObject }) {
},
'age',
]}
filterFunction={useFilterFunc()}
/>
</SectionBox>
</>
Expand Down Expand Up @@ -173,6 +176,7 @@ function ImagePolicyList(props: { resourceClass: KubeObject }) {
},
'age',
]}
filterFunction={useFilterFunc()}
/>
</SectionBox>
);
Expand All @@ -183,7 +187,7 @@ function ImageRepositoryList(props: { resourceClass: KubeObject }) {
const [imageRepositories] = resourceClass?.useList();

return (
<SectionBox title="Image Repositories">
<SectionBox title={<SectionFilterHeader title="Image Repositories" />}>
<Table
data={imageRepositories}
columns={[
Expand Down Expand Up @@ -234,6 +238,7 @@ function ImageRepositoryList(props: { resourceClass: KubeObject }) {
},
'age',
]}
filterFunction={useFilterFunc()}
/>
</SectionBox>
);
Expand Down
13 changes: 10 additions & 3 deletions flux/src/sources/SourceCustomResourceSingle.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { Link, SectionBox } from '@kinvolk/headlamp-plugin/lib/components/common';
import { KubeObject } from '@kinvolk/headlamp-plugin/lib/lib/k8s/cluster';
import { KubeCRD } from '@kinvolk/headlamp-plugin/lib/lib/k8s/crd';
import { useFilterFunc } from '@kinvolk/headlamp-plugin/lib/Utils';
import React from 'react';
import SourceLink from '../common/Link';
import Table, { TableProps } from '../common/Table';

interface FluxSourceCustomResourceProps {
crd: KubeCRD;
title?: string;
title?: string | JSX.Element;
}

export default function FluxSourceCustomResource(props: FluxSourceCustomResourceProps) {
Expand All @@ -31,7 +32,7 @@ export default function FluxSourceCustomResource(props: FluxSourceCustomResource

interface FluxSourceCustomResourceRendererProps {
resourceClass: KubeObject;
title: string;
title: string | JSX.Element;
type: string;
}

Expand Down Expand Up @@ -130,9 +131,15 @@ function FluxSourceCustomResourceRenderer(props: FluxSourceCustomResourceRendere
});
}

console.log(title);
return (
<SectionBox title={title}>
<Table data={resource} columns={columns} defaultSortingColumn={3} />
<Table
data={resource}
columns={columns}
defaultSortingColumn={3}
filterFunction={useFilterFunc()}
/>
</SectionBox>
);
}
3 changes: 2 additions & 1 deletion flux/src/sources/SourceList.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { K8s } from '@kinvolk/headlamp-plugin/lib';
import { SectionFilterHeader } from '@kinvolk/headlamp-plugin/lib/components/common';
import CheckIfFluxInstalled from '../checkflux';
import FluxSourceCustomResource from './SourceCustomResourceSingle';

Expand All @@ -21,7 +22,7 @@ export default function FluxSources() {

const sourceTables = [
{
title: 'Git Repositories',
title: <SectionFilterHeader title={'Git Repositories'} />,
crd: gitRepoCRD,
},
{
Expand Down

0 comments on commit 628ce68

Please sign in to comment.