diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtOperatingLogMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtOperatingLogMapper.java index 74d2a88bf4..ed0bd44183 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtOperatingLogMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtOperatingLogMapper.java @@ -9,4 +9,7 @@ import java.util.List; public interface ExtOperatingLogMapper { List list(@Param("request") OperatingLogRequest request); + + List findBySourceId(@Param("request") OperatingLogRequest request); + } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtOperatingLogMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtOperatingLogMapper.xml index 327c592f34..7e374e567d 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtOperatingLogMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtOperatingLogMapper.xml @@ -41,4 +41,31 @@ order by t.oper_time desc + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/log/controller/OperatingLogController.java b/backend/src/main/java/io/metersphere/log/controller/OperatingLogController.java index c7b1e873ff..63f4d0fa7d 100644 --- a/backend/src/main/java/io/metersphere/log/controller/OperatingLogController.java +++ b/backend/src/main/java/io/metersphere/log/controller/OperatingLogController.java @@ -35,4 +35,10 @@ public class OperatingLogController { return operatingLogService.get(id); } + + @GetMapping("/get/source/{id}") + public List findBySourceId(@PathVariable String id) { + return operatingLogService.findBySourceId(id); + } + } diff --git a/backend/src/main/java/io/metersphere/log/service/OperatingLogService.java b/backend/src/main/java/io/metersphere/log/service/OperatingLogService.java index bf726ccbbf..f4c96f6ad1 100644 --- a/backend/src/main/java/io/metersphere/log/service/OperatingLogService.java +++ b/backend/src/main/java/io/metersphere/log/service/OperatingLogService.java @@ -45,4 +45,18 @@ public class OperatingLogService { } return dto; } + + public List findBySourceId(String id) { + OperatingLogRequest request = new OperatingLogRequest(); + request.setSourceId("%" + id + "%"); + List logWithBLOBs = extOperatingLogMapper.findBySourceId(request); + if (CollectionUtils.isNotEmpty(logWithBLOBs)) { + for (OperatingLogDTO logWithBLOB : logWithBLOBs) { + if (StringUtils.isNotEmpty(logWithBLOB.getOperContent())) { + logWithBLOB.setDetails(JSON.parseObject(logWithBLOB.getOperContent(), OperatingLogDetails.class)); + } + } + } + return logWithBLOBs; + } } diff --git a/backend/src/main/java/io/metersphere/log/vo/OperatingLogDTO.java b/backend/src/main/java/io/metersphere/log/vo/OperatingLogDTO.java index 2e015310c7..4912a95659 100644 --- a/backend/src/main/java/io/metersphere/log/vo/OperatingLogDTO.java +++ b/backend/src/main/java/io/metersphere/log/vo/OperatingLogDTO.java @@ -28,5 +28,7 @@ public class OperatingLogDTO implements Serializable { private Long operTime; + private String operContent; + private OperatingLogDetails details; } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/log/vo/performance/PerformanceReference.java b/backend/src/main/java/io/metersphere/log/vo/performance/PerformanceReference.java index 0f3ad969a7..87f28ae424 100644 --- a/backend/src/main/java/io/metersphere/log/vo/performance/PerformanceReference.java +++ b/backend/src/main/java/io/metersphere/log/vo/performance/PerformanceReference.java @@ -15,6 +15,7 @@ public class PerformanceReference { performanceColumns.put("loadConfiguration", "压力配置"); performanceColumns.put("advancedConfiguration", "高级配置"); performanceColumns.put("description", "描述"); + performanceColumns.put("ms-dff-col", "loadConfiguration,advancedConfiguration"); reportColumns.put("name","报告名称"); } diff --git a/backend/src/main/java/io/metersphere/log/vo/track/TestCaseReference.java b/backend/src/main/java/io/metersphere/log/vo/track/TestCaseReference.java index 0e9a7b2254..b689b256d2 100644 --- a/backend/src/main/java/io/metersphere/log/vo/track/TestCaseReference.java +++ b/backend/src/main/java/io/metersphere/log/vo/track/TestCaseReference.java @@ -16,7 +16,7 @@ public class TestCaseReference { testCaseColumns.put("priority", "用例等级"); testCaseColumns.put("method", "请求类型"); testCaseColumns.put("prerequisite", "前置条件"); - testCaseColumns.put("remark", "评论"); + testCaseColumns.put("remark", "备注"); testCaseColumns.put("steps", "用例步骤"); testCaseColumns.put("other_test_name", "其他名称"); testCaseColumns.put("review_status", "评审状态"); @@ -24,7 +24,8 @@ public class TestCaseReference { testCaseColumns.put("demand_name", "需求名称"); testCaseColumns.put("follow_people", "关注人"); testCaseColumns.put("status", "用例状态"); - testCaseColumns.put("step_description", "步骤描述"); - testCaseColumns.put("expected_result", "预期结果"); + testCaseColumns.put("stepDescription", "步骤描述"); + testCaseColumns.put("expectedResult", "预期结果"); + testCaseColumns.put("comment", "评论"); } } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index 122b16bcbd..e2eec2c61e 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -30,6 +30,7 @@ import io.metersphere.log.vo.OperatingLogDetails; import io.metersphere.log.vo.track.TestCaseReference; import io.metersphere.service.FileService; import io.metersphere.service.ProjectService; +import io.metersphere.track.dto.TestCaseCommentDTO; import io.metersphere.track.dto.TestCaseDTO; import io.metersphere.track.request.testcase.EditTestCaseRequest; import io.metersphere.track.request.testcase.QueryTestCaseRequest; @@ -1156,6 +1157,13 @@ public class TestCaseService { TestCaseWithBLOBs bloBs = testCaseMapper.selectByPrimaryKey(id); if (bloBs != null) { List columns = ReflexObjectUtil.getColumns(bloBs, TestCaseReference.testCaseColumns); + // 增加评论内容 + List dtos = testCaseCommentService.getCaseComments(id); + if (CollectionUtils.isNotEmpty(dtos)) { + List names = dtos.stream().map(TestCaseCommentDTO::getDescription).collect(Collectors.toList()); + DetailColumn detailColumn = new DetailColumn("评论", "comment", String.join("\n", names), null); + columns.add(detailColumn); + } OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(id), bloBs.getProjectId(), bloBs.getName(), bloBs.getCreateUser(), columns); return JSON.toJSONString(details); } @@ -1168,6 +1176,13 @@ public class TestCaseService { String testCaseId = testPlanTestCaseMapper.selectByPrimaryKey(id).getCaseId(); TestCaseWithBLOBs testCaseWithBLOBs = testCaseMapper.selectByPrimaryKey(testCaseId); List columns = ReflexObjectUtil.getColumns(bloBs, TestCaseReference.testCaseColumns); + // 增加评论内容 + List dtos = testCaseCommentService.getCaseComments(id); + if (CollectionUtils.isNotEmpty(dtos)) { + List names = dtos.stream().map(TestCaseCommentDTO::getDescription).collect(Collectors.toList()); + DetailColumn detailColumn = new DetailColumn("评论", "comment", String.join("\n", names), null); + columns.add(detailColumn); + } OperatingLogDetails details = new OperatingLogDetails(JSON.toJSONString(testCaseWithBLOBs.getId()), testCaseWithBLOBs.getProjectId(), testCaseWithBLOBs.getName(), testCaseWithBLOBs.getCreateUser(), columns); return JSON.toJSONString(details); } diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index 5f06c2bc54..c3c00da2ce 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -5,6 +5,8 @@
+ {{$t('operating_log.change_history')}} + {{ $t('commons.save') }} @@ -224,6 +226,7 @@ +
@@ -262,6 +265,7 @@ import MsDrawer from "../../../common/components/MsDrawer"; import MsSelectTree from "../../../common/select-tree/SelectTree"; import {saveScenario} from "@/business/components/api/automation/api-automation"; + import MsChangeHistory from "../../../history/ChangeHistory"; let jsonPath = require('jsonpath'); export default { @@ -289,7 +293,8 @@ MaximizeScenario, ScenarioHeader, MsDrawer, - MsSelectTree + MsSelectTree, + MsChangeHistory }, data() { return { @@ -494,6 +499,9 @@ }, }, methods: { + openHis(){ + this.$refs.changeHistory.open(this.currentScenario.id); + }, setModule(id, data) { this.currentScenario.apiScenarioModuleId = id; this.currentScenario.modulePath = data.path; diff --git a/frontend/src/business/components/api/definition/components/complete/EditCompleteDubboApi.vue b/frontend/src/business/components/api/definition/components/complete/EditCompleteDubboApi.vue index 30440cd444..6affa3cfef 100644 --- a/frontend/src/business/components/api/definition/components/complete/EditCompleteDubboApi.vue +++ b/frontend/src/business/components/api/definition/components/complete/EditCompleteDubboApi.vue @@ -6,6 +6,7 @@
+ {{$t('operating_log.change_history')}} {{ $t('commons.save') }} {{ $t('commons.test') }}
@@ -24,18 +25,19 @@

{{ $t('api_test.definition.request.req_param') }}

- + + + diff --git a/frontend/src/business/components/history/HistoryDetail.vue b/frontend/src/business/components/history/HistoryDetail.vue new file mode 100644 index 0000000000..8726df0424 --- /dev/null +++ b/frontend/src/business/components/history/HistoryDetail.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/frontend/src/business/components/performance/test/EditPerformanceTest.vue b/frontend/src/business/components/performance/test/EditPerformanceTest.vue index c87f886cc8..e682086de6 100644 --- a/frontend/src/business/components/performance/test/EditPerformanceTest.vue +++ b/frontend/src/business/components/performance/test/EditPerformanceTest.vue @@ -12,6 +12,7 @@
+ {{$t('operating_log.change_history')}} {{ $t('commons.save') }} {{ $t('load_test.save_and_run') }} @@ -41,6 +42,9 @@ + + + @@ -54,6 +58,7 @@ import MsMainContainer from "../../common/components/MsMainContainer"; import {checkoutTestManagerOrTestUser, getCurrentProjectID} from "@/common/js/utils"; import MsScheduleConfig from "../../common/components/MsScheduleConfig"; import {LIST_CHANGE, PerformanceEvent} from "@/business/components/common/head/ListEvent"; +import MsChangeHistory from "../../history/ChangeHistory"; export default { name: "EditPerformanceTest", @@ -63,7 +68,8 @@ export default { PerformanceBasicConfig, PerformanceAdvancedConfig, MsContainer, - MsMainContainer + MsMainContainer, + MsChangeHistory }, data() { return { @@ -122,6 +128,9 @@ export default { this.importAPITest(); }, methods: { + openHis(){ + this.$refs.changeHistory.open(this.test.id); + }, importAPITest() { let apiTest = this.$store.state.test; if (apiTest && apiTest.name) { diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index 58f97e27e4..5557c982b2 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -5,6 +5,7 @@
+ {{$t('operating_log.change_history')}} + @getValue="setModule" clearable checkStrictly size="small"/> @@ -74,8 +75,8 @@ - - + + @@ -108,6 +109,8 @@
+ + @@ -115,679 +118,684 @@ diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index d49db2f458..14e8d79ddd 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -1822,5 +1822,6 @@ export default { before_change: "Before change", after_change: "After change", share: "Share", + change_history: "Change history", } }; diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index d53d22fc8d..b99205421a 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -1830,5 +1830,6 @@ export default { before_change: "变更前", after_change: "变更后", share: "分享", + change_history: "变更历史", } }; diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 1f874af402..3984f6aad8 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -1830,5 +1830,6 @@ export default { before_change: "變更前", after_change: "變更後", share: "分享", + change_history: "變更歷史", } };