1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-25 00:09:40 +02:00

fix(docker/network): send target nodeName when removing a network on swarm (#12000)
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:
LP B 2024-07-08 17:31:27 +02:00 committed by GitHub
parent 3529a36f92
commit 566e37535f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 24 additions and 6 deletions

View file

@ -37,7 +37,12 @@ export function withInvalidate(
return {
onSuccess() {
const promise = Promise.all(
queryKeysToInvalidate.map((keys) => queryClient.invalidateQueries(keys))
queryKeysToInvalidate.map((keys) =>
queryClient.invalidateQueries(keys, {
refetchActive: false,
refetchInactive: false,
})
)
);
return skipRefresh
? undefined // don't wait for queries to refresh before setting state to success

View file

@ -100,7 +100,7 @@ export function ItemView() {
if (confirmed) {
deleteNetworkMutation.mutate(
{ environmentId, networkId },
{ environmentId, networkId, nodeName },
{
onSuccess: () => {
router.stateService.go('docker.networks');

View file

@ -33,10 +33,20 @@ export async function getNetwork(
export async function deleteNetwork(
environmentId: EnvironmentId,
networkId: NetworkId
networkId: NetworkId,
{ nodeName }: { nodeName?: string } = {}
) {
try {
await axios.delete(buildUrl(environmentId, networkId));
await axios.delete(
buildUrl(environmentId, networkId),
nodeName
? {
headers: {
[agentTargetHeader]: nodeName,
},
}
: undefined
);
return networkId;
} catch (e) {
throw parseAxiosError(e as Error, 'Unable to remove network');

View file

@ -42,10 +42,12 @@ export function useDeleteNetwork() {
({
environmentId,
networkId,
nodeName,
}: {
environmentId: EnvironmentId;
networkId: NetworkId;
}) => deleteNetwork(environmentId, networkId),
nodeName?: string;
}) => deleteNetwork(environmentId, networkId, { nodeName }),
{
onSuccess: (networkId) => {
notifySuccess('Network successfully removed', networkId);

View file

@ -235,5 +235,6 @@
"browserslist": "last 2 versions",
"msw": {
"workerDirectory": ".storybook/public"
}
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}