refactor: 去掉 $$get 方法
This commit is contained in:
parent
414674d833
commit
fa5a693d1f
|
@ -1,5 +1,6 @@
|
|||
package io.metersphere.api.controller;
|
||||
|
||||
import io.metersphere.api.dto.ApiMonitorRequest;
|
||||
import io.metersphere.api.dto.ApiMonitorSearch;
|
||||
import io.metersphere.api.dto.ApiResponseCodeMonitor;
|
||||
import io.metersphere.api.dto.ApiResponseTimeMonitor;
|
||||
|
@ -32,24 +33,24 @@ public class ApiMonitorController {
|
|||
/**
|
||||
* 查询响应时间
|
||||
*/
|
||||
@GetMapping("/getResponseTime")
|
||||
public List<ApiResponseTimeMonitor> responseTimeData(@RequestHeader("apiUrl") String url, String startTime, String endTime) {
|
||||
return apiMonitorService.getApiResponseTimeData(url, startTime, endTime);
|
||||
@PostMapping("/getResponseTime")
|
||||
public List<ApiResponseTimeMonitor> responseTimeData(@RequestBody ApiMonitorRequest request) {
|
||||
return apiMonitorService.getApiResponseTimeData(request.getUrl(), request.getStartTime(), request.getEndTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询状态码
|
||||
*/
|
||||
@GetMapping("/getResponseCode")
|
||||
public List<ApiResponseCodeMonitor> responseCodeData(@RequestHeader("apiUrl") String url, String startTime, String endTime) {
|
||||
return apiMonitorService.getApiResponseCodeData(url, startTime, endTime);
|
||||
@PostMapping("/getResponseCode")
|
||||
public List<ApiResponseCodeMonitor> responseCodeData(@RequestBody ApiMonitorRequest request) {
|
||||
return apiMonitorService.getApiResponseCodeData(request.getUrl(), request.getStartTime(), request.getEndTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询reportId
|
||||
*/
|
||||
@GetMapping("/getReportId")
|
||||
public String searchReportId(@RequestHeader("apiUrl") String url, @RequestParam("startTime") String startTime) {
|
||||
return apiMonitorService.getReportId(url, startTime);
|
||||
@PostMapping("/getReportId")
|
||||
public String searchReportId(@RequestBody ApiMonitorRequest request) {
|
||||
return apiMonitorService.getReportId(request.getUrl(), request.getStartTime());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package io.metersphere.api.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApiMonitorRequest {
|
||||
|
||||
private String url;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
}
|
|
@ -1 +1 @@
|
|||
Subproject commit 79343a2763b014355f91fc21b2356a95ae437973
|
||||
Subproject commit f27d1609d77f7d6c988d37d709466e844d350e17
|
|
@ -80,9 +80,8 @@ export default {
|
|||
this.getResponseCode(this.apiUrl, today1, today2);
|
||||
},
|
||||
getResponseTime(apiUrl, startTime, endTime) {
|
||||
return this.$$get('/api/monitor/getResponseTime',
|
||||
{'startTime': startTime, 'endTime': endTime},
|
||||
{'apiUrl': apiUrl}, response => {
|
||||
return this.$post('/api/monitor/getResponseTime',
|
||||
{'startTime': startTime, 'endTime': endTime, 'apiUrl': apiUrl}, response => {
|
||||
Object.values(response.data).forEach(value => {
|
||||
this.rspTimexAxis.push(value.startTime);
|
||||
this.rspTimeData.push(value.responseTime);
|
||||
|
@ -90,9 +89,8 @@ export default {
|
|||
});
|
||||
},
|
||||
getResponseCode(apiUrl, startTime, endTime) {
|
||||
return this.$$get('/api/monitor/getResponseCode',
|
||||
{'startTime': startTime, 'endTime': endTime},
|
||||
{'apiUrl': this.apiUrl}, response => {
|
||||
return this.$post('/api/monitor/getResponseCode',
|
||||
{'startTime': startTime, 'endTime': endTime, 'apiUrl': this.apiUrl}, response => {
|
||||
Object.values(response.data).forEach(value => {
|
||||
this.rspCodexAxis.push(value.startTime);
|
||||
this.rspCodeData.push(value.responseCode);
|
||||
|
|
|
@ -28,9 +28,7 @@ export default {
|
|||
methods: {
|
||||
click(params) {
|
||||
let startTime = params.name;
|
||||
this.result = this.$$get('/api/monitor/getReportId', {'startTime': startTime}, {
|
||||
'apiUrl': this.apiUrl
|
||||
}, response => {
|
||||
this.result = this.$post('/api/monitor/getReportId', {'startTime': startTime, 'apiUrl': this.apiUrl}, response => {
|
||||
this.reportId = response.data;
|
||||
let reportId = this.reportId
|
||||
let url = '#/api/report/view/' + reportId;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 8cda5c873cd9985c97adb34efacf507167fa4182
|
||||
Subproject commit 7d43154a7c19732407a8e9ace8a7d1ea13c91f36
|
|
@ -74,20 +74,6 @@ export default {
|
|||
}
|
||||
}
|
||||
|
||||
Vue.prototype.$$get = function (url, data, header, success) {
|
||||
let result = {loading: true};
|
||||
if (!success) {
|
||||
return axios.get(url, {params: data, headers: header});
|
||||
} else {
|
||||
axios.get(url, {params: data, headers: header}).then(response => {
|
||||
then(success, response, result);
|
||||
}).catch(error => {
|
||||
exception(error, result, url);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
Vue.prototype.$get = function (url, success) {
|
||||
let result = {loading: true};
|
||||
if (!success) {
|
||||
|
|
Loading…
Reference in New Issue