merge master

This commit is contained in:
chenjianxing 2020-09-25 20:53:54 +08:00
commit fa307f8be3
17 changed files with 69 additions and 26 deletions

View File

@ -141,6 +141,7 @@ public class APIBackendListenerClient extends AbstractBackendListenerClient impl
requestResult.setBody(result.getSamplerData());
requestResult.setHeaders(result.getRequestHeaders());
requestResult.setRequestSize(result.getSentBytes());
requestResult.setStartTime(result.getStartTime());
requestResult.setTotalAssertions(result.getAssertionResults().length);
requestResult.setSuccess(result.isSuccessful());
requestResult.setError(result.getErrorCount());

View File

@ -16,6 +16,8 @@ public class RequestResult {
private long requestSize;
private long startTime;
private int error;
private boolean success;

View File

@ -1,9 +0,0 @@
package io.metersphere.notice.domain;
import io.metersphere.base.domain.Notice;
import lombok.Data;
@Data
public class NoticeDTO extends Notice {
private String[] names;
}

View File

@ -61,7 +61,8 @@ public class TestCaseCommentService {
testCaseComments.forEach(testCaseComment -> {
String authorId = testCaseComment.getAuthor();
User user = userMapper.selectByPrimaryKey(authorId);
testCaseComment.setAuthor(user.getName());
String author = user == null ? authorId : user.getName();
testCaseComment.setAuthor(author);
});
return testCaseComments;
}

View File

@ -115,7 +115,8 @@ public class TestPlanService {
return Optional.ofNullable(testPlanMapper.selectByPrimaryKey(testPlanId)).orElse(new TestPlan());
}
public int editTestPlan(TestPlan testPlan) {
public int editTestPlan(TestPlanDTO testPlan) {
editTestPlanProject(testPlan);
testPlan.setUpdateTime(System.currentTimeMillis());
checkTestPlanExist(testPlan);
//进行中状态写入实际开始时间

View File

@ -90,6 +90,10 @@ export default {
methods: {
registerEvents() {
ApiEvent.$on(LIST_CHANGE, () => {
// todo refs
if (!this.$refs.projectRecent) {
return;
}
this.$refs.projectRecent.recent();
this.$refs.testRecent.recent();
this.$refs.reportRecent.recent();

View File

@ -11,7 +11,6 @@ export default {
components: {
MsApiReportViewDetail,
},
computed: {
reportId: function () {
return this.$route.params.reportId;

View File

@ -85,6 +85,8 @@ export default {
this.report = {};
this.content = {};
this.fails = [];
this.report = {};
this.isRequestResult = false;
},
handleClick(tab, event) {
this.isRequestResult = false

View File

@ -2,10 +2,13 @@
<div class="request-result">
<div @click="active">
<el-row :gutter="10" type="flex" align="middle" class="info">
<el-col :span="16">
<el-col :span="12">
<i class="icon el-icon-arrow-right" :class="{'is-active': isActive}"/>
{{scenarioName}}
</el-col>
<el-col :span="4">
{{$t('api_report.start_time')}}
</el-col>
<el-col :span="2">
{{$t('api_report.response_time')}}
</el-col>
@ -20,17 +23,20 @@
</el-col>
</el-row>
<el-row :gutter="10" type="flex" align="middle" class="info">
<el-col :span="4">
<el-col :span="2">
<div class="method">
{{request.method}}
</div>
</el-col>
<el-col :span="12">
<el-col :span="10">
<div class="name">{{request.name}}</div>
<el-tooltip effect="dark" :content="request.url" placement="bottom" :open-delay="800">
<div class="url">{{request.url}}</div>
</el-tooltip>
</el-col>
<el-col :span="4">
{{request.startTime | timestampFormatDate(true) }}
</el-col>
<el-col :span="2">
<div class="time">
{{request.responseResult.responseTime}}

View File

@ -14,9 +14,13 @@
</el-select>
</el-input>
<el-button type="primary" plain :disabled="isReadOnly" @click="saveTest">
{{ $t('commons.save') }}
</el-button>
<el-tooltip :content="'Ctrl + S'"
placement="top"
:enterable="false">
<el-button type="primary" plain :disabled="isReadOnly" @click="saveTest">
{{ $t('commons.save') }}
</el-button>
</el-tooltip>
<el-button type="primary" plain :disabled="isReadOnly"
@click="saveRunTest">
@ -67,7 +71,7 @@
<script>
import MsApiScenarioConfig from "./components/ApiScenarioConfig";
import {Test, Scenario} from "./model/ScenarioModel"
import {Scenario, Test} from "./model/ScenarioModel"
import MsApiReportStatus from "../report/ApiReportStatus";
import MsApiReportDialog from "./ApiReportDialog";
import {checkoutTestManagerOrTestUser, downloadFile, getUUID} from "@/common/js/utils";
@ -368,11 +372,25 @@ export default {
this.debugReportId = response.data;
this.resetBodyFile();
});
}
},
handleEvent(event) {
if (event.keyCode === 83 && event.ctrlKey) {
console.log('拦截到 ctrl + s');//ctrl+s
this.saveTest();
event.preventDefault();
event.returnValue = false;
return false;
}
},
},
created() {
this.init();
//
document.addEventListener('keydown', this.handleEvent)
},
beforeDestroy() {
document.removeEventListener('keydown', this.handleEvent);
}
}
</script>

View File

@ -63,10 +63,10 @@
>
<template v-slot:default="{row}">
<el-switch
v-model="row.enable"
active-value="true"
inactive-value="false"
inactive-color="#ff4949"
v-model="row.enable"
active-value="true"
inactive-value="false"
inactive-color="#DCDFE6"
/>
</template>
</el-table-column>

View File

@ -98,6 +98,10 @@ export default {
methods: {
registerEvents() {
PerformanceEvent.$on(LIST_CHANGE, () => {
// todo refs
if (!this.$refs.projectRecent) {
return;
}
this.$refs.projectRecent.recent();
this.$refs.testRecent.recent();
this.$refs.reportRecent.recent();

View File

@ -150,6 +150,10 @@ export default {
},
registerEvents() {
TrackEvent.$on(LIST_CHANGE, () => {
// todo refs
if (!this.$refs.projectRecent) {
return;
}
this.$refs.projectRecent.recent();
this.$refs.planRecent.recent();
this.$refs.caseRecent.recent();

View File

@ -10,7 +10,7 @@ const options = function (value, array) {
return value;
};
const timestampFormatDate = function (timestamp) {
const timestampFormatDate = function (timestamp, showMs) {
if (!timestamp) {
return timestamp
}
@ -34,7 +34,14 @@ const timestampFormatDate = function (timestamp) {
let s = date.getSeconds();
s = s < 10 ? ('0' + s) : s;
return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s
let format = y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
if (showMs === true) {
let ms = date.getMilliseconds();
format += ':' + ms
}
return format
};
const filters = {

View File

@ -598,6 +598,7 @@ export default {
scenario_name: "Scenario name",
response_time: "Response time(ms)",
latency: "Latency",
start_time: "Start Time",
request_size: "Request Size",
response_size: "Response Size",
response_code: "Response Code",

View File

@ -598,6 +598,7 @@ export default {
delete_confirm: '确认删除报告: ',
delete_batch_confirm: '确认批量删除报告',
scenario_name: "场景名称",
start_time: "开始时间",
response_time: "响应时间(ms)",
latency: "网络延迟",
request_size: "请求大小",

View File

@ -598,6 +598,7 @@ export default {
delete_confirm: '確認刪除報告: ',
delete_batch_confirm: '確認批量刪除報告',
scenario_name: "場景名稱",
start_time: "開始時間",
response_time: "響應時間(ms)",
latency: "網絡延遲",
request_size: "請求大小",