From c924098125b0e02495215b82cb1569299a075eda Mon Sep 17 00:00:00 2001 From: junhong Date: Fri, 18 Feb 2022 18:15:04 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E5=85=A8=E5=B1=80=E5=89=8D=E5=90=8E=E7=BD=AE=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E5=A2=9E=E5=8A=A0=E5=8E=86=E5=8F=B2=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E5=8F=98=E6=9B=B4=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1010312 --user=周骏弘 【系统设置】/【项目设置】-环境管理-前置脚本变更记录-变更前后详情页面-日志详情标题显示不符 https://www.tapd.cn/55049933/s/1105981 --- .../log/utils/ApiTestEnvironmentDiffUtil.java | 33 ++++++ .../history/api/EnvironmentEditParams.vue | 103 +++++++++++++----- .../history/api/EnvironmentHistoryDetail.vue | 21 ++++ frontend/src/i18n/en-US.js | 7 ++ frontend/src/i18n/zh-CN.js | 7 ++ frontend/src/i18n/zh-TW.js | 7 ++ 6 files changed, 152 insertions(+), 26 deletions(-) diff --git a/backend/src/main/java/io/metersphere/log/utils/ApiTestEnvironmentDiffUtil.java b/backend/src/main/java/io/metersphere/log/utils/ApiTestEnvironmentDiffUtil.java index 0af8a155a3..19d328d9f9 100644 --- a/backend/src/main/java/io/metersphere/log/utils/ApiTestEnvironmentDiffUtil.java +++ b/backend/src/main/java/io/metersphere/log/utils/ApiTestEnvironmentDiffUtil.java @@ -19,6 +19,39 @@ public class ApiTestEnvironmentDiffUtil { // 对比全局脚本配置参数 if (!StringUtils.equals(bloBsNew.getString("globalScriptConfig"), bloBsOld.getString("globalScriptConfig"))) { + JSONObject globalScriptNew = JSON.parseObject(bloBsNew.getString("globalScriptConfig")); + JSONObject globalScriptOld = JSON.parseObject(bloBsOld.getString("globalScriptConfig")); + // 前置脚本过滤请求类型 + if (!StringUtils.equals(globalScriptNew.getString("filterRequestPreScript"), globalScriptOld.getString("filterRequestPreScript"))) { + diffMap.put("filterRequestPreScriptRaw1", globalScriptNew.getString("filterRequestPreScript")); + diffMap.put("filterRequestPreScriptRaw2", globalScriptOld.getString("filterRequestPreScript")); + } + // 后置脚本过滤请求类型 + if (!StringUtils.equals(globalScriptNew.getString("filterRequestPostScript"), globalScriptOld.getString("filterRequestPostScript"))) { + diffMap.put("filterRequestPostScriptRaw1", globalScriptNew.getString("filterRequestPostScript")); + diffMap.put("filterRequestPostScriptRaw2", globalScriptOld.getString("filterRequestPostScript")); + } + // 前置脚本执行顺序 + if (!StringUtils.equals(globalScriptNew.getString("isPreScriptExecAfterPrivateScript"), globalScriptOld.getString("isPreScriptExecAfterPrivateScript"))) { + diffMap.put("isPreScriptExecAfterPrivateScriptRaw1", globalScriptNew.getString("isPreScriptExecAfterPrivateScript")); + diffMap.put("isPreScriptExecAfterPrivateScriptRaw2", globalScriptOld.getString("isPreScriptExecAfterPrivateScript")); + } + // 后置脚本执行顺序 + if (!StringUtils.equals(globalScriptNew.getString("isPostScriptExecAfterPrivateScript"), globalScriptOld.getString("isPostScriptExecAfterPrivateScript"))) { + diffMap.put("isPostScriptExecAfterPrivateScriptRaw1", globalScriptNew.getString("isPostScriptExecAfterPrivateScript")); + diffMap.put("isPostScriptExecAfterPrivateScriptRaw2", globalScriptOld.getString("isPostScriptExecAfterPrivateScript")); + } + // 前置关联场景结果 + if (!StringUtils.equals(globalScriptNew.getString("connScenarioPreScript"), globalScriptOld.getString("connScenarioPreScript"))) { + diffMap.put("connScenarioPreScriptRaw1", globalScriptNew.getString("connScenarioPreScript")); + diffMap.put("connScenarioPreScriptRaw2", globalScriptOld.getString("connScenarioPreScript")); + } + // 后置关联场景结果 + if (!StringUtils.equals(globalScriptNew.getString("connScenarioPostScript"), globalScriptOld.getString("connScenarioPostScript"))) { + diffMap.put("connScenarioPostScriptRaw1", globalScriptNew.getString("connScenarioPostScript")); + diffMap.put("connScenarioPostScriptRaw2", globalScriptOld.getString("connScenarioPostScript")); + } + // 全局脚本设置 diffMap.put("globalScriptConfigRaw1", bloBsNew.getString("globalScriptConfig")); diffMap.put("globalScriptConfigRaw2", bloBsOld.getString("globalScriptConfig")); } diff --git a/frontend/src/business/components/history/api/EnvironmentEditParams.vue b/frontend/src/business/components/history/api/EnvironmentEditParams.vue index e9cc88892a..f062f6fefc 100644 --- a/frontend/src/business/components/history/api/EnvironmentEditParams.vue +++ b/frontend/src/business/components/history/api/EnvironmentEditParams.vue @@ -3,18 +3,42 @@
- + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+
+
+
- +
- +
@@ -22,31 +46,45 @@ - + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+
+
- +
- +
- - - - -
@@ -76,21 +114,34 @@ preStepProcessor: "preStepProcessor", postStepProcessor: "preStepProcessor", loading: false, + + showPre: false, + showPost: false, } }, methods: { active() { + if (this.request.script && (this.request.script.postProcessorRaw1 || this.request.script.postProcessorRaw2 + || this.request.script.postStepProcessorRaw1 || this.request.script.postStepProcessorRaw2) + || ((this.request.script.globalScriptConfigRaw1 || this.request.script.globalScriptConfigRaw2) && + (this.request.script.globalScriptConfig.filterRequestPostScriptRaw1 || this.request.script.globalScriptConfig.filterRequestPostScriptRaw2 + || this.request.script.globalScriptConfig.isPostScriptExecAfterPrivateScriptRaw1 || this.request.script.globalScriptConfig.isPostScriptExecAfterPrivateScriptRaw2 + || this.request.script.globalScriptConfig.connScenarioPostScriptRaw1 || this.request.script.globalScriptConfig.connScenarioPostScriptRaw2))){ + this.showPost = true; + this.activeName = 'allPostScript'; + }else { + this.showPost = false; + } if (this.request.script && (this.request.script.preProcessorRaw1 || this.request.script.preProcessorRaw2 - || this.request.script.preStepProcessorRaw1 || this.request.script.preStepProcessorRaw2)) { - this.activeName = "allPreScript"; - } - else if (this.request.script - && (this.request.script.postProcessorRaw1 || this.request.script.postProcessorRaw2 - || this.request.script.postStepProcessorRaw1 || this.request.script.postStepProcessorRaw2)) { - this.activeName = "allPostScript"; - } - else if (this.request.script && (this.request.script.globalScriptConfigRaw1 || this.request.script.globalScriptConfigRaw2)) { - this.activeName = "globalScriptConfig"; + || this.request.script.preStepProcessorRaw1 || this.request.script.preStepProcessorRaw2) + || ((this.request.script.globalScriptConfigRaw1 || this.request.script.globalScriptConfigRaw2) && + (this.request.script.globalScriptConfig.filterRequestPreScriptRaw1 || this.request.script.globalScriptConfig.filterRequestPreScriptRaw2 + || this.request.script.globalScriptConfig.isPreScriptExecAfterPrivateScriptRaw1 || this.request.script.globalScriptConfig.isPreScriptExecAfterPrivateScriptRaw2 + || this.request.script.globalScriptConfig.connScenarioPreScriptRaw1 || this.request.script.globalScriptConfig.connScenarioPreScriptRaw2))) { + this.showPre = true; + this.activeName = 'allPreScript'; + }else { + this.showPre = false; } }, getDiff(v1, v2) { diff --git a/frontend/src/business/components/history/api/EnvironmentHistoryDetail.vue b/frontend/src/business/components/history/api/EnvironmentHistoryDetail.vue index 90118afd20..bdc32629b7 100644 --- a/frontend/src/business/components/history/api/EnvironmentHistoryDetail.vue +++ b/frontend/src/business/components/history/api/EnvironmentHistoryDetail.vue @@ -56,6 +56,27 @@ formatScript(diffValue) { this.detail.script = {}; if (diffValue.globalScriptConfigRaw1 || diffValue.globalScriptConfigRaw2) { + + this.detail.script.globalScriptConfig = {}; + this.detail.script.globalScriptConfig.filterRequestPreScriptRaw1 = diffValue.filterRequestPreScriptRaw1; + this.detail.script.globalScriptConfig.filterRequestPreScriptRaw2 = diffValue.filterRequestPreScriptRaw2; + + this.detail.script.globalScriptConfig.filterRequestPostScriptRaw1 = diffValue.filterRequestPostScriptRaw1; + this.detail.script.globalScriptConfig.filterRequestPostScriptRaw2 = diffValue.filterRequestPostScriptRaw2; + + this.detail.script.globalScriptConfig.isPreScriptExecAfterPrivateScriptRaw1 = diffValue.isPreScriptExecAfterPrivateScriptRaw1; + this.detail.script.globalScriptConfig.isPreScriptExecAfterPrivateScriptRaw2 = diffValue.isPreScriptExecAfterPrivateScriptRaw2; + + this.detail.script.globalScriptConfig.isPostScriptExecAfterPrivateScriptRaw1 = diffValue.isPostScriptExecAfterPrivateScriptRaw1; + this.detail.script.globalScriptConfig.isPostScriptExecAfterPrivateScriptRaw2 = diffValue.isPostScriptExecAfterPrivateScriptRaw2; + + this.detail.script.globalScriptConfig.connScenarioPreScriptRaw1 = diffValue.connScenarioPreScriptRaw1; + this.detail.script.globalScriptConfig.connScenarioPreScriptRaw2 = diffValue.connScenarioPreScriptRaw2; + + this.detail.script.globalScriptConfig.connScenarioPostScriptRaw1 = diffValue.connScenarioPostScriptRaw1; + this.detail.script.globalScriptConfig.connScenarioPostScriptRaw2 = diffValue.connScenarioPostScriptRaw2; + + // 全局脚本配置 this.detail.script.globalScriptConfigRaw1 = diffValue.globalScriptConfigRaw1; this.detail.script.globalScriptConfigRaw2 = diffValue.globalScriptConfigRaw2; } diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 9ff73b47a0..21eddc1d44 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -1865,6 +1865,13 @@ export default { after_the_post_script_step: "After the script is placed in the step", before_the_post_script_step: "Post-in-step before script", global_script_config: "Global script config", + + pre_script_filter_request_type: "Pre script filter request type", + post_script_filter_request_type: "Post script filter request type", + pre_script_exec_order: "Pre script exec order", + post_script_exec_order: "Post script exec order", + pre_link_scenario_result: "Pre link scenario result", + post_link_scenario_result: "Post link scenario result", } }, api_report: { diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index daf5d5b848..a1d6f51133 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -1870,6 +1870,13 @@ export default { after_the_post_script_step: "步骤内后置脚本后", before_the_post_script_step: "步骤内后置脚本前", global_script_config: "全局脚本配置", + + pre_script_filter_request_type: "前置脚本过滤请求类型", + post_script_filter_request_type: "后置脚本过滤请求类型", + pre_script_exec_order: "前置脚本执行顺序", + post_script_exec_order: "后置脚本执行顺序", + pre_link_scenario_result: "前置关联场景结果", + post_link_scenario_result: "后置关联场景结果", } }, api_report: { diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 6d0013b75c..9c538f00de 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -1870,6 +1870,13 @@ export default { after_the_post_script_step: "步驟內後置腳本後", before_the_post_script_step: "步驟內後置腳本前", global_script_config: "全局腳本配置", + + pre_script_filter_request_type: "前置腳本過濾請求類型", + post_script_filter_request_type: "後置腳本過濾請求類型", + pre_script_exec_order: "前置腳本執行順序", + post_script_exec_order: "後置腳本執行順序", + pre_link_scenario_result: "前置關聯場景結果", + post_link_scenario_result: "後置關聯場景結果", } }, api_report: {