This commit is contained in:
chenjianxing 2020-06-02 11:51:05 +08:00
commit 91ffab8c30
15 changed files with 121 additions and 33 deletions

View File

@ -26,6 +26,16 @@
<if test="request.id != null">
AND load_test.id = #{request.id}
</if>
<if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
and load_test.${key} in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</if>
</foreach>
</if>
</where>
<if test="request.orders != null and request.orders.size() > 0">
order by

View File

@ -31,8 +31,23 @@
<if test="reportRequest.workspaceId != null">
AND workspace_id = #{reportRequest.workspaceId,jdbcType=VARCHAR}
</if>
<if test="reportRequest.filters != null and reportRequest.filters.size() > 0">
<foreach collection="reportRequest.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">
and ltr.${key} in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</if>
</foreach>
</if>
</where>
ORDER BY ltr.update_time DESC
<if test="reportRequest.orders != null and reportRequest.orders.size() > 0">
order by
<foreach collection="reportRequest.orders" separator="," item="order">
ltr.${order.name} ${order.type}
</foreach>
</if>
</select>
<select id="getReportTestAndProInfo" resultType="io.metersphere.dto.ReportDTO">

View File

@ -1,11 +1,17 @@
package io.metersphere.performance.controller.request;
import io.metersphere.controller.request.OrderRequest;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
import java.util.Map;
@Getter
@Setter
public class ReportRequest {
private String name;
private String workspaceId;
private List<OrderRequest> orders;
private Map<String, List<String>> filters;
}

View File

@ -1,6 +1,5 @@
package io.metersphere.performance.service;
import io.metersphere.api.dto.SaveAPITestRequest;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtLoadTestMapper;
@ -10,6 +9,7 @@ import io.metersphere.commons.constants.APITestStatus;
import io.metersphere.commons.constants.PerformanceTestStatus;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.dto.DashboardTestDTO;
import io.metersphere.dto.LoadTestDTO;
@ -66,6 +66,7 @@ public class PerformanceTestService {
private ReportService reportService;
public List<LoadTestDTO> list(QueryTestPlanRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
return extLoadTestMapper.list(request);
}

View File

@ -12,6 +12,7 @@ import io.metersphere.commons.constants.PerformanceTestStatus;
import io.metersphere.commons.constants.ReportKeys;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.commons.utils.ServiceUtils;
import io.metersphere.dto.LogDetailDTO;
import io.metersphere.dto.ReportDTO;
import io.metersphere.performance.base.*;
@ -51,6 +52,7 @@ public class ReportService {
}
public List<ReportDTO> getReportList(ReportRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
return extLoadTestReportMapper.getReportList(request);
}

View File

@ -5,10 +5,12 @@ import lombok.Getter;
import lombok.Setter;
import java.util.List;
import java.util.Map;
@Getter
@Setter
public class QueryTestPlanRequest extends TestPlanRequest {
private String workspaceId;
private List<OrderRequest> orders;
private Map<String, List<String>> filters;
}

View File

@ -15,20 +15,25 @@
<el-table-column prop="testName" :label="$t('api_report.test_name')" width="200" show-overflow-tooltip/>
<el-table-column prop="projectName" :label="$t('load_test.project_name')" width="150" show-overflow-tooltip/>
<el-table-column prop="userName" :label="$t('api_test.creator')" width="150" show-overflow-tooltip/>
<el-table-column width="250" :label="$t('commons.create_time')">
<el-table-column width="250" :label="$t('commons.create_time')" sortable
prop="createTime">
<template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column prop="status" :label="$t('commons.status')">
<el-table-column prop="status" :label="$t('commons.status')"
:filter-method="filter"
:filters="statusFilters">
<template v-slot:default="{row}">
<ms-api-report-status :row="row"/>
</template>
</el-table-column>
<el-table-column width="150" :label="$t('commons.operating')">
<template v-slot:default="scope">
<el-button :is-tester-permission="true" @click="handleView(scope.row)" type="primary" icon="el-icon-s-data" size="mini" circle/>
<el-button :is-tester-permission="true" @click="handleDelete(scope.row)" type="danger" icon="el-icon-delete" size="mini" circle/>
<el-button :is-tester-permission="true" @click="handleView(scope.row)" type="primary"
icon="el-icon-s-data" size="mini" circle/>
<el-button :is-tester-permission="true" @click="handleDelete(scope.row)" type="danger"
icon="el-icon-delete" size="mini" circle/>
</template>
</el-table-column>
</el-table>
@ -57,7 +62,15 @@
currentPage: 1,
pageSize: 5,
total: 0,
loading: false
loading: false,
statusFilters: [
{text: 'Saved', value: 'Saved'},
{text: 'Starting', value: 'Starting'},
{text: 'Running', value: 'Running'},
{text: 'Reporting', value: 'Reporting'},
{text: 'Completed', value: 'Completed'},
{text: 'Error', value: 'Error'}
]
}
},
@ -106,6 +119,9 @@
init() {
this.testId = this.$route.params.testId;
this.search();
},
filter(value, row) {
return row.status === value;
}
},

