Merge pull request #895 from cfh1117/1.5

接口监控功能优化
This commit is contained in:
BugKing 2020-12-08 16:40:55 +08:00 committed by GitHub
commit 22fd0b1392
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 17 deletions

View File

@ -15,7 +15,7 @@
</delete> </delete>
<select id="selectAll" resultType="io.metersphere.api.dto.ApiMonitorSearch"> <select id="selectAll" resultType="io.metersphere.api.dto.ApiMonitorSearch">
select distinct url from api_data_view; select distinct url from api_data_view order by url;
</select> </select>
<select id="selectResponseTimeByUrl" parameterType="java.lang.String" <select id="selectResponseTimeByUrl" parameterType="java.lang.String"
@ -56,7 +56,7 @@
</select> </select>
<select id="selectReportIdByUrlAndStartTime" resultType="java.lang.String"> <select id="selectReportIdByUrlAndStartTime" resultType="java.lang.String">
select report_id from api_data_view where response_code != 200 and url=#{apiUrl} and start_time=#{startTime}; select report_id from api_data_view where url=#{apiUrl} and start_time=#{startTime};
</select> </select>
<insert id="insertListApiData" parameterType="java.util.List"> <insert id="insertListApiData" parameterType="java.util.List">

View File

@ -2,7 +2,7 @@
<common-monitor-chart> <common-monitor-chart>
<template> <template>
<div id="response-time-chart" :style="{ width:'100%',height:'100%' }"> <div id="response-time-chart" :style="{ width:'100%',height:'100%' }">
<chart :options="getOptions()" :style="{ width:'100%' }"></chart> <chart :options="getOptions()" :style="{ width:'100%' }" v-on:click="click"></chart>
</div> </div>
</template> </template>
</common-monitor-chart> </common-monitor-chart>
@ -27,8 +27,6 @@ export default {
}, },
methods: { methods: {
click(params) { click(params) {
//2
if (params.value.substr(0, 1) !== '2') {
let startTime = params.name; let startTime = params.name;
this.result = this.$$get('/api/monitor/getReportId', {'startTime': startTime}, { this.result = this.$$get('/api/monitor/getReportId', {'startTime': startTime}, {
'apiUrl': this.apiUrl 'apiUrl': this.apiUrl
@ -36,11 +34,8 @@ export default {
this.reportId = response.data; this.reportId = response.data;
let reportId = this.reportId let reportId = this.reportId
let url = '#/api/report/view/' + reportId; let url = '#/api/report/view/' + reportId;
let target = '_blank'; window.open(url, '_blank');
window.open(url, target);
}); });
}
}, },
getOptions() { getOptions() {
return { return {