refactor: 修改报告图表顺序

This commit is contained in:
chenjianxing 2020-07-21 23:54:03 +08:00
parent dabfb990c3
commit f62c6bdb4e
2 changed files with 25 additions and 6 deletions

View File

@ -1,5 +1,6 @@
package io.metersphere.track.domain;
import io.metersphere.commons.constants.TestPlanTestCaseStatus;
import io.metersphere.track.dto.TestCaseReportMetricDTO;
import io.metersphere.track.dto.TestCaseReportStatusResultDTO;
import io.metersphere.track.dto.TestPlanCaseDTO;
@ -7,6 +8,7 @@ import io.metersphere.track.dto.TestPlanDTO;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ReportResultChartComponent extends ReportComponent {
@ -25,7 +27,24 @@ public class ReportResultChartComponent extends ReportComponent {
@Override
public void afterBuild(TestCaseReportMetricDTO testCaseReportMetric) {
testCaseReportMetric.setExecuteResult(new ArrayList<>(reportStatusResultMap.values()));
testCaseReportMetric.setExecuteResult(getReportStatusResult());
}
private List<TestCaseReportStatusResultDTO> getReportStatusResult() {
List<TestCaseReportStatusResultDTO> reportStatusResult = new ArrayList<>();
addToReportStatusResultList(reportStatusResult, TestPlanTestCaseStatus.Pass.name());
addToReportStatusResultList(reportStatusResult, TestPlanTestCaseStatus.Failure.name());
addToReportStatusResultList(reportStatusResult, TestPlanTestCaseStatus.Blocking.name());
addToReportStatusResultList(reportStatusResult, TestPlanTestCaseStatus.Skip.name());
addToReportStatusResultList(reportStatusResult, TestPlanTestCaseStatus.Underway.name());
addToReportStatusResultList(reportStatusResult, TestPlanTestCaseStatus.Prepare.name());
return reportStatusResult;
}
private void addToReportStatusResultList(List<TestCaseReportStatusResultDTO> reportStatusResultList, String status) {
if (reportStatusResultMap.get(status) != null) {
reportStatusResultList.add(reportStatusResultMap.get(status));
}
}
private void getStatusResultMap(Map<String, TestCaseReportStatusResultDTO> reportStatusResultMap, TestPlanCaseDTO testCase) {

View File

@ -24,11 +24,11 @@
return {
dataMap: new Map([
["Pass", {name: this.$t('test_track.plan_view.pass'), itemStyle: {color: '#67C23A'}}],
["Failure", {name: this.$t('test_track.plan_view.failure'), itemStyle: {color: '#F56C6C'}}],
["Blocking", {name: this.$t('test_track.plan_view.blocking'), itemStyle: {color: '#E6A23C'}}],
["Skip", {name: this.$t('test_track.plan_view.skip'), itemStyle: {color: '#909399'}}],
["Prepare", {name: this.$t('test_track.plan.plan_status_prepare'), itemStyle: {color: '#DEDE10'}}],
["Failure", {name: this.$t('test_track.plan_view.failure'), itemStyle: {color: '#F56C6C'}}],
["Underway", {name: this.$t('test_track.plan.plan_status_running'), itemStyle: {color: 'lightskyblue'}}]
["Underway", {name: this.$t('test_track.plan.plan_status_running'), itemStyle: {color: 'lightskyblue'}}],
["Prepare", {name: this.$t('test_track.plan.plan_status_prepare'), itemStyle: {color: '#DEDE10'}}]
]),
charData: [],
isShow: true
@ -40,11 +40,11 @@
default() {
return [
{status: 'Pass', count: '235'},
{status: 'Failure', count: '310'},
{status: 'Blocking', count: '274'},
{status: 'Skip', count: '335'},
{status: 'Prepare', count: '265'},
{status: 'Failure', count: '310'},
{status: 'Underway', count: '245'},
{status: 'Prepare', count: '265'},
]
}
}