View File

@ -15,17 +15,21 @@
</el-table-column>
<el-table-column prop="projectName" :label="$t('load_test.project_name')" width="200" show-overflow-tooltip/>
<el-table-column prop="userName" :label="$t('api_test.creator')" width="150" show-overflow-tooltip/>
<el-table-column width="250" :label="$t('commons.create_time')">
<el-table-column width="250" :label="$t('commons.create_time')" sortable
prop="createTime">
<template v-slot:default="scope">
<span>{{ scope.row.createTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column width="250" :label="$t('commons.update_time')">
<el-table-column width="250" :label="$t('commons.update_time')" sortable
prop="updateTime">
<template v-slot:default="scope">
<span>{{ scope.row.updateTime | timestampFormatDate }}</span>
</template>
</el-table-column>
<el-table-column prop="status" :label="$t('commons.status')">
<el-table-column prop="status" :label="$t('commons.status')"
:filter-method="filter"
:filters="statusFilters">
<template v-slot:default="{row}">
<ms-api-test-status :row="row"/>
</template>
@ -79,6 +83,14 @@
tip: this.$t('commons.delete'), icon: "el-icon-delete", type: "danger",
exec: this.handleDelete
}
],
statusFilters: [
{text: 'Saved', value: 'Saved'},
{text: 'Starting', value: 'Starting'},
{text: 'Running', value: 'Running'},
{text: 'Reporting', value: 'Reporting'},
{text: 'Completed', value: 'Completed'},
{text: 'Error', value: 'Error'}
]
}
},
@ -137,11 +149,15 @@
init() {
this.projectId = this.$route.params.projectId;
this.search();
},
filter(value, row) {
return row.status === value;
}
},
created() {
this.init();
}
}
</script>

View File

