fix: 修复访问最近报告中已删除的报告报错的问题

This commit is contained in:
shiziyuan9527 2020-07-31 15:45:01 +08:00
parent 534957aa77
commit b9d48bd00e
5 changed files with 42 additions and 24 deletions

View File

@ -62,17 +62,22 @@ export default {
let url = "/api/report/get/" + this.reportId;
this.$get(url, response => {
this.report = response.data || {};
if (this.isNotRunning) {
try {
this.content = JSON.parse(this.report.content);
} catch (e) {
console.log(this.report.content)
throw e;
if (response.data) {
if (this.isNotRunning) {
try {
this.content = JSON.parse(this.report.content);
} catch (e) {
console.log(this.report.content)
throw e;
}
this.getFails();
this.loading = false;
} else {
setTimeout(this.getReport, 2000)
}
this.getFails();
this.loading = false;
} else {
setTimeout(this.getReport, 2000)
this.loading = false;
this.$error(this.$t('api_report.not_exist'));
}
});
}

View File

@ -43,12 +43,12 @@
</el-col>
</el-row>
<el-divider></el-divider>
<el-divider/>
<el-tabs v-model="active" type="border-card" :stretch="true">
<el-tab-pane :label="$t('report.test_overview')">
<!-- <ms-report-test-overview :id="reportId" :status="status"/>-->
<ms-report-test-overview :report="report"/>
<ms-report-test-overview :report="report" ref="testOverview"/>
</el-tab-pane>
<el-tab-pane :label="$t('report.test_request_statistics')">
<ms-report-request-statistics :report="report"/>
@ -63,8 +63,8 @@
</el-card>
<el-dialog :title="$t('report.test_stop_now_confirm')" :visible.sync="dialogFormVisible" width="30%">
<p v-html="$t('report.force_stop_tips')"></p>
<p v-html="$t('report.stop_tips')"></p>
<p v-html="$t('report.force_stop_tips')"/>
<p v-html="$t('report.stop_tips')"/>
<div slot="footer" class="dialog-footer">
<el-button type="danger" size="small" @click="stopTest(true)">{{$t('report.force_stop_btn')}}
</el-button>
@ -190,7 +190,7 @@
} else {
this.report.status = 'Completed';
}
})
});
this.dialogFormVisible = false;
},
rerun(testId) {
@ -201,7 +201,7 @@
}).then(() => {
this.result = this.$post('/performance/run', {id: testId, triggerMode: 'MANUAL'}, (response) => {
this.reportId = response.data;
this.$router.push({path: '/performance/report/view/' + this.reportId})
this.$router.push({path: '/performance/report/view/' + this.reportId});
// socket
this.initWebSocket();
})
@ -235,16 +235,21 @@
this.reportId = this.$route.path.split('/')[4];
this.result = this.$get("/performance/report/" + this.reportId, res => {
let data = res.data;
this.status = data.status;
this.$set(this.report, "id", this.reportId);
this.$set(this.report, "status", data.status);
this.checkReportStatus(data.status);
if (this.status === "Completed" || this.status === "Running") {
this.initReportTimeInfo();
if (data) {
this.status = data.status;
this.$set(this.report, "id", this.reportId);
this.$set(this.report, "status", data.status);
this.checkReportStatus(data.status);
if (this.status === "Completed" || this.status === "Running") {
this.initReportTimeInfo();
}
this.initBreadcrumb();
this.initWebSocket();
} else {
this.$error(this.$t('report.not_exist'))
}
})
this.initBreadcrumb();
this.initWebSocket();
});
},
beforeDestroy() {
this.websocket.close() //websocket
@ -288,6 +293,8 @@
} else {
this.clearData();
}
} else {
this.$error(this.$t('report.not_exist'));
}
});

View File

@ -266,6 +266,7 @@ export default {
stop_tips: 'A <strong>Graceful shutdown</strong> will archive the JTL files and then stop the servers.',
force_stop_btn: 'Terminating',
stop_btn: 'Graceful shutdown',
not_exist: "Test report does not exist",
},
load_test: {
operating: 'Operating',
@ -476,6 +477,7 @@ export default {
detail: "Report detail",
delete: "Delete report",
running: "The test is running",
not_exist: "Test report does not exist",
},
test_track: {
test_track: "Track",

View File

@ -264,6 +264,7 @@ export default {
stop_tips: '<strong>停止</strong>测试会结束当前测试并保留报告数据',
force_stop_btn: '强制停止',
stop_btn: '停止',
not_exist: "测试报告不存在",
},
load_test: {
operating: '操作',
@ -475,6 +476,7 @@ export default {
detail: "报告详情",
delete: "删除报告",
running: "测试执行中",
not_exist: "测试报告不存在",
},
test_track: {
test_track: "测试跟踪",

View File

@ -264,6 +264,7 @@ export default {
stop_tips: '<strong>停止</strong>測試會結束當前測試並保留報告數據',
force_stop_btn: '強制停止',
stop_btn: '停止',
not_exist: "測試報告不存在",
},
load_test: {
operating: '操作',
@ -475,6 +476,7 @@ export default {
detail: "報告詳情",
delete: "刪除報告",
running: "測試執行中",
not_exist: "測試報告不存在",
},
test_track: {
test_track: "測試跟踪",