diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestReportMapper.java b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestReportMapper.java index 8393cbe12a..79e6c73667 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestReportMapper.java +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestReportMapper.java @@ -1,6 +1,7 @@ package io.metersphere.base.mapper.ext; import io.metersphere.base.domain.LoadTestReport; +import io.metersphere.dto.DashboardTestDTO; import io.metersphere.dto.ReportDTO; import io.metersphere.performance.controller.request.ReportRequest; import org.apache.ibatis.annotations.Param; @@ -16,4 +17,6 @@ public interface ExtLoadTestReportMapper { int appendLine(@Param("testId") String id, @Param("line") String line); LoadTestReport selectByPrimaryKey(String id); + + List selectDashboardTests(@Param("workspaceId") String workspaceId, @Param("startTimestamp") long startTimestamp); } diff --git a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestReportMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestReportMapper.xml index cb8e89e0e5..37d15a0676 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestReportMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/ext/ExtLoadTestReportMapper.xml @@ -48,10 +48,22 @@ + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/dto/DashboardTestDTO.java b/backend/src/main/java/io/metersphere/dto/DashboardTestDTO.java new file mode 100644 index 0000000000..72e70350a3 --- /dev/null +++ b/backend/src/main/java/io/metersphere/dto/DashboardTestDTO.java @@ -0,0 +1,11 @@ +package io.metersphere.dto; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class DashboardTestDTO { + private Long date; + private Integer count; +} diff --git a/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java b/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java index dedd1edc57..3d5ba80c63 100644 --- a/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java +++ b/backend/src/main/java/io/metersphere/performance/controller/PerformanceTestController.java @@ -7,6 +7,7 @@ import io.metersphere.commons.constants.RoleConstants; import io.metersphere.commons.utils.PageUtils; import io.metersphere.commons.utils.Pager; import io.metersphere.commons.utils.SessionUtils; +import io.metersphere.dto.DashboardTestDTO; import io.metersphere.dto.LoadTestDTO; import io.metersphere.performance.service.PerformanceTestService; import io.metersphere.service.FileService; @@ -101,4 +102,9 @@ public class PerformanceTestController { .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + fileOperationRequest.getName() + "\"") .body(bytes); } + + @GetMapping("dashboard/tests") + public List dashboardTests() { + return performanceTestService.dashboardTests(SessionUtils.getCurrentWorkspaceId()); + } } diff --git a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java index 9a4c8cbb22..7ee2d6043f 100644 --- a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java +++ b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java @@ -8,6 +8,7 @@ import io.metersphere.base.mapper.ext.ExtLoadTestReportMapper; import io.metersphere.commons.constants.PerformanceTestStatus; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.LogUtil; +import io.metersphere.dto.DashboardTestDTO; import io.metersphere.dto.LoadTestDTO; import io.metersphere.i18n.Translator; import io.metersphere.performance.engine.Engine; @@ -23,6 +24,8 @@ import org.springframework.util.CollectionUtils; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import java.time.Instant; +import java.time.temporal.ChronoUnit; import java.util.List; import java.util.Optional; import java.util.UUID; @@ -276,4 +279,10 @@ public class PerformanceTestService { return loadTestMapper.selectByExampleWithBLOBs(example); } + public List dashboardTests(String workspaceId) { + Instant oneYearAgo = Instant.now().plus(-365, ChronoUnit.DAYS); + long startTimestamp = oneYearAgo.toEpochMilli(); + return extLoadTestReportMapper.selectDashboardTests(workspaceId, startTimestamp); + } + } diff --git a/frontend/package.json b/frontend/package.json index 5fdab05896..098e3d0295 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -23,7 +23,8 @@ "vue-i18n": "^8.15.3", "vue-router": "^3.1.3", "vuedraggable": "^2.23.2", - "vuex": "^3.1.2" + "vuex": "^3.1.2", + "vue-calendar-heatmap": "^0.8.4" }, "devDependencies": { "@vue/cli-plugin-babel": "^4.1.0", diff --git a/frontend/src/business/components/common/components/MsTestHeatmap.vue b/frontend/src/business/components/common/components/MsTestHeatmap.vue new file mode 100644 index 0000000000..b0e184427c --- /dev/null +++ b/frontend/src/business/components/common/components/MsTestHeatmap.vue @@ -0,0 +1,37 @@ + + + + + diff --git a/frontend/src/business/components/performance/home/PerformanceReportRecentList.vue b/frontend/src/business/components/performance/home/PerformanceReportRecentList.vue new file mode 100644 index 0000000000..74ca92ecfc --- /dev/null +++ b/frontend/src/business/components/performance/home/PerformanceReportRecentList.vue @@ -0,0 +1,63 @@ + + + + + diff --git a/frontend/src/business/components/performance/home/PerformanceTestHome.vue b/frontend/src/business/components/performance/home/PerformanceTestHome.vue index df55161597..7f9992d655 100644 --- a/frontend/src/business/components/performance/home/PerformanceTestHome.vue +++ b/frontend/src/business/components/performance/home/PerformanceTestHome.vue @@ -1,16 +1,54 @@ diff --git a/frontend/src/business/components/performance/home/PerformanceTestRecentList.vue b/frontend/src/business/components/performance/home/PerformanceTestRecentList.vue new file mode 100644 index 0000000000..b21269b031 --- /dev/null +++ b/frontend/src/business/components/performance/home/PerformanceTestRecentList.vue @@ -0,0 +1,65 @@ + + + + + diff --git a/frontend/src/business/main.js b/frontend/src/business/main.js index 5f3587b8c3..baca430ae9 100644 --- a/frontend/src/business/main.js +++ b/frontend/src/business/main.js @@ -12,6 +12,7 @@ import i18n from "../i18n/i18n"; import store from "./store"; import {permission} from './permission' import chart from "../common/js/chart"; +import CalendarHeatmap from "../common/js/calendar-heatmap"; import '../common/css/menu-header.css'; import '../common/css/main.css'; import CKEditor from '@ckeditor/ckeditor5-vue'; @@ -24,6 +25,7 @@ Vue.use(ElementUI, { Vue.use(filters); Vue.use(ajax); Vue.use(chart); +Vue.use(CalendarHeatmap); Vue.use(message); Vue.use(CKEditor); diff --git a/frontend/src/common/js/calendar-heatmap.js b/frontend/src/common/js/calendar-heatmap.js new file mode 100644 index 0000000000..554818e26a --- /dev/null +++ b/frontend/src/common/js/calendar-heatmap.js @@ -0,0 +1,7 @@ +import {CalendarHeatmap} from 'vue-calendar-heatmap' + +export default { + install(Vue) { + Vue.component('calendarHeatmap', CalendarHeatmap); + } +} diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 91646b5130..a39f571fe7 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -60,6 +60,7 @@ export default { 'title': 'Title', 'custom': 'Custom', 'select_date': 'Select date', + 'calendar_heatmap': 'Calendar Heatmap' }, workspace: { 'create': 'Create Workspace', diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index be5c6e87ea..81165aebc1 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -60,6 +60,7 @@ export default { 'title': '标题', 'custom': '自定义', 'select_date': '选择日期', + 'calendar_heatmap': '测试日历' }, workspace: { 'create': '创建工作空间', diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 7f6a454084..4a8b1aa4ac 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -60,6 +60,7 @@ export default { 'title': '標題', 'custom': '自定義', 'select_date': '選擇日期', + 'calendar_heatmap': '測試日曆' }, workspace: { 'create': '創建工作空間',