mirror of
https://github.com/portainer/portainer.git
synced 2025-08-09 07:45:22 +02:00
fix(docker/networks): handle system networks
This commit is contained in:
parent
8143fab676
commit
7d06439d51
3 changed files with 34 additions and 2 deletions
|
@ -62,6 +62,7 @@ export function NetworksDatatable({ dataset, onRemove, onRefresh }: Props) {
|
|||
getRowCanExpand={({ original: item }) =>
|
||||
!!(item.Subs && item.Subs?.length > 0)
|
||||
}
|
||||
isRowSelectable={({ original: item }) => !item.ResourceControl?.System}
|
||||
renderSubRow={(row) => (
|
||||
<>
|
||||
{row.original.Subs && (
|
||||
|
|
|
@ -4,18 +4,18 @@ import { useMemo } from 'react';
|
|||
import { createOwnershipColumn } from '@/react/docker/components/datatable/createOwnershipColumn';
|
||||
|
||||
import { buildExpandColumn } from '@@/datatables/expand-column';
|
||||
import { buildNameColumn } from '@@/datatables/buildNameColumn';
|
||||
|
||||
import { DecoratedNetwork } from '../types';
|
||||
|
||||
import { columnHelper } from './helper';
|
||||
import { name } from './name';
|
||||
|
||||
export function useColumns(isHostColumnVisible?: boolean) {
|
||||
return useMemo(
|
||||
() =>
|
||||
_.compact([
|
||||
buildExpandColumn<DecoratedNetwork>(),
|
||||
buildNameColumn<DecoratedNetwork>('Name', '.network'),
|
||||
name,
|
||||
columnHelper.accessor((item) => item.StackName || '-', {
|
||||
header: 'Stack',
|
||||
}),
|
||||
|
|
31
app/react/docker/networks/ListView/columns/name.tsx
Normal file
31
app/react/docker/networks/ListView/columns/name.tsx
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { truncate } from '@/portainer/filters/filters';
|
||||
|
||||
import { Link } from '@@/Link';
|
||||
|
||||
import { columnHelper } from './helper';
|
||||
|
||||
export const name = columnHelper.accessor('Name', {
|
||||
header: 'Name',
|
||||
id: 'name',
|
||||
cell({ row: { original: item } }) {
|
||||
return (
|
||||
<>
|
||||
<Link
|
||||
to=".network"
|
||||
params={{ id: item.Id, nodeName: item.NodeName }}
|
||||
title={item.Name}
|
||||
>
|
||||
{truncate(item.Name, 40)}
|
||||
</Link>
|
||||
{item.ResourceControl?.System && (
|
||||
<span
|
||||
style={{ marginLeft: '10px' }}
|
||||
className="label label-info image-tag space-left"
|
||||
>
|
||||
System
|
||||
</span>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
},
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue