diff --git a/api-test/frontend/src/business/automation/scenario/EnvSelectPopover.vue b/api-test/frontend/src/business/automation/scenario/EnvSelectPopover.vue index 4081fe8c28..d39d179fa7 100644 --- a/api-test/frontend/src/business/automation/scenario/EnvSelectPopover.vue +++ b/api-test/frontend/src/business/automation/scenario/EnvSelectPopover.vue @@ -50,15 +50,33 @@ -
-
- +
+ - + + + + + +
@@ -70,25 +88,30 @@
+ +
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 9d3f6076bd..64692005ee 100644 --- a/api-test/frontend/src/business/automation/scenario/common/ApiRunMode.vue +++ b/api-test/frontend/src/business/automation/scenario/common/ApiRunMode.vue @@ -12,6 +12,7 @@ :project-ids="projectIds" :project-list="projectList" :case-id-env-name-map="caseIdEnvNameMap" + :environment-type.sync="runConfig.environmentType" :is-scenario="isScenario" :has-option-group="true" :project-env-map="projectEnvListMap" diff --git a/test-track/frontend/src/business/plan/common/TestPlanRunModeWithEnv.vue b/test-track/frontend/src/business/plan/common/TestPlanRunModeWithEnv.vue index 2eccaae681..161512b047 100644 --- a/test-track/frontend/src/business/plan/common/TestPlanRunModeWithEnv.vue +++ b/test-track/frontend/src/business/plan/common/TestPlanRunModeWithEnv.vue @@ -13,6 +13,8 @@
- + + + + + +
import {ENV_TYPE} from "metersphere-frontend/src/utils/constants"; -import {environmentGetALL} from "metersphere-frontend/src/api/environment"; +import {environmentGetALL,getEnvironmentOptions} from "metersphere-frontend/src/api/environment"; import MsTag from "metersphere-frontend/src/components/MsTag"; import EnvironmentGroup from "@/business/plan/env/EnvironmentGroupList"; import {getEnvironmentByProjectId} from "@/api/remote/api/api-environment"; @@ -67,9 +82,11 @@ export default { components: {MsTag,EnvironmentGroup}, data(){ return { - radio:ENV_TYPE.JSON, + radio: this.environmentType, visible: false, groups:[], + disabledGroups: [], + notDisabledGroups: [], selectedEnvName:new Map(), showEnvName:false, eventData:[], @@ -82,6 +99,9 @@ export default { groupId(val) { this.envGroupId = val; }, + environmentType(val) { + this.radio = val; + } }, computed: { ENV_TYPE() { @@ -93,12 +113,19 @@ export default { projectList:Array, projectEnvMap:Object, envMap: Map, + environmentType: String, groupId: { type: String, default() { return ""; } }, + hasOptionGroup: { + type: Boolean, + default() { + return false; + } + }, }, methods: { open(){ @@ -107,7 +134,7 @@ export default { this.getgroups(); }, radioChange(val){ - this.radio = val; + this.$emit("update:environmentType", val); }, getProjectName(id) { const project = this.projectList.find(p => p.id === id); @@ -121,10 +148,27 @@ export default { this.visible = true; }, getgroups(){ - environmentGetALL().then(res => { - let data = res.data; - this.groups = data ? data : []; - }) + if (!this.hasOptionGroup){ + environmentGetALL().then(res => { + let data = res.data; + this.groups = data ? data : []; + }) + } else { + getEnvironmentOptions({projectIds: [...this.projectIds]}).then(res => { + let groups = res.data; + this.disabledGroups = groups.filter(group => group.disabled === true); + this.notDisabledGroups = groups.filter(group => group.disabled === false); + this.$set(this.groups, 0, { + label: this.$t('workspace.env_group.available_group'), + options: this.notDisabledGroups + }); + this.$set(this.groups, 1, { + label: this.$t('workspace.env_group.not_available_group'), + options: this.disabledGroups + }); + }) + } + }, chooseEnv(val){ let filter = this.evnList.filter(e => e.id === val);