@ -10,14 +10,15 @@
<el-input type="text" size="small" :placeholder="$t('report.search_by_name')"
prefix-icon="el-icon-search"
maxlength="60"
v-model="condition" @change="search" clearable/>
v-model="condition.name" @change="search" clearable/>
</span>
</el-row>
</div>
</template>
<el-table :data="tableData" class="test-content"
:default-sort="{prop: 'createTime', order: 'descending'}"
@sort-change="sort"
@filter-change="filter"
>
<el-table-column
prop="name"
@ -47,6 +48,8 @@
</template>
</el-table-column>
<!-- <el-table-column-->
<!-- prop="updateTime"-->
<!-- sortable-->
<!-- width="250"-->
<!-- :label="$t('commons.update_time')">-->
<!-- <template v-slot:default="scope">-->
@ -55,7 +58,7 @@
<!-- </el-table-column>-->
<el-table-column
prop="status"
:filter-method="filter"
column-key="status"
:filters="statusFilters"
:label="$t('commons.status')">
<template v-slot:default="{row}">
@ -83,6 +86,7 @@
import MsContainer from "../../common/components/MsContainer";
import MsMainContainer from "../../common/components/MsMainContainer";
import MsPerformanceReportStatus from "./PerformanceReportStatus";
import {_filter, _sort} from "../../../../common/js/utils";
export default {
name: "PerformanceTestReport",
@ -95,7 +99,7 @@
result: {},
queryPath: "/performance/report/list/all",
deletePath: "/performance/report/delete/",
condition: "",
condition: {},
projectId: null,
tableData: [],
multipleSelection: [],
@ -115,10 +119,7 @@
},
methods: {
initTableData() {
let param = {
name: this.condition,
};
this.result = this.$post(this.buildPagePath(this.queryPath), param, response => {
this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => {
let data = response.data;
this.total = data.itemCount;
this.tableData = data.listObject;
@ -161,8 +162,13 @@
this.initTableData();
});
},
filter(value, row) {
return row.status === value;
sort(column) {
_sort(column, this.condition);
this.initTableData();
},
filter(filters) {
_filter(filters, this.condition);
this.initTableData();
},
}
}

View File

@ -4,7 +4,9 @@
<el-card v-loading="result.loading">
<el-row>
<el-col :span="10">
<el-input :placeholder="$t('load_test.input_name')" v-model="testPlan.name" class="input-with-select">
<el-input :placeholder="$t('load_test.input_name')" v-model="testPlan.name" class="input-with-select"
maxlength="30"
>
<template v-slot:prepend>
<el-select v-model="testPlan.projectId" :placeholder="$t('load_test.select_project')">
<el-option
@ -208,9 +210,13 @@
this.$router.push({path: '/performance/test/all'})
},
validTestPlan() {
let reg = /^[\u4e00-\u9fa5_a-zA-Z0-9\s.·-]+$/;
if (!this.testPlan.name) {
this.$error(this.$t('load_test.test_name_is_null'));
return false;
} else if (!reg.test(this.testPlan.name)) {
this.$error(this.$t('load_test.special_characters_are_not_supported'));
return false;
}
if (!this.testPlan.projectId) {

View File

@ -16,9 +16,9 @@
</div>
</template>
<!-- @sort-change="sort"-->
<el-table :data="tableData" class="test-content"
:default-sort="{prop: 'createTime', order: 'descending'}"
@sort-change="sort"
@filter-change="filter"
>
<el-table-column
prop="name"
@ -61,7 +61,7 @@
</el-table-column>
<el-table-column
prop="status"
:filter-method="filter"
column-key="status"
:filters="statusFilters"
:label="$t('commons.status')">
<template v-slot:default="{row}">
@ -200,12 +200,13 @@
this.initTableData();
});
},
// sort(column) {
// _sort(column, this.condition);
// this.initTableData();
// },
filter(value, row) {
return row.status === value;
sort(column) {
_sort(column, this.condition);
this.initTableData();
},
filter(filters) {
_filter(filters, this.condition);
this.initTableData();
},
link(row) {
this.$router.push({

View File

@ -223,6 +223,10 @@
this.$router.push({
path: '/performance/test/' + row.id,
})
} else if (this.$route.name === 'fucProject') {
this.$router.push({
path: '/api/test/list/' + row.id
})
}
}
}

View File

@ -254,7 +254,8 @@ export default {
'select_resource_pool': 'Please Select Resource Pool',
'resource_pool_is_null': 'Resource Pool is empty',
'download_log_file': 'Download',
'user_name': 'Creator'
'user_name': 'Creator',
'special_characters_are_not_supported': 'Test name does not support special characters',
},
api_test: {
creator: "Creator",

View File

@ -252,7 +252,8 @@ export default {
'resource_pool_is_null': '资源池为空',
'download_log_file': '下载完整日志文件',
'pressure_prediction_chart': '压力预估图',
'user_name': '创建人'
'user_name': '创建人',
'special_characters_are_not_supported': '测试名称不支持特殊字符',
},
api_test: {
creator: "创建人",

View File

@ -253,7 +253,8 @@ export default {
'resource_pool_is_null': '資源池為空',
'download_log_file': '下載完整日誌文件',
'pressure_prediction_chart': '壓力預估圖',
'user_name': '創建人'
'user_name': '創建人',
'special_characters_are_not_supported': '測試名稱不支持特殊字符',
},
api_test: {
title: "測試",