1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 00:09:40 +02:00

refactor(kube/volumes): migrate to react [EE-4695] (#10987)

This commit is contained in:
Chaim Lev-Ari 2024-04-02 22:10:22 +03:00 committed by GitHub
parent 2b53bebcb3
commit da615afc92
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 347 additions and 397 deletions

View file

@ -0,0 +1,67 @@
import { isoDate } from '@/portainer/filters/filters';
import { Link } from '@@/Link';
import { name } from './columns.name';
import { helper } from './columns.helper';
export const columns = [
name,
helper.accessor('ResourcePool.Namespace.Name', {
header: 'Namespace',
cell: ({ getValue }) => {
const namespace = getValue();
return (
<Link
to="kubernetes.resourcePools.resourcePool"
params={{ id: namespace }}
>
{namespace}
</Link>
);
},
}),
helper.accessor((item) => item.Applications[0]?.Name, {
header: 'Used by',
cell: ({ row: { original: item } }) => {
if (!item.Applications.length) {
return '-';
}
return (
<>
<Link
to="kubernetes.applications.application"
params={{
name: item.Applications[0].Name,
namespace: item.ResourcePool.Namespace.Name,
}}
>
{item.Applications[0].Name}
</Link>
{item.Applications.length > 1 && (
<> + {item.Applications.length - 1}</>
)}
</>
);
},
}),
helper.accessor('PersistentVolumeClaim.storageClass.Name', {
header: 'Storage',
}),
helper.accessor('PersistentVolumeClaim.Storage', {
header: 'Size',
}),
helper.accessor('PersistentVolumeClaim.CreationDate', {
header: 'Created',
cell: ({ row: { original: item } }) => (
<>
{isoDate(item.PersistentVolumeClaim.CreationDate)}
{item.PersistentVolumeClaim.ApplicationOwner
? ` by ${item.PersistentVolumeClaim.ApplicationOwner}`
: ''}
</>
),
}),
];