1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 07:19:41 +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:
Chaim Lev-Ari 2024-04-08 17:21:41 +03:00 committed by GitHub
parent d88ef03ddb
commit 9600eb6fa1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 369 additions and 727 deletions

View file

@ -1,9 +1,7 @@
import { Trash2, Plus } from 'lucide-react';
import { Authorized } from '@/react/hooks/useUser';
import { Link } from '@@/Link';
import { Button } from '@@/buttons';
import { AddButton } from '@@/buttons';
import { DeleteButton } from '@@/buttons/DeleteButton';
import { DecoratedStack } from './types';
@ -17,28 +15,18 @@ export function TableActions({
return (
<div className="flex items-center gap-2">
<Authorized authorizations="PortainerStackDelete">
<Button
color="dangerlight"
<DeleteButton
disabled={selectedItems.length === 0}
onClick={() => onRemove(selectedItems)}
icon={Trash2}
className="!m-0"
onConfirmed={() => onRemove(selectedItems)}
confirmMessage="Do you want to remove the selected stack(s)? Associated services will be removed as well."
data-cy="stack-removeStackButton"
>
Remove
</Button>
/>
</Authorized>
<Authorized authorizations="PortainerStackCreate">
<Button
as={Link}
props={{ to: '.newstack' }}
icon={Plus}
className="!m-0"
data-cy="stack-addStackButton"
>
<AddButton data-cy="stack-addStackButton" to=".newstack">
Add stack
</Button>
</AddButton>
</Authorized>
</div>
);