diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 3f83d27b68..a7494a148b 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -205,12 +205,14 @@ :project-list="projectList" :env-map="projectEnvMap" :env-group-id="envGroupId" + :environment-type="environmentType" @remove="remove" @copyRow="copyRow" @suggestClick="suggestClick" @refReload="refReload" @runScenario="runDebug" @stopScenario="stop" + @setDomain="setDomain" @openScenario="openScenario"/> @@ -528,7 +530,7 @@ export default { currentUser: () => { return getCurrentUser(); }, - setDomain(flag) { + setDomain() { if (this.projectEnvMap && this.projectEnvMap.size > 0) { let scenario = { id: this.currentScenario.id, diff --git a/frontend/src/business/components/api/automation/scenario/common/CustomizeReqInfo.vue b/frontend/src/business/components/api/automation/scenario/common/CustomizeReqInfo.vue index 24259f12a2..b4a45b1bfd 100644 --- a/frontend/src/business/components/api/automation/scenario/common/CustomizeReqInfo.vue +++ b/frontend/src/business/components/api/automation/scenario/common/CustomizeReqInfo.vue @@ -9,7 +9,7 @@ - + {{ $t('api_test.request.refer_to_environment') }} @@ -123,6 +123,9 @@ export default { this.$error(this.$t('api_test.request.url_invalid'), 2000); } }, + setDomain() { + this.$emit("setDomain"); + } } } diff --git a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue index 31c3140d60..6fcba534c1 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiComponent.vue @@ -52,7 +52,7 @@ - + {{ $t('api_test.definition.request.req_param') }} { diff --git a/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue b/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue index 077bd66382..5d23b1ace4 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ApiScenarioComponent.vue @@ -41,7 +41,7 @@ - 启用场景环境 + 启用场景环境 @@ -66,8 +66,7 @@ import MsTcpBasisParameters from "../../../definition/components/request/tcp/Tcp import MsDubboBasisParameters from "../../../definition/components/request/dubbo/BasisParameters"; import MsApiRequestForm from "../../../definition/components/request/http/ApiHttpRequestForm"; import ApiBaseComponent from "../common/ApiBaseComponent"; -import {getCurrentProjectID, getUUID} from "@/common/js/utils"; -import {getUrl} from "@/business/components/api/automation/scenario/component/urlhelper"; +import {getCurrentProjectID, getUUID, strMapToObj} from "@/common/js/utils"; export default { name: "ApiScenarioComponent", @@ -88,7 +87,10 @@ export default { default: false, }, currentEnvironmentId: String, - projectList: Array + projectList: Array, + environmentType: String, + environmentGroupId: String, + envMap: Map }, watch: { message() { @@ -174,30 +176,31 @@ export default { this.$emit('stopScenario'); this.reload(); }, - checkEnv() { + checkEnv(val) { this.$post("/api/automation/checkScenarioEnv", {scenarioDefinition: JSON.stringify(this.scenario), projectId: this.projectId}, res => { if (this.scenario.environmentEnable && !res.data) { this.scenario.environmentEnable = false; this.$warning("当前场景没有环境,需要先设置自身环境"); return; } - this.setDomain(); + this.setDomain(val); }); }, - setDomain() { - if (this.scenario.environmentEnable) { - let param = { - environmentEnable: true, - id: this.scenario.id, - definition: JSON.stringify(this.scenario) - } - this.$post("/api/automation/setDomain", param, res => { - if (res.data) { - let data = JSON.parse(res.data); - this.scenario.hashTree = data.hashTree; - } - }) + setDomain(val) { + let param = { + environmentEnable: val, + id: this.scenario.id, + environmentType: this.environmentType, + environmentGroupId: this.environmentGroupId, + environmentMap: strMapToObj(this.envMap), + definition: JSON.stringify(this.scenario) } + this.$post("/api/automation/setDomain", param, res => { + if (res.data) { + let data = JSON.parse(res.data); + this.scenario.hashTree = data.hashTree; + } + }) }, getCode() { if (this.node && this.node.data.code && this.node.data.debug) { diff --git a/frontend/src/business/components/api/automation/scenario/component/ComponentConfig.vue b/frontend/src/business/components/api/automation/scenario/component/ComponentConfig.vue index 0a21b8acad..ebd9706b8a 100644 --- a/frontend/src/business/components/api/automation/scenario/component/ComponentConfig.vue +++ b/frontend/src/business/components/api/automation/scenario/component/ComponentConfig.vue @@ -20,7 +20,7 @@ :title="title" :color="titleColor" :response="response" - :environmet-type="environmentType" + :environment-type="environmentType" :environment-group-id="envGroupId" :background-color="backgroundColor" :project-list="projectList" @@ -34,7 +34,7 @@ @copyRow="copyRow" @refReload="refReload" @openScenario="openScenario" - + @setDomain="setDomain" /> @@ -231,6 +231,9 @@ export default { }, stopScenario() { this.$emit('stopScenario'); + }, + setDomain() { + this.$emit("setDomain"); } } }
{{ $t('api_test.definition.request.req_param') }}