diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTaskMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTaskMapper.java index 219853b289..314bbe1cc0 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTaskMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTaskMapper.java @@ -11,4 +11,6 @@ public interface ExtTaskMapper { void deleteByResourceId(String id); List getTasks (@Param("request") TaskCenterRequest request); + List getRunningTasks (@Param("request") TaskCenterRequest request); + } \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTaskMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTaskMapper.xml index 349c5d4865..f71d943de0 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTaskMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtTaskMapper.xml @@ -40,4 +40,25 @@ )tt ORDER BY tt.executionTime DESC; + + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/task/controller/TaskController.java b/backend/src/main/java/io/metersphere/task/controller/TaskController.java index e5a5be889b..39b1a79262 100644 --- a/backend/src/main/java/io/metersphere/task/controller/TaskController.java +++ b/backend/src/main/java/io/metersphere/task/controller/TaskController.java @@ -23,4 +23,11 @@ public class TaskController { public List getTasks(@RequestBody TaskCenterRequest request) { return taskService.getTasks(request); } + + @PostMapping("/count/running") + @RequiresPermissions("PROJECT_API_SCENARIO:READ") + public int getRunningTasks(@RequestBody TaskCenterRequest request) { + return taskService.getRunningTasks(request).size(); + } + } diff --git a/backend/src/main/java/io/metersphere/task/service/TaskService.java b/backend/src/main/java/io/metersphere/task/service/TaskService.java index 4151909cf7..e870c17cc1 100644 --- a/backend/src/main/java/io/metersphere/task/service/TaskService.java +++ b/backend/src/main/java/io/metersphere/task/service/TaskService.java @@ -16,4 +16,9 @@ public class TaskService { public List getTasks(TaskCenterRequest request) { return extTaskMapper.getTasks(request); } + + public List getRunningTasks(TaskCenterRequest request) { + return extTaskMapper.getRunningTasks(request); + } + } diff --git a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue index 28d9f81c49..b788e244b9 100644 --- a/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue +++ b/frontend/src/business/components/api/automation/scenario/ApiScenarioList.vue @@ -653,7 +653,7 @@ export default { getReport() { if (this.batchReportId) { this.result.loading = false; - this.$success("批量执行成功,请到报告页面查看详情!"); + this.$success(this.$t('commons.run_message')); this.$refs.taskCenter.open(); } }, diff --git a/frontend/src/business/components/task/TaskCenter.vue b/frontend/src/business/components/task/TaskCenter.vue index ef301d380e..30f314dee0 100644 --- a/frontend/src/business/components/task/TaskCenter.vue +++ b/frontend/src/business/components/task/TaskCenter.vue @@ -10,7 +10,10 @@ - + + + + @@ -80,6 +83,7 @@ export default { ], data() { return { + runningTotal: 0, taskVisible: false, result: {}, taskData: [], @@ -109,11 +113,15 @@ export default { props: { color: String }, + created() { + this.getTaskRunning(); + }, methods: { format(item) { return ''; }, showTaskCenter() { + this.getTaskRunning(); this.init(); this.taskVisible = true; }, @@ -192,6 +200,13 @@ export default { } return mode; }, + getTaskRunning() { + this.condition.projectId = getCurrentProjectID(); + this.$post('/task/center/count/running', this.condition, response => { + this.runningTotal = response.data; + setTimeout(this.getTaskRunning, 5000); + }); + }, init() { this.result.loading = true; this.condition.projectId = getCurrentProjectID(); @@ -281,4 +296,18 @@ export default { padding-left: 0; padding-right: 0; } + +/deep/ .el-badge__content.is-fixed { + top: 25px; +} + +/deep/ .el-badge__content { + border-radius: 10px; + height: 10px; + line-height: 10px; +} + +.item { + margin-right: 10px; +} diff --git a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue index 89ec65cfa1..4c40d4bb51 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiCaseList.vue @@ -621,7 +621,7 @@ export default { handleRunBatch(config) { let obj = {planIds: this.testPlanCaseIds, config: config}; this.$post("/test/plan/api/case/run", obj, response => { - this.$message('任务执行中,请稍后刷新查看结果'); + this.$message(this.$t('commons.run_message')); this.$refs.taskCenter.open(); }); this.search(); diff --git a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue index 812b191d9c..273979c8a6 100644 --- a/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue +++ b/frontend/src/business/components/track/plan/view/comonents/api/TestPlanApiScenarioList.vue @@ -364,7 +364,7 @@ export default { this.buildExecuteParam(param,row); }); this.$post("/test/case/review/scenario/case/run", param, response => { - this.$message('任务执行中,请稍后刷新查看结果'); + this.$message(this.$t('commons.run_message')); this.$refs.taskCenter.open(); }); } @@ -377,7 +377,7 @@ export default { param.condition = selectParam.condition; param.triggerMode = "BATCH"; this.$post("/test/plan/scenario/case/run", param, response => { - this.$message('任务执行中,请稍后刷新查看结果'); + this.$message(this.$t('commons.run_message')); this.$refs.taskCenter.open(); }); } diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 8729333545..e48f3db8d0 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -162,6 +162,7 @@ export default { task_center: "Task center", all_module_title: "All module", create_user: 'Creator', + run_message: "The task is being executed, please go to the task center to view the details", table: { select_tip: "Item {0} data is selected" }, diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index 905bf99a73..bf4f4730e3 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -163,6 +163,7 @@ export default { task_center: "任务中心", all_module_title: "全部模块", create_user: '创建人', + run_message: "任务执行中,请到任务中心查看详情", table: { select_tip: "已选中 {0} 条数据" }, diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index f0fd2943db..5826eb2ee8 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -163,6 +163,7 @@ export default { task_center: "任务中心", all_module_title: "全部模塊", create_user: "創建人", + run_message: "任務執行中,請到任務中心查看詳情", table: { select_tip: "已選中 {0} 條數據" },