diff --git a/backend/src/main/java/io/metersphere/log/utils/ReflexObjectUtil.java b/backend/src/main/java/io/metersphere/log/utils/ReflexObjectUtil.java index 37dce7733b..c951fb62d8 100644 --- a/backend/src/main/java/io/metersphere/log/utils/ReflexObjectUtil.java +++ b/backend/src/main/java/io/metersphere/log/utils/ReflexObjectUtil.java @@ -2,16 +2,11 @@ package io.metersphere.log.utils; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonObject; import io.metersphere.commons.utils.BeanUtils; import io.metersphere.commons.utils.LogUtil; -import io.metersphere.log.utils.dff.Diff; -import io.metersphere.log.utils.dff.JsonDiff; -import io.metersphere.log.utils.dff.Operation; import io.metersphere.log.vo.DetailColumn; import io.metersphere.log.vo.OperatingLogDetails; import io.metersphere.log.vo.StatusReference; @@ -60,7 +55,7 @@ public class ReflexObjectUtil { column.setDepthDff(true); if (val != null) { try { - if (ReflexObjectUtil.isJsonArray(val.toString())) { + if (f.getName().equals("loadConfiguration")) { val = "{\"" + "压力配置" + "\":" + val.toString() + "}"; } Gson gson = new GsonBuilder().setPrettyPrinting().create(); @@ -121,51 +116,10 @@ public class ReflexObjectUtil { } } // 深度对比 - if (originalColumns.get(i).isDepthDff() && originalColumns.get(i).getOriginalValue() != null && newColumns.get(i).getOriginalValue() != null) { - ObjectMapper mapper = new ObjectMapper(); - JsonNode source = mapper.readTree(originalColumns.get(i).getOriginalValue().toString()); - JsonNode target = mapper.readTree(newColumns.get(i).getOriginalValue().toString()); - List after = JsonDiff.jsonDiff(source, target); - - StringBuilder addBuff = new StringBuilder(); - StringBuilder removeBuff = new StringBuilder(); - StringBuilder repBuff = new StringBuilder(); - StringBuilder oldValue = new StringBuilder(); - for (Diff item : after) { - if (item.getOperation().equals(Operation.ADD)) { - addBuff.append(item.getPath() + ":" + item.getValue()).append("\n"); - } - if (item.getOperation().equals(Operation.REMOVE)) { - removeBuff.append(item.getPath() + ":" + item.getValue()).append("\n"); - } - if (item.getOperation().equals(Operation.REPLACE)) { - repBuff.append(item.getPath() + ":" + item.getValue()).append("\n"); - oldValue.append(item.getPath() + ":" + item.getSrcValue()).append("\n"); - } - } - StringBuilder newValue = new StringBuilder(); - if (addBuff != null && addBuff.toString().length() > 0) { - newValue.append("添加:\n").append(addBuff).append("\n"); - } - if (removeBuff != null && removeBuff.toString().length() > 0) { - newValue.append("移除:\n").append(removeBuff).append("\n"); - } - if (repBuff != null && repBuff.toString().length() > 0) { - newValue.append("修改:\n").append(repBuff).append("\n"); - } - DetailColumn column = new DetailColumn(); - BeanUtils.copyBean(column, originalColumns.get(i)); - if (oldValue != null && oldValue.length() > 0) { - column.setOriginalValue(oldValue); - } - column.setNewValue(newValue); - comparedColumns.add(column); - } else { - DetailColumn column = new DetailColumn(); - BeanUtils.copyBean(column, originalColumns.get(i)); - column.setNewValue(newColumns.get(i).getOriginalValue()); - comparedColumns.add(column); - } + DetailColumn column = new DetailColumn(); + BeanUtils.copyBean(column, originalColumns.get(i)); + column.setNewValue(newColumns.get(i).getOriginalValue()); + comparedColumns.add(column); } } } diff --git a/frontend/package.json b/frontend/package.json index a3e6164134..aa71a7ebd8 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -29,6 +29,7 @@ "json-bigint": "^1.0.0", "json-schema-faker": "^0.5.0-rcv.32", "json5": "^2.1.3", + "jsondiffpatch": "^0.4.1", "jsoneditor": "^9.1.2", "jsonpath": "^1.1.0", "jspdf": "^2.1.1", diff --git a/frontend/src/business/components/history/ChangeHistory.vue b/frontend/src/business/components/history/ChangeHistory.vue index 31a169722e..ed068d454c 100644 --- a/frontend/src/business/components/history/ChangeHistory.vue +++ b/frontend/src/business/components/history/ChangeHistory.vue @@ -63,7 +63,7 @@ infoVisible: false, loading: false, details: [], - linkDatas: ["prerequisite", "steps", "remark", "request", "response", "scenarioDefinition", "loadConfiguration", "advancedConfiguration"], + linkDatas: ["prerequisite", "steps", "remark", "request", "response", "scenarioDefinition","tags", "loadConfiguration", "advancedConfiguration"], } }, methods: { diff --git a/frontend/src/business/components/history/HistoryDetail.vue b/frontend/src/business/components/history/HistoryDetail.vue index 45cc5423ee..7af8495646 100644 --- a/frontend/src/business/components/history/HistoryDetail.vue +++ b/frontend/src/business/components/history/HistoryDetail.vue @@ -11,27 +11,9 @@

{{ this.$t('report.test_log_details') }}

- - - {{$t('operating_log.before_change')}} - - - {{$t('operating_log.after_change')}} - - - -
-
{{ detail.originalValue }}
-
{{ detail.originalValue }}
-
-
- -
-
{{ detail.newValue }}
-
{{ detail.newValue }}
-
-
+

+          
         
@@ -39,6 +21,8 @@