2023-05-02 13:42:16 +07:00
|
|
|
import { Row } from '@tanstack/react-table';
|
2023-03-03 08:45:19 +13:00
|
|
|
|
|
|
|
import { filterHOC } from '@/react/components/datatables/Filter';
|
|
|
|
|
|
|
|
import { Link } from '@@/Link';
|
|
|
|
|
2024-12-11 10:15:46 +13:00
|
|
|
import { ServiceRowData } from '../types';
|
2023-03-03 08:45:19 +13:00
|
|
|
|
2023-05-02 13:42:16 +07:00
|
|
|
import { columnHelper } from './helper';
|
|
|
|
|
|
|
|
export const namespace = columnHelper.accessor('Namespace', {
|
|
|
|
header: 'Namespace',
|
2023-03-03 08:45:19 +13:00
|
|
|
id: 'namespace',
|
2024-04-11 12:11:38 +12:00
|
|
|
cell: ({ getValue, row }) => {
|
2023-05-02 13:42:16 +07:00
|
|
|
const namespace = getValue();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Link
|
|
|
|
to="kubernetes.resourcePools.resourcePool"
|
|
|
|
params={{
|
|
|
|
id: namespace,
|
|
|
|
}}
|
|
|
|
title={namespace}
|
2024-04-11 12:11:38 +12:00
|
|
|
data-cy={`service-namespace-link-${row.original.Name}`}
|
2023-05-02 13:42:16 +07:00
|
|
|
>
|
|
|
|
{namespace}
|
|
|
|
</Link>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
meta: {
|
|
|
|
filter: filterHOC('Filter by namespace'),
|
2023-03-03 08:45:19 +13:00
|
|
|
},
|
2023-05-02 13:42:16 +07:00
|
|
|
enableColumnFilter: true,
|
2024-12-11 10:15:46 +13:00
|
|
|
filterFn: (
|
|
|
|
row: Row<ServiceRowData>,
|
|
|
|
columnId: string,
|
|
|
|
filterValue: string[]
|
|
|
|
) => filterValue.length === 0 || filterValue.includes(row.original.Namespace),
|
2023-05-02 13:42:16 +07:00
|
|
|
});
|