2023-10-16 20:19:08 +00:00
|
|
|
import { CellContext } from '@tanstack/react-table';
|
|
|
|
|
|
|
|
import { Authorized } from '@/react/hooks/useUser';
|
|
|
|
|
|
|
|
import { Link } from '@@/Link';
|
|
|
|
import { Badge } from '@@/Badge';
|
|
|
|
|
|
|
|
import { NodeRowData } from '../types';
|
|
|
|
|
|
|
|
import { columnHelper } from './helper';
|
|
|
|
|
|
|
|
export const name = columnHelper.accessor('Name', {
|
|
|
|
header: 'Name',
|
|
|
|
cell: NameCell,
|
|
|
|
});
|
|
|
|
|
|
|
|
function NameCell({
|
|
|
|
row: { original: node },
|
|
|
|
}: CellContext<NodeRowData, string>) {
|
|
|
|
const nodeName = node.metadata?.name;
|
|
|
|
return (
|
|
|
|
<div className="flex gap-2 whitespace-nowrap">
|
|
|
|
<Authorized
|
|
|
|
authorizations="K8sClusterNodeR"
|
|
|
|
childrenUnauthorized={nodeName}
|
2023-11-02 19:02:19 +00:00
|
|
|
adminOnlyCE
|
2023-10-16 20:19:08 +00:00
|
|
|
>
|
|
|
|
<Link to="kubernetes.cluster.node" params={{ nodeName }}>
|
|
|
|
{nodeName}
|
|
|
|
</Link>
|
|
|
|
</Authorized>
|
|
|
|
{node.isApi && <Badge type="info">api</Badge>}
|
|
|
|
{node.isPublishedNode && <Badge type="success">environment IP</Badge>}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|