mirror of
https://github.com/portainer/portainer.git
synced 2025-07-21 22:39:41 +02:00
refactor(docker/stacks): migrate table to react [EE-4705] (#9956)
This commit is contained in:
parent
c3d266931f
commit
c8a1f0fa77
43 changed files with 1127 additions and 492 deletions
|
@ -1,38 +0,0 @@
|
|||
import { CellContext, ColumnDef } from '@tanstack/react-table';
|
||||
|
||||
import { ownershipIcon } from '@/portainer/filters/filters';
|
||||
import { ResourceControlOwnership } from '@/react/portainer/access-control/types';
|
||||
|
||||
import { Icon } from '@@/Icon';
|
||||
|
||||
export interface IResource {
|
||||
ResourceControl?: {
|
||||
Ownership: ResourceControlOwnership;
|
||||
};
|
||||
}
|
||||
|
||||
export function createOwnershipColumn<D extends IResource>(): ColumnDef<
|
||||
D,
|
||||
ResourceControlOwnership
|
||||
> {
|
||||
return {
|
||||
accessorFn: (row) =>
|
||||
row.ResourceControl?.Ownership || ResourceControlOwnership.ADMINISTRATORS,
|
||||
header: 'Ownership',
|
||||
id: 'ownership',
|
||||
cell: OwnershipCell,
|
||||
};
|
||||
|
||||
function OwnershipCell({
|
||||
getValue,
|
||||
}: CellContext<D, ResourceControlOwnership>) {
|
||||
const value = getValue();
|
||||
|
||||
return (
|
||||
<span className="flex items-center gap-2">
|
||||
<Icon icon={ownershipIcon(value)} className="space-right" />
|
||||
{value}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue