mirror of
https://github.com/portainer/portainer.git
synced 2025-07-22 14:59:41 +02:00
refactor(cluster): migrate nodes datatable to react [EE-4962] (#10459)
Co-authored-by: testa113 <testa113>
This commit is contained in:
parent
b346fd7f39
commit
0e47f22c0a
25 changed files with 448 additions and 219 deletions
|
@ -0,0 +1,35 @@
|
|||
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}
|
||||
>
|
||||
<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>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue