refactor(性能测试): K8S类型资源池报告不显示监控详情Tab

This commit is contained in:
shiziyuan9527 2021-04-25 17:33:27 +08:00 committed by 刘瑞斌
parent 0bd7d4aae5
commit 170b5bea8f
6 changed files with 36 additions and 2 deletions

View File

@ -111,6 +111,11 @@ public class PerformanceReportController {
return reportService.getLoadTestReport(reportId);
}
@GetMapping("/pool/type/{reportId}")
public String getPoolTypeByReportId(@PathVariable String reportId) {
return reportService.getPoolTypeByReportId(reportId);
}
@GetMapping("log/resource/{reportId}")
public List<LogDetailDTO> getResourceIds(@PathVariable String reportId) {
return reportService.getReportLogResource(reportId);

View File

@ -59,6 +59,8 @@ public class ReportService {
private FileService fileService;
@Resource
private SqlSessionFactory sqlSessionFactory;
@Resource
private TestResourcePoolMapper testResourcePoolMapper;
public List<ReportDTO> getRecentReportList(ReportRequest request) {
List<OrderRequest> orders = new ArrayList<>();
@ -315,4 +317,18 @@ public class ReportService {
}
}
}
public String getPoolTypeByReportId(String reportId) {
LoadTestReportWithBLOBs report = getReport(reportId);
String testId = report.getTestId();
LoadTestWithBLOBs test = loadTestMapper.selectByPrimaryKey(testId);
if (test != null) {
String poolId = test.getTestResourcePoolId();
TestResourcePool testResourcePool = testResourcePoolMapper.selectByPrimaryKey(poolId);
if (testResourcePool != null) {
return testResourcePool.getType();
}
}
return "";
}
}

View File

@ -81,7 +81,7 @@
<el-tab-pane :label="$t('report.test_log_details')">
<ms-report-log-details :report="report"/>
</el-tab-pane>
<el-tab-pane label="监控详情">
<el-tab-pane :label="$t('report.test_monitor_details')" v-if="poolType === 'NODE'">
<monitor-card :report="report"/>
</el-tab-pane>
</el-tabs>
@ -169,7 +169,8 @@ export default {
{value: '30', label: '30s'},
{value: '60', label: '1m'},
{value: '300', label: '5m'}
]
],
poolType: ""
};
},
methods: {
@ -379,6 +380,14 @@ export default {
}
}
localStorage.setItem("reportRefreshTime", this.refreshTime);
},
getPoolType(reportId) {
this.$get("/performance/report/pool/type/" + reportId, result => {
let data = result.data;
if (data) {
this.poolType = data;
}
})
}
},
created() {
@ -388,6 +397,7 @@ export default {
}
this.reportId = this.$route.path.split('/')[4];
this.getReport(this.reportId);
this.getPoolType(this.reportId);
},
watch: {
'$route'(to) {

View File

@ -441,6 +441,7 @@ export default {
test_request_statistics: 'Test Request Statistics',
test_error_log: 'Test Error Log',
test_log_details: 'Test Log Details',
test_monitor_details: 'Test Monitor Details',
test_details: 'Test Details',
test_duration: 'Current Execution Time{0} minutes {1} seconds',
test_start_time: 'Start Execution Time',

View File

@ -448,6 +448,7 @@ export default {
test_request_statistics: '请求统计',
test_error_log: '错误记录',
test_log_details: '日志详情',
test_monitor_details: '监控详情',
test_details: '测试详情',
test_duration: '当前执行时长:{0} 分钟 {1} 秒',
test_start_time: '开始执行时间',

View File

@ -439,6 +439,7 @@ export default {
test_request_statistics: '請求統計',
test_error_log: '錯誤記錄',
test_log_details: '日誌詳情',
test_monitor_details: '監控詳情',
test_details: '測試詳情',
test_duration: '當前執行時長:{0} 分鐘 {1} 秒',
test_start_time: '開始執行時間',