mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 20:35:25 +02:00
refactor(edge/groups): migrate view to react [EE-4683] (#10592)
This commit is contained in:
parent
1f2f4525e3
commit
99b39da03d
18 changed files with 199 additions and 228 deletions
37
app/react/edge/edge-groups/ListView/TableActions.tsx
Normal file
37
app/react/edge/edge-groups/ListView/TableActions.tsx
Normal file
|
@ -0,0 +1,37 @@
|
|||
import { notifySuccess } from '@/portainer/services/notifications';
|
||||
|
||||
import { AddButton } from '@@/buttons';
|
||||
import { DeleteButton } from '@@/buttons/DeleteButton';
|
||||
|
||||
import { EdgeGroup } from '../types';
|
||||
|
||||
import { useDeleteEdgeGroupsMutation } from './useDeleteEdgeGroupMutation';
|
||||
|
||||
export function TableActions({
|
||||
selectedItems,
|
||||
}: {
|
||||
selectedItems: Array<EdgeGroup>;
|
||||
}) {
|
||||
const removeMutation = useDeleteEdgeGroupsMutation();
|
||||
|
||||
return (
|
||||
<div className="flex items-center gap-2">
|
||||
<DeleteButton
|
||||
confirmMessage="Do you want to remove the selected Edge Group(s)?"
|
||||
disabled={selectedItems.length === 0}
|
||||
onConfirmed={() => handleRemove(selectedItems)}
|
||||
/>
|
||||
|
||||
<AddButton>Add Edge group</AddButton>
|
||||
</div>
|
||||
);
|
||||
|
||||
async function handleRemove(selectedItems: Array<EdgeGroup>) {
|
||||
const ids = selectedItems.map((item) => item.Id);
|
||||
removeMutation.mutate(ids, {
|
||||
onSuccess: () => {
|
||||
notifySuccess('Success', 'Edge Group(s) removed');
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue