From d58d605ee9d00a28aa39a6e2efcbf849a56f48f9 Mon Sep 17 00:00:00 2001 From: vishesh92 Date: Mon, 14 Jul 2025 14:00:40 +0530 Subject: [PATCH 1/8] Add project id for post requests as well in the params --- ui/src/utils/request.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ui/src/utils/request.js b/ui/src/utils/request.js index 7c757691f2b3..aa3ee3312d7f 100644 --- a/ui/src/utils/request.js +++ b/ui/src/utils/request.js @@ -149,6 +149,8 @@ const err = (error) => { service.interceptors.request.use(config => { source = sourceToken.getSource() config.cancelToken = source.token + + // Handle GET requests (params) if (config && config.params) { config.params.response = 'json' const project = vueProps.$localStorage.get(CURRENT_PROJECT) @@ -163,6 +165,26 @@ service.interceptors.request.use(config => { config.params.ignoreproject = null } } + + // Handle POST requests (data) + if (config && config.data && config.data instanceof URLSearchParams) { + const project = vueProps.$localStorage.get(CURRENT_PROJECT) + const command = config.data.get('command') + const hasProjectId = config.data.has('projectid') + const ignoreProject = config.data.has('ignoreproject') + + if (!hasProjectId && !ignoreProject && project && project.id) { + if (command === 'listTags') { + config.data.append('projectid', '-1') + } else if (command !== 'assignVirtualMachine') { + config.data.append('projectid', project.id) + } + } + if (config.data.has('ignoreproject')) { + config.data.delete('ignoreproject') + } + } + return config }, err) From 70cc55d3e41122a7ab635c3b6b07c5df8bfc7c22 Mon Sep 17 00:00:00 2001 From: vishesh92 Date: Mon, 14 Jul 2025 14:04:24 +0530 Subject: [PATCH 2/8] Replace leftover api calls to getAPI calls --- ui/src/components/view/ImageDeployInstanceButton.vue | 6 +++--- ui/src/views/compute/KubernetesAddNodes.vue | 6 +++--- ui/src/views/compute/KubernetesRemoveNodes.vue | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ui/src/components/view/ImageDeployInstanceButton.vue b/ui/src/components/view/ImageDeployInstanceButton.vue index 4f632cc03836..b2d4b55bc6a3 100644 --- a/ui/src/components/view/ImageDeployInstanceButton.vue +++ b/ui/src/components/view/ImageDeployInstanceButton.vue @@ -41,7 +41,7 @@