Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
43e5381a22
|
@ -2,7 +2,8 @@
|
|||
<div v-loading="result.loading">
|
||||
<el-tabs type="border-card" :stretch="true">
|
||||
<el-tab-pane v-for="(item, key) in logContent" :key="key" :label="key" class="logging-content">
|
||||
{{item}}
|
||||
{{item.substring(0, 2048) }}...
|
||||
<el-link type="primary" @click="downloadLogFile(item)">{{$t('load_test.download_log_file')}}</el-link>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
@ -23,6 +24,22 @@
|
|||
this.result = this.$get("/performance/report/log/" + this.id, res => {
|
||||
this.logContent = res.data;
|
||||
})
|
||||
},
|
||||
downloadLogFile(content) {
|
||||
const filename = 'jmeter.log'
|
||||
const blob = new Blob([content]);
|
||||
if ("download" in document.createElement("a")) {
|
||||
// 非IE下载
|
||||
// chrome/firefox
|
||||
let aTag = document.createElement('a');
|
||||
aTag.download = filename;
|
||||
aTag.href = URL.createObjectURL(blob);
|
||||
aTag.click();
|
||||
URL.revokeObjectURL(aTag.href)
|
||||
} else {
|
||||
// IE10+下载
|
||||
navigator.msSaveBlob(blob, filename);
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<template>
|
||||
|
||||
|
||||
<common-component :title="'基础信息'">
|
||||
|
||||
<template>
|
||||
|
@ -16,14 +15,16 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row type="flex" justify="space-between">
|
||||
<el-row type="flex" justify="space-between" class="select-time">
|
||||
<el-col :span="12">
|
||||
<span>开始时间:</span>
|
||||
<span class="item-value">{{reportInfo.startTime}}</span>
|
||||
<span v-if="!isReport">{{reportInfo.startTime}}</span>
|
||||
<el-date-picker v-if="isReport" size="mini" type="date" placeholder="选择日期" v-model="reportInfo.startTime"/>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<span>结束时间:</span>
|
||||
<span class="item-value">{{reportInfo.endTime}}</span>
|
||||
<span v-if="!isReport">{{reportInfo.endTime}}</span>
|
||||
<el-date-picker v-if="isReport" size="mini" type="date" placeholder="选择日期" v-model="reportInfo.endTime"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
|
@ -45,10 +46,6 @@
|
|||
export default {
|
||||
name: "BaseInfoComponent",
|
||||
components: {CommonComponent},
|
||||
data() {
|
||||
return {
|
||||
}
|
||||
},
|
||||
props: {
|
||||
reportInfo: {
|
||||
type: Object,
|
||||
|
@ -61,6 +58,10 @@
|
|||
endTime: '2020-6-18'
|
||||
}
|
||||
}
|
||||
},
|
||||
isReport: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,4 +83,12 @@
|
|||
height: 60px;
|
||||
}
|
||||
|
||||
.select-time span {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.el-date-editor {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
<template>
|
||||
<div>
|
||||
|
||||
<!--模版-->
|
||||
<div v-if="!metric">
|
||||
<base-info-component v-if="preview.id == 1"/>
|
||||
<base-info-component :is-report="false" v-if="preview.id == 1"/>
|
||||
<test-result-component v-if="preview.id == 2"/>
|
||||
<test-result-chart-component v-if="preview.id == 3"/>
|
||||
<rich-text-component :preview="preview" v-if="preview.type != 'system'"/>
|
||||
</div>
|
||||
|
||||
<!--报告-->
|
||||
<div v-if="metric">
|
||||
<base-info-component :report-info="metric" v-if="preview.id == 1"/>
|
||||
<test-result-component :test-results="metric.moduleExecuteResult" v-if="preview.id == 2"/>
|
||||
|
@ -32,6 +34,10 @@
|
|||
},
|
||||
metric: {
|
||||
type: Object
|
||||
},
|
||||
isReport: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
<template>
|
||||
|
||||
{{executeResult}}/{{charData}}
|
||||
<ms-pie-chart v-if="isShow" :text="'测试结果统计图'" :name="'测试结果'" :data="charData"/>
|
||||
|
||||
</template>
|
||||
|
@ -23,12 +22,12 @@
|
|||
data() {
|
||||
return {
|
||||
dataMap: new Map([
|
||||
["Pass", {value:235, name:'通过', itemStyle: {color: '#67C23A'}}],
|
||||
["Blocking", {value:274, name:'阻塞', itemStyle: {color: '#E6A23C'}}],
|
||||
["Skip", {value:335, name:'跳过', itemStyle: {color: '#909399'}}],
|
||||
["Prepare", {value:265, name:'未开始', itemStyle: {color: '#DEDE10'}}],
|
||||
["Failure", {value:310, name:'失败', itemStyle: {color: '#F56C6C'}}],
|
||||
["Underway", {value:245, name:'进行中', itemStyle: {color: 'lightskyblue'}}]
|
||||
["Pass", {name:'通过', itemStyle: {color: '#67C23A'}}],
|
||||
["Blocking", {name:'阻塞', itemStyle: {color: '#E6A23C'}}],
|
||||
["Skip", {name:'跳过', itemStyle: {color: '#909399'}}],
|
||||
["Prepare", {name:'未开始', itemStyle: {color: '#DEDE10'}}],
|
||||
["Failure", {name:'失败', itemStyle: {color: '#F56C6C'}}],
|
||||
["Underway", {name:'进行中', itemStyle: {color: 'lightskyblue'}}]
|
||||
]),
|
||||
charData: [],
|
||||
isShow: true
|
||||
|
@ -36,11 +35,29 @@
|
|||
},
|
||||
props: {
|
||||
executeResult: {
|
||||
type: Array
|
||||
type: Array,
|
||||
default() {
|
||||
return [
|
||||
{status: 'Pass', count: '235'},
|
||||
{status: 'Blocking', count: '274'},
|
||||
{status: 'Skip', count: '335'},
|
||||
{status: 'Prepare', count: '265'},
|
||||
{status: 'Failure', count: '310'},
|
||||
{status: 'Underway', count: '245'},
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
executeResult() {
|
||||
this.getCharData();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getCharData();
|
||||
},
|
||||
methods: {
|
||||
getCharData() {
|
||||
this.charData = [];
|
||||
this.executeResult.forEach(item => {
|
||||
let data = this.dataMap.get(item.status);
|
||||
|
@ -48,17 +65,7 @@
|
|||
this.charData.push(data);
|
||||
});
|
||||
this.reload();
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.charData.push(this.dataMap.get('Pass'));
|
||||
this.charData.push(this.dataMap.get('Blocking'));
|
||||
this.charData.push(this.dataMap.get('Skip'));
|
||||
this.charData.push(this.dataMap.get('Prepare'));
|
||||
this.charData.push(this.dataMap.get('Failure'));
|
||||
this.charData.push(this.dataMap.get('Underway'));
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
reload() {
|
||||
this.isShow = false;
|
||||
this.$nextTick(function () {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
:visible.sync="showDialog"
|
||||
:with-header="false"
|
||||
size="100%"
|
||||
:modal-append-to-body="false"
|
||||
ref="drawer"
|
||||
v-loading="result.loading">
|
||||
<template v-slot:default="scope">
|
||||
|
@ -36,7 +37,7 @@
|
|||
group="component">
|
||||
<transition-group>
|
||||
<div class="preview" v-for="item in previews" :key="item.id">
|
||||
<template-component :metric="metric" :preview="item"/>
|
||||
<template-component :is-report="isReport" :metric="metric" :preview="item"/>
|
||||
<i class="el-icon-error" @click="handleDelete(item)"/>
|
||||
</div>
|
||||
</transition-group>
|
||||
|
@ -194,6 +195,12 @@
|
|||
this.template.content = JSON.parse(response.data.content);
|
||||
if (this.template.content.customComponent) {
|
||||
this.template.content.customComponent = jsonToMap(this.template.content.customComponent);
|
||||
if (this.template.startTime) {
|
||||
this.metric.startTime = new Date(this.template.startTime);
|
||||
}
|
||||
if (this.template.endTime) {
|
||||
this.metric.endTime = new Date(this.template.endTime);
|
||||
}
|
||||
}
|
||||
this.initComponents();
|
||||
});
|
||||
|
@ -218,10 +225,10 @@
|
|||
buildParam(param) {
|
||||
let content = {};
|
||||
content.components = [];
|
||||
content.customComponent = new Map();
|
||||
this.previews.forEach(item => {
|
||||
content.components.push(item.id);
|
||||
if (!this.componentMap.get(item.id)) {
|
||||
content.customComponent = new Map();
|
||||
content.customComponent.set(item.id, {title: item.title, content: item.content})
|
||||
}
|
||||
});
|
||||
|
@ -238,6 +245,12 @@
|
|||
if (this.template.workspaceId) {
|
||||
param.workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||
}
|
||||
if (this.metric && this.metric.startTime) {
|
||||
param.startTime = this.metric.startTime.getTime();
|
||||
}
|
||||
if (this.metric && this.metric.endTime) {
|
||||
param.endTime = this.metric.endTime.getTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
}
|
||||
}
|
||||
if (!hasCurrentProject) {
|
||||
this.currentProject = null;
|
||||
this.setCurrentProject(this.projects[0]);
|
||||
}
|
||||
} else {
|
||||
if(this.projects.length > 0){
|
||||
|
@ -189,6 +189,7 @@
|
|||
this.$get('/project/get/' + id, response => {
|
||||
let project = response.data;
|
||||
this.setCurrentProject(project);
|
||||
this.$router.push('/track/case/all');
|
||||
});
|
||||
}
|
||||
if (id === 'all') {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
:before-close="handleClose"
|
||||
:visible.sync="showDialog"
|
||||
:with-header="false"
|
||||
:modal-append-to-body="false"
|
||||
size="100%"
|
||||
ref="drawer"
|
||||
v-loading="result.loading">
|
||||
|
@ -19,6 +20,7 @@
|
|||
</div>
|
||||
</el-col>
|
||||
<el-col :span="12" class="head-right">
|
||||
<el-button plain size="mini" @click="handleSave">保存</el-button>
|
||||
<el-button plain size="mini" @click="handleEdit">编辑组件</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -39,7 +41,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {jsonToMap} from "../../../../../../common/js/utils";
|
||||
import {jsonToMap, mapToJson} from "../../../../../../common/js/utils";
|
||||
import BaseInfoComponent from "../../../../settings/workspace/components/TemplateComponent/BaseInfoComponent";
|
||||
import TestResultChartComponent from "../../../../settings/workspace/components/TemplateComponent/TestResultChartComponent";
|
||||
import TestResultComponent from "../../../../settings/workspace/components/TemplateComponent/TestResultComponent";
|
||||
|
@ -117,11 +119,45 @@
|
|||
handleEdit() {
|
||||
this.$refs.templateEdit.open(this.reportId, true);
|
||||
},
|
||||
handleSave() {
|
||||
let param = {};
|
||||
this.buildParam(param);
|
||||
this.result = this.$post('/case/report/edit', param, () =>{
|
||||
this.$success('保存成功');
|
||||
});
|
||||
},
|
||||
buildParam(param) {
|
||||
let content = {};
|
||||
content.components = [];
|
||||
this.previews.forEach(item => {
|
||||
content.components.push(item.id);
|
||||
if (!this.componentMap.get(item.id)) {
|
||||
content.customComponent = new Map();
|
||||
content.customComponent.set(item.id, {title: item.title, content: item.content})
|
||||
}
|
||||
});
|
||||
param.name = this.report.name;
|
||||
if (content.customComponent) {
|
||||
content.customComponent = mapToJson(content.customComponent);
|
||||
}
|
||||
param.content = JSON.stringify(content);
|
||||
param.id = this.report.id;
|
||||
if (this.metric.startTime) {
|
||||
param.startTime = this.metric.startTime.getTime();
|
||||
}
|
||||
if (this.metric.endTime) {
|
||||
param.endTime = this.metric.endTime.getTime();
|
||||
}
|
||||
},
|
||||
getMetric() {
|
||||
this.result = this.$get('/case/report/get/metric/' + this.planId, response => {
|
||||
this.metric = response.data;
|
||||
this.metric.startTime = this.report.startTime;
|
||||
this.metric.endTime = this.report.endTime;
|
||||
if (this.report.startTime) {
|
||||
this.metric.startTime = new Date(this.report.startTime);
|
||||
}
|
||||
if (this.report.endTime) {
|
||||
this.metric.endTime = new Date(this.report.endTime);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
:before-close="handleClose"
|
||||
:visible.sync="showDialog"
|
||||
:with-header="false"
|
||||
:modal-append-to-body="false"
|
||||
size="100%"
|
||||
ref="drawer"
|
||||
v-loading="result.loading">
|
||||
|
|
|
@ -195,16 +195,14 @@
|
|||
},
|
||||
watch: {
|
||||
planId() {
|
||||
this.getTestPlanById();
|
||||
this.initTableData();
|
||||
this.refreshTableAndPlan();
|
||||
},
|
||||
selectNodeIds() {
|
||||
this.search();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getTestPlanById();
|
||||
this.initTableData();
|
||||
this.refreshTableAndPlan();
|
||||
},
|
||||
methods: {
|
||||
initTableData() {
|
||||
|
@ -224,6 +222,16 @@
|
|||
this.selectIds.clear();
|
||||
this.$emit('refresh');
|
||||
},
|
||||
refreshTableAndPlan() {
|
||||
this.getTestPlanById();
|
||||
this.initTableData();
|
||||
},
|
||||
refreshTestPlanRecent() {
|
||||
let param = {};
|
||||
param.id = this.planId;
|
||||
param.updateTime = Date.now();
|
||||
this.$post('/test/plan/edit', param);
|
||||
},
|
||||
search() {
|
||||
this.initTableData();
|
||||
},
|
||||
|
@ -298,6 +306,7 @@
|
|||
if (this.planId) {
|
||||
this.$post('/test/plan/get/' + this.planId, {}, response => {
|
||||
this.testPlan = response.data;
|
||||
this.refreshTestPlanRecent();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
@ -183,6 +183,7 @@ export default {
|
|||
'create': 'Create Test',
|
||||
'select_resource_pool': 'Please Select Resource Pool',
|
||||
'resource_pool_is_null': 'Resource Pool is empty',
|
||||
'download_log_file': 'Download',
|
||||
},
|
||||
api_test: {
|
||||
'select_resource_pool': 'Please select resource pool'
|
||||
|
|
|
@ -184,6 +184,7 @@ export default {
|
|||
'create': '创建测试',
|
||||
'select_resource_pool': '请选择资源池',
|
||||
'resource_pool_is_null': '资源池为空',
|
||||
'download_log_file': '下载完整日志文件',
|
||||
'pressure_prediction_chart':'压力预估图',
|
||||
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue