fix(接口测试): 修复配额限制后批量资源池反显问题

--bug=1026274 --user=赵勇 【接口测试】修改配额资源池和项目接口资源池不一致-接口用例/场景批量执行-资源池显示错误 https://www.tapd.cn/55049933/s/1372931

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2023-05-18 17:33:42 +08:00 committed by fit2-zhao
parent d7ec497444
commit ac573f33b2
4 changed files with 53 additions and 41 deletions

View File

@ -57,11 +57,7 @@
</div>
<div class="mode-row">
<span>{{ $t('run_mode.run_with_resource_pool') }} : </span>
<el-select
v-model="runConfig.resourcePoolId"
size="mini"
class="mode-row"
style="width: 100%">
<el-select v-model="runConfig.resourcePoolId" size="mini" class="mode-row" style="width: 100%">
<el-option
v-for="item in resourcePools"
:key="item.id"
@ -94,7 +90,6 @@ import { strMapToObj } from 'metersphere-frontend/src/utils';
import { getOwnerProjects, getProjectConfig } from '@/api/project';
import { getTestResourcePools } from '@/api/test-resource-pool';
import { getCurrentProjectID } from 'metersphere-frontend/src/utils/token';
import { getSystemBaseSetting } from 'metersphere-frontend/src/api/system';
import EnvSelectPopover from '@/business/automation/scenario/EnvSelectPopover';
import { getApiCaseEnvironments } from '@/api/api-test-case';
@ -182,21 +177,22 @@ export default {
});
},
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;
}
});
},
setEnvGroup(id) {
this.runConfig.environmentGroupId = id;

View File

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

View File

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

View File

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