mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 13:55:21 +02:00
fix(endpoints): show toaster on delete [EE-7170] (#11888)
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:s390x platform:linux version:]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:s390x platform:linux version:]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
This commit is contained in:
parent
69f9a509c8
commit
9d7173fb5f
1 changed files with 13 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
||||||
import { useStore } from 'zustand';
|
import { useStore } from 'zustand';
|
||||||
|
|
||||||
|
import { notifySuccess } from '@/portainer/services/notifications';
|
||||||
import { environmentStore } from '@/react/hooks/current-environment-store';
|
import { environmentStore } from '@/react/hooks/current-environment-store';
|
||||||
|
|
||||||
import { PageHeader } from '@@/PageHeader';
|
import { PageHeader } from '@@/PageHeader';
|
||||||
|
@ -26,7 +27,7 @@ export function ListView() {
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
async function handleRemove(environments: Array<Environment>) {
|
async function handleRemove(environmentsToDelete: Array<Environment>) {
|
||||||
const confirmed = await confirmDelete(
|
const confirmed = await confirmDelete(
|
||||||
'This action will remove all configurations associated to your environment(s). Continue?'
|
'This action will remove all configurations associated to your environment(s). Continue?'
|
||||||
);
|
);
|
||||||
|
@ -37,16 +38,24 @@ export function ListView() {
|
||||||
|
|
||||||
const id = constCurrentEnvironmentStore.environmentId;
|
const id = constCurrentEnvironmentStore.environmentId;
|
||||||
// If the current endpoint was deleted, then clean endpoint store
|
// If the current endpoint was deleted, then clean endpoint store
|
||||||
if (environments.some((e) => e.Id === id)) {
|
if (environmentsToDelete.some((e) => e.Id === id)) {
|
||||||
constCurrentEnvironmentStore.clear();
|
constCurrentEnvironmentStore.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
deletionMutation.mutate(
|
deletionMutation.mutate(
|
||||||
environments.map((e) => ({
|
environmentsToDelete.map((e) => ({
|
||||||
id: e.Id,
|
id: e.Id,
|
||||||
deleteCluster: false,
|
deleteCluster: false,
|
||||||
name: e.Name,
|
name: e.Name,
|
||||||
}))
|
})),
|
||||||
|
{
|
||||||
|
onSuccess() {
|
||||||
|
notifySuccess(
|
||||||
|
'Environments successfully removed',
|
||||||
|
environmentsToDelete.map((e) => e.Name).join(', ')
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue