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) => {