2023-05-02 06:42:16 +00:00
|
|
|
import { CellContext, Row } from '@tanstack/react-table';
|
2022-09-21 04:49:42 +00:00
|
|
|
|
2023-05-02 06:42:16 +00:00
|
|
|
import { filterHOC } from '@@/datatables/Filter';
|
2022-09-21 04:49:42 +00:00
|
|
|
import { Link } from '@@/Link';
|
|
|
|
|
|
|
|
import { Ingress } from '../../types';
|
|
|
|
|
2023-05-02 06:42:16 +00:00
|
|
|
import { columnHelper } from './helper';
|
|
|
|
|
|
|
|
export const namespace = columnHelper.accessor('Namespace', {
|
|
|
|
header: 'Namespace',
|
|
|
|
id: 'namespace',
|
|
|
|
cell: Cell,
|
|
|
|
filterFn: (row: Row<Ingress>, columnId: string, filterValue: string[]) => {
|
|
|
|
if (filterValue.length === 0) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return filterValue.includes(row.original.Namespace);
|
|
|
|
},
|
|
|
|
|
|
|
|
meta: {
|
|
|
|
filter: filterHOC('Filter by namespace'),
|
|
|
|
},
|
|
|
|
enableColumnFilter: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
function Cell({ getValue }: CellContext<Ingress, string>) {
|
|
|
|
const namespace = getValue();
|
|
|
|
return (
|
2022-09-21 04:49:42 +00:00
|
|
|
<Link
|
|
|
|
to="kubernetes.resourcePools.resourcePool"
|
|
|
|
params={{
|
2023-05-02 06:42:16 +00:00
|
|
|
id: namespace,
|
2022-09-21 04:49:42 +00:00
|
|
|
}}
|
2023-05-02 06:42:16 +00:00
|
|
|
title={namespace}
|
2022-09-21 04:49:42 +00:00
|
|
|
>
|
2023-05-02 06:42:16 +00:00
|
|
|
{namespace}
|
2022-09-21 04:49:42 +00:00
|
|
|
</Link>
|
2023-05-02 06:42:16 +00:00
|
|
|
);
|
|
|
|
}
|