From ac573f33b2241210c6bde597861e0cc1b4023395 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Thu, 18 May 2023 17:33:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=85=8D=E9=A2=9D=E9=99=90=E5=88=B6=E5=90=8E?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E8=B5=84=E6=BA=90=E6=B1=A0=E5=8F=8D=E6=98=BE?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1026274 --user=赵勇 【接口测试】修改配额资源池和项目接口资源池不一致-接口用例/场景批量执行-资源池显示错误 https://www.tapd.cn/55049933/s/1372931 Signed-off-by: fit2-zhao --- .../automation/scenario/common/ApiRunMode.vue | 32 ++++++++----------- .../automation/schedule/ScheduleMaintain.vue | 19 +++++++---- .../plan/common/TestPlanRunModeWithEnv.vue | 25 ++++++++------- .../plan/components/ScheduleMaintain.vue | 18 ++++++++--- 4 files changed, 53 insertions(+), 41 deletions(-) diff --git a/api-test/frontend/src/business/automation/scenario/common/ApiRunMode.vue b/api-test/frontend/src/business/automation/scenario/common/ApiRunMode.vue index 40c275bf69..70c18dd90c 100644 --- a/api-test/frontend/src/business/automation/scenario/common/ApiRunMode.vue +++ b/api-test/frontend/src/business/automation/scenario/common/ApiRunMode.vue @@ -57,11 +57,7 @@
{{ $t('run_mode.run_with_resource_pool') }} : - + { - if (item.id === this.runConfig.resourcePoolId) { - hasPool = true; - return; + this.runConfig.resourcePoolId = null; + getProjectConfig(getCurrentProjectID(), '').then((res) => { + if (res.data && res.data.poolEnable && res.data.resourcePoolId) { + this.runConfig.resourcePoolId = res.data.resourcePoolId; } - }); - if (!hasPool) { - this.runConfig.resourcePoolId = null; - getProjectConfig(getCurrentProjectID(), "").then((res) => { - if (res.data && res.data.poolEnable && res.data.resourcePoolId) { - this.runConfig.resourcePoolId = res.data.resourcePoolId; + let hasPool = false; + this.resourcePools.forEach((item) => { + if (item.id === this.runConfig.resourcePoolId) { + hasPool = true; + return; } }); - } + if (!hasPool) { + this.runConfig.resourcePoolId = null; + } + }); }, setEnvGroup(id) { this.runConfig.environmentGroupId = id; diff --git a/api-test/frontend/src/business/automation/schedule/ScheduleMaintain.vue b/api-test/frontend/src/business/automation/schedule/ScheduleMaintain.vue index 9cc2be62da..19043f19f9 100644 --- a/api-test/frontend/src/business/automation/schedule/ScheduleMaintain.vue +++ b/api-test/frontend/src/business/automation/schedule/ScheduleMaintain.vue @@ -194,20 +194,27 @@ export default { }; }, methods: { - getProjectApplication() { + async checkPool(){ let hasPool = false; this.resourcePools.forEach(item => { if (item.id === this.runConfig.resourcePoolId) { hasPool = true; - return; } }); + return hasPool; + }, + async getProjectApplication() { + let hasPool = await this.checkPool(); if (!hasPool) { this.runConfig.resourcePoolId = null; - getProjectConfig(getCurrentProjectID(), "").then((res) => { + getProjectConfig(getCurrentProjectID(), "").then(async (res) => { if (res.data && res.data.poolEnable && res.data.resourcePoolId) { this.runConfig.resourcePoolId = res.data.resourcePoolId; } + hasPool = await this.checkPool(); + if (!hasPool) { + this.runConfig.resourcePoolId = undefined; + } }); } }, @@ -281,7 +288,7 @@ export default { param.testId = this.testId; return param; }, - open(row) { + async open(row) { //测试计划页面跳转来的 let paramTestId = ''; this.paramRow = row; @@ -296,7 +303,7 @@ export default { this.scheduleTaskType = 'API_SCENARIO_TEST'; } this.testId = paramTestId; - this.findSchedule(paramTestId); + await this.findSchedule(paramTestId); this.initUserList(); this.dialogVisible = true; this.form.cronValue = this.schedule.value; @@ -306,7 +313,7 @@ export default { this.getWsProjects(); this.runConfig.environmentType = ENV_TYPE.JSON; }, - findSchedule() { + async findSchedule() { let scheduleResourceID = this.testId; let taskType = this.scheduleTaskType; this.result = getScheduleByIdAndType(scheduleResourceID, taskType).then((response) => { diff --git a/test-track/frontend/src/business/plan/common/TestPlanRunModeWithEnv.vue b/test-track/frontend/src/business/plan/common/TestPlanRunModeWithEnv.vue index 07fcd32a79..ae74f0c796 100644 --- a/test-track/frontend/src/business/plan/common/TestPlanRunModeWithEnv.vue +++ b/test-track/frontend/src/business/plan/common/TestPlanRunModeWithEnv.vue @@ -310,21 +310,22 @@ export default { this.showPopover(); }, getProjectApplication() { - let hasPool = false; - this.resourcePools.forEach(item => { - if (item.id === this.runConfig.resourcePoolId) { - hasPool = true; - return; + this.runConfig.resourcePoolId = null; + getProjectConfig(getCurrentProjectID(), "").then((res) => { + if (res.data && res.data.poolEnable && res.data.resourcePoolId) { + this.runConfig.resourcePoolId = res.data.resourcePoolId; } - }); - if (!hasPool) { - this.runConfig.resourcePoolId = null; - getProjectConfig(getCurrentProjectID(), "").then((res) => { - if (res.data && res.data.poolEnable && res.data.resourcePoolId) { - this.runConfig.resourcePoolId = res.data.resourcePoolId; + let hasPool = false; + this.resourcePools.forEach((item) => { + if (item.id === this.runConfig.resourcePoolId) { + hasPool = true; + return; } }); - } + if (!hasPool) { + this.runConfig.resourcePoolId = null; + } + }); }, changeMode() { this.runConfig.onSampleError = false; diff --git a/test-track/frontend/src/business/plan/components/ScheduleMaintain.vue b/test-track/frontend/src/business/plan/components/ScheduleMaintain.vue index 070148e534..0c0b634f77 100644 --- a/test-track/frontend/src/business/plan/components/ScheduleMaintain.vue +++ b/test-track/frontend/src/business/plan/components/ScheduleMaintain.vue @@ -381,7 +381,7 @@ export default { }; }, methods: { - getProjectApplication() { + async checkPool(){ let hasPool = false; this.resourcePools.forEach(item => { if (item.id === this.runConfig.resourcePoolId) { @@ -389,12 +389,20 @@ export default { return; } }); + return hasPool; + }, + async getProjectApplication() { + let hasPool = await this.checkPool(); if (!hasPool) { this.runConfig.resourcePoolId = null; - getProjectConfig(getCurrentProjectID(), "").then((res) => { + getProjectConfig(getCurrentProjectID(), "").then(async (res) => { if (res.data && res.data.poolEnable && res.data.resourcePoolId) { this.runConfig.resourcePoolId = res.data.resourcePoolId; } + hasPool = await this.checkPool(); + if (!hasPool) { + this.runConfig.resourcePoolId = undefined; + } }); } }, @@ -425,13 +433,13 @@ export default { param.testId = this.testId; return param; }, - open(row) { + async open(row) { this.planId = row.id; //测试计划页面跳转来的 let paramTestId = row.id; this.paramRow = row; this.testId = paramTestId; - this.findSchedule(paramTestId); + await this.findSchedule(paramTestId); this.initUserList(); this.dialogVisible = true; this.form.cronValue = this.schedule.value; @@ -442,7 +450,7 @@ export default { this.runConfig.retryEnable = false; this.runConfig.retryNum = 1; }, - findSchedule() { + async findSchedule() { let scheduleResourceID = this.testId; this.result = getPlanSchedule(scheduleResourceID, "TEST_PLAN_TEST").then( (response) => {