Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
cac54095aa
|
@ -84,7 +84,7 @@
|
|||
<if test="request.moduleId != null">
|
||||
AND api_scenario_module_id = #{request.moduleId}
|
||||
</if>
|
||||
and scenario_definition like CONCAT('%', #{request.id},'%')
|
||||
and scenario_definition like CONCAT('%', #{request.id},'%') and id != #{request.id}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('api_test.automation.case_ref')" :visible.sync="visible"
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('api_test.automation.scenario_ref')" :visible.sync="visible"
|
||||
width="45%" :destroy-on-close="true">
|
||||
<span>{{ $t('api_test.automation.scenario_ref') }}:</span>
|
||||
<div class="refs" v-loading="scenarioLoading">
|
||||
|
|
|
@ -88,6 +88,9 @@
|
|||
} else {
|
||||
this.request = JSON.parse(this.currentApi.request);
|
||||
}
|
||||
if (!this.request.headers) {
|
||||
this.request.headers = [];
|
||||
}
|
||||
this.currentApi.request = this.request;
|
||||
return true;
|
||||
}
|
||||
|
@ -135,6 +138,9 @@
|
|||
if (!this.request.hashTree) {
|
||||
this.request.hashTree = [];
|
||||
}
|
||||
if (!this.request.body.binary) {
|
||||
this.request.body.binary = [];
|
||||
}
|
||||
// 处理导入数据缺失问题
|
||||
if (this.response.body) {
|
||||
let body = new Body();
|
||||
|
@ -145,6 +151,9 @@
|
|||
if (!body.kvs) {
|
||||
body.kvs = [];
|
||||
}
|
||||
if (!body.binary) {
|
||||
body.binary = [];
|
||||
}
|
||||
this.response.body = body;
|
||||
}
|
||||
if (this.currentApi.moduleId && this.currentApi.moduleId === "root") {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div style="min-width: 1000px;margin-bottom: 20px">
|
||||
<div style="min-width: 1200px;margin-bottom: 20px">
|
||||
<el-radio-group v-model="body.type" size="mini">
|
||||
<el-radio :disabled="isReadOnly" :label="type.FORM_DATA" @change="modeChange">
|
||||
{{ $t('api_test.definition.request.body_form_data') }}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
@click="active(apiCase)"/>
|
||||
<el-input v-if="!apiCase.id || isShowInput" size="small" v-model="apiCase.name" :name="index" :key="index"
|
||||
class="ms-api-header-select" style="width: 180px"
|
||||
@blur="saveTestCase(apiCase)"/>
|
||||
@blur="saveTestCase(apiCase)" placeholder="请输入用例名称"/>
|
||||
<span v-else>
|
||||
{{apiCase.id ? apiCase.name:''}}
|
||||
<i class="el-icon-edit" style="cursor:pointer" @click="showInput(apiCase)"/>
|
||||
|
@ -149,7 +149,7 @@
|
|||
this.$emit('singleRun', data);
|
||||
},
|
||||
copyCase(data) {
|
||||
let obj = {name: "copy_" + data.name, priority: data.priority, active: false, request: data.request};
|
||||
let obj = {name: "copy_" + data.name, priority: data.priority, active: true, request: data.request};
|
||||
this.$emit('copyCase', obj);
|
||||
},
|
||||
|
||||
|
@ -182,6 +182,7 @@
|
|||
}
|
||||
let bodyFiles = this.getBodyUploadFiles(row);
|
||||
row.projectId = getCurrentProjectID();
|
||||
row.active = true;
|
||||
row.apiDefinitionId = row.apiDefinitionId || this.api.id;
|
||||
let url = "/api/testcase/create";
|
||||
if (row.id) {
|
||||
|
|
|
@ -187,7 +187,7 @@
|
|||
} else {
|
||||
request = JSON.parse(this.api.request);
|
||||
}
|
||||
let obj = {apiDefinitionId: this.api.id, name: '', priority: 'P0', active: false};
|
||||
let obj = {apiDefinitionId: this.api.id, name: '', priority: 'P0', active: true};
|
||||
obj.request = request;
|
||||
this.apiCaseList.unshift(obj);
|
||||
}
|
||||
|
|
|
@ -1,119 +1,126 @@
|
|||
<template>
|
||||
<div v-loading="result.loading">
|
||||
<el-tabs type="border-card" :stretch="true">
|
||||
<el-tabs type="border-card" :stretch="true" @tab-click="selectTab">
|
||||
<el-tab-pane v-for="item in resource" :key="item.resourceId" :label="item.resourceName" class="logging-content">
|
||||
<ul class="infinite-list" v-infinite-scroll="load(item.resourceId)" infinite-scroll-disabled="disabled">
|
||||
<li class="infinite-list-item" v-for="(log, index) in logContent" :key="index">{{ log.content }}</li>
|
||||
</ul>
|
||||
<el-link type="primary" @click="downloadLogFile(item)">{{$t('load_test.download_log_file')}}</el-link>
|
||||
<el-link type="primary" @click="downloadLogFile(item)">{{ $t('load_test.download_log_file') }}</el-link>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "LogDetails",
|
||||
data() {
|
||||
return {
|
||||
resource: [],
|
||||
logContent: [],
|
||||
result: {},
|
||||
id: '',
|
||||
page: 1,
|
||||
pageCount: 5,
|
||||
loading: false,
|
||||
}
|
||||
},
|
||||
export default {
|
||||
name: "LogDetails",
|
||||
data() {
|
||||
return {
|
||||
resource: [],
|
||||
logContent: [],
|
||||
result: {},
|
||||
id: '',
|
||||
page: 1,
|
||||
pageCount: 5,
|
||||
loading: false,
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
disabled() {
|
||||
return this.loading || this.page > this.pageCount;
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
disabled() {
|
||||
return this.loading || this.page > this.pageCount;
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
getResource() {
|
||||
this.result = this.$get("/performance/report/log/resource/" + this.id, data => {
|
||||
this.resource = data.data;
|
||||
this.page = 1;
|
||||
this.logContent = [];
|
||||
})
|
||||
},
|
||||
load(resourceId) {
|
||||
if (this.loading || this.page > this.pageCount) return;
|
||||
this.loading = true;
|
||||
let url = "/performance/report/log/" + this.id + "/" + resourceId + "/" + this.page;
|
||||
this.$get(url, res => {
|
||||
let data = res.data;
|
||||
data.listObject.forEach(log => {
|
||||
this.logContent.push(log);
|
||||
})
|
||||
this.page++;
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
downloadLogFile(item) {
|
||||
let config = {
|
||||
url: '/performance/report/log/download/' + this.id + '/' + item.resourceId,
|
||||
method: 'get',
|
||||
responseType: 'blob'
|
||||
};
|
||||
this.result = this.$request(config).then(response => {
|
||||
const filename = 'jmeter.log'
|
||||
const blob = new Blob([response.data]);
|
||||
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);
|
||||
}
|
||||
});
|
||||
}
|
||||
methods: {
|
||||
getResource() {
|
||||
this.result = this.$get("/performance/report/log/resource/" + this.id, data => {
|
||||
this.resource = data.data;
|
||||
this.page = 1;
|
||||
this.logContent = [];
|
||||
})
|
||||
},
|
||||
watch: {
|
||||
report: {
|
||||
handler(val) {
|
||||
if (!val.status || !val.id) {
|
||||
return;
|
||||
}
|
||||
let status = val.status;
|
||||
this.id = val.id;
|
||||
if (status === "Completed" || status === "Running") {
|
||||
this.getResource();
|
||||
} else {
|
||||
this.resource = [];
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
load(resourceId) {
|
||||
if (this.loading || this.page > this.pageCount) return;
|
||||
this.loading = true;
|
||||
let url = "/performance/report/log/" + this.id + "/" + resourceId + "/" + this.page;
|
||||
this.$get(url, res => {
|
||||
let data = res.data;
|
||||
data.listObject.forEach(log => {
|
||||
this.logContent.push(log);
|
||||
})
|
||||
this.page++;
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
props: ['report']
|
||||
}
|
||||
selectTab(tab) {
|
||||
let resourceId = tab.$vnode.key;
|
||||
this.loading = false;
|
||||
this.page = 1;
|
||||
this.logContent = [];
|
||||
this.load(resourceId);
|
||||
},
|
||||
downloadLogFile(item) {
|
||||
let config = {
|
||||
url: '/performance/report/log/download/' + this.id + '/' + item.resourceId,
|
||||
method: 'get',
|
||||
responseType: 'blob'
|
||||
};
|
||||
this.result = this.$request(config).then(response => {
|
||||
const filename = 'jmeter.log'
|
||||
const blob = new Blob([response.data]);
|
||||
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: {
|
||||
report: {
|
||||
handler(val) {
|
||||
if (!val.status || !val.id) {
|
||||
return;
|
||||
}
|
||||
let status = val.status;
|
||||
this.id = val.id;
|
||||
if (status === "Completed" || status === "Running") {
|
||||
this.getResource();
|
||||
} else {
|
||||
this.resource = [];
|
||||
}
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
props: ['report']
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.logging-content {
|
||||
white-space: pre-line;
|
||||
overflow: auto;
|
||||
}
|
||||
.logging-content {
|
||||
white-space: pre-line;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.infinite-list {
|
||||
height: 500px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
overflow: auto
|
||||
}
|
||||
.infinite-list {
|
||||
height: 500px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
list-style: none;
|
||||
overflow: auto
|
||||
}
|
||||
|
||||
.infinite-list-item {
|
||||
overflow: hidden;
|
||||
}
|
||||
.infinite-list-item {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<link rel="shortcut icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title>MeterSphere</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<link rel="shortcut icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title>MeterSphere</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
Loading…
Reference in New Issue