From 440b264a66b720cbe02a5dddb1d8a9640111f4b5 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Tue, 7 Dec 2021 16:12:46 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=88=A0=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/automation/scenario/EnvSelect.vue | 117 ---------- .../track/plan/common/EnvPopover.vue | 120 ---------- .../track/plan/common/EnvSelect.vue | 211 ------------------ 3 files changed, 448 deletions(-) delete mode 100644 frontend/src/business/components/track/plan/common/EnvPopover.vue delete mode 100644 frontend/src/business/components/track/plan/common/EnvSelect.vue diff --git a/frontend/src/business/components/api/automation/scenario/EnvSelect.vue b/frontend/src/business/components/api/automation/scenario/EnvSelect.vue index 61c2bee5b1..2c1e25a4dc 100644 --- a/frontend/src/business/components/api/automation/scenario/EnvSelect.vue +++ b/frontend/src/business/components/api/automation/scenario/EnvSelect.vue @@ -57,7 +57,6 @@ export default { data() { return { data: [], - // result: {}, projects: [], environments: [], permissionProjectIds:[], @@ -159,122 +158,6 @@ export default { this.$emit('setProjectEnvMap', map); this.$emit('close'); }, - getApiInfo(request) { - if (request.id && request.referenced === 'REF') { - let requestResult = request.requestResult; - let url = request.refType && request.refType === 'CASE' ? "/api/testcase/get/" : "/api/definition/get/"; - let enable = request.enable; - this.$get(url + request.id, response => { - if (response.data) { - Object.assign(request, JSON.parse(response.data.request)); - request.name = response.data.name; - request.enable = enable; - if (response.data.path && response.data.path != null) { - request.path = response.data.path; - request.url = response.data.url; - this.setUrl(request.path); - } - if (response.data.method && response.data.method != null) { - request.method = response.data.method; - } - request.requestResult = requestResult; - request.id = response.data.id; - request.disabled = true; - request.root = true; - if (!request.projectId) { - request.projectId = response.data.projectId; - } - this.reload(); - this.sort(); - } else { - request.referenced = "Deleted"; - } - }) - } - }, - getScenario(scenario) { - this.result = this.$get("/api/automation/getApiScenario/" + scenario.id, response => { - if (response.data) { - scenario.loaded = true; - let obj = {}; - if (response.data.scenarioDefinition) { - obj = JSON.parse(response.data.scenarioDefinition); - scenario.hashTree = obj.hashTree; - } - //scenario.disabled = true; - scenario.name = response.data.name; - if (!scenario.projectId) { - scenario.projectId = response.data.projectId; - } - scenario.headers = obj.headers; - scenario.variables = obj.variables; - scenario.environmentMap = obj.environmentMap; - this.$emit('refReload'); - } else { - scenario.referenced = "Deleted"; - } - }) - }, - recursiveSorting(arr) { - for (let i in arr) { - if (arr[i].referenced === 'REF') { - // 分场景和接口 - if (arr[i].type === "HTTPSamplerProxy") { - // 获取源头内容 - this.getApiInfo(arr[i]); - // 校验是否是全路径 - if (!arr[i].url || (!arr[i].url.startsWith("http://") && !arr[i].url.startsWith("https://"))) { - this.isFullUrl = false; - } - } else if (arr[i].type === "scenario") { - this.getScenario(arr[i]); - } - - } else { - if (arr[i].type === "HTTPSamplerProxy") { - // 校验是否是全路径 - if (arr[i].enable) { - if (!arr[i].url || (!arr[i].url.startsWith("http://") && !arr[i].url.startsWith("https://"))) { - this.isFullUrl = false; - } - } - } - } - if (arr[i].hashTree != undefined && arr[i].hashTree.length > 0) { - this.recursiveSorting(arr[i].hashTree); - } - } - }, - checkFullUrl(scenarioDefinition) { - for (let i in scenarioDefinition) { - // 设置项目ID - let request = scenarioDefinition[i]; - if (request.referenced === 'REF') { - if (request.type === "HTTPSamplerProxy") { - this.getApiInfo(request); - // 校验是否是全路径 - if (!request.url || (!request.url.startsWith("http://") && !request.url.startsWith("https://"))) { - this.isFullUrl = false; - } - } else if (request.type === "scenario") { - this.getScenario(request); - } - } else { - if (request.type === "HTTPSamplerProxy") { - // 校验是否是全路径 - - if (request.enable) { - if (!request.url || (!request.url.startsWith("http://") && !request.url.startsWith("https://"))) { - this.isFullUrl = false; - } - } - } - } - if (scenarioDefinition[i].hashTree != undefined && scenarioDefinition[i].hashTree.length > 0) { - this.recursiveSorting(scenarioDefinition[i].hashTree); - } - } - }, checkEnv(data) { let sign = true; this.isFullUrl = true; diff --git a/frontend/src/business/components/track/plan/common/EnvPopover.vue b/frontend/src/business/components/track/plan/common/EnvPopover.vue deleted file mode 100644 index 7b11d53566..0000000000 --- a/frontend/src/business/components/track/plan/common/EnvPopover.vue +++ /dev/null @@ -1,120 +0,0 @@ - - - - - diff --git a/frontend/src/business/components/track/plan/common/EnvSelect.vue b/frontend/src/business/components/track/plan/common/EnvSelect.vue deleted file mode 100644 index cbdfd95f87..0000000000 --- a/frontend/src/business/components/track/plan/common/EnvSelect.vue +++ /dev/null @@ -1,211 +0,0 @@ - - - - -