mirror of
https://github.com/portainer/portainer.git
synced 2025-08-04 21:35:23 +02:00
refactor(tables): use add and delete buttons [EE-6297] (#10668)
Co-authored-by: Chaim Lev-Ari <chaim.levi-ari@portaienr.io>
This commit is contained in:
parent
d88ef03ddb
commit
9600eb6fa1
41 changed files with 369 additions and 727 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Plus, Network, Trash2 } from 'lucide-react';
|
||||
import { Network } from 'lucide-react';
|
||||
|
||||
import { Authorized } from '@/react/hooks/useUser';
|
||||
import { useEnvironmentId } from '@/react/hooks/useEnvironmentId';
|
||||
|
@ -10,12 +10,12 @@ import {
|
|||
refreshableSettings,
|
||||
RefreshableTableSettings,
|
||||
} from '@@/datatables/types';
|
||||
import { Button } from '@@/buttons';
|
||||
import { AddButton } from '@@/buttons';
|
||||
import { TableSettingsMenu } from '@@/datatables';
|
||||
import { TableSettingsMenuAutoRefresh } from '@@/datatables/TableSettingsMenuAutoRefresh';
|
||||
import { useRepeater } from '@@/datatables/useRepeater';
|
||||
import { useTableState } from '@@/datatables/useTableState';
|
||||
import { Link } from '@@/Link';
|
||||
import { DeleteButton } from '@@/buttons/DeleteButton';
|
||||
|
||||
import { useIsSwarm } from '../../proxy/queries/useInfo';
|
||||
|
||||
|
@ -80,22 +80,16 @@ export function NetworksDatatable({ dataset, onRemove, onRefresh }: Props) {
|
|||
<Authorized
|
||||
authorizations={['DockerNetworkDelete', 'DockerNetworkCreate']}
|
||||
>
|
||||
<Button
|
||||
<DeleteButton
|
||||
disabled={selectedRows.length === 0}
|
||||
color="dangerlight"
|
||||
onClick={() => onRemove(selectedRows)}
|
||||
icon={Trash2}
|
||||
>
|
||||
Remove
|
||||
</Button>
|
||||
confirmMessage="Do you want to remove the selected network(s)?"
|
||||
onConfirmed={() => onRemove(selectedRows)}
|
||||
/>
|
||||
</Authorized>
|
||||
<Authorized
|
||||
authorizations="DockerNetworkCreate"
|
||||
data-cy="network-addNetworkButton"
|
||||
>
|
||||
<Button icon={Plus} as={Link} props={{ to: '.new' }}>
|
||||
<Authorized authorizations="DockerNetworkCreate">
|
||||
<AddButton data-cy="network-addNetworkButton">
|
||||
Add network
|
||||
</Button>
|
||||
</AddButton>
|
||||
</Authorized>
|
||||
</div>
|
||||
)}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue