fix(docker/network): send target nodeName when removing a network on swarm (#12000)

pull/12022/head
LP B 5 months ago committed by GitHub
parent 3529a36f92
commit 566e37535f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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

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

@ -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');

@ -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);

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

Loading…
Cancel
Save