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:
parent
2b53bebcb3
commit
da615afc92
24 changed files with 347 additions and 397 deletions
67
app/react/kubernetes/volumes/ListView/columns.tsx
Normal file
67
app/react/kubernetes/volumes/ListView/columns.tsx
Normal 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}`
|
||||
: ''}
|
||||
</>
|
||||
),
|
||||
}),
|
||||
];
|
Loading…
Add table
Add a link
Reference in a new issue