日志下载
This commit is contained in:
parent
bd023c1f27
commit
843d7ed3b1
|
@ -2,7 +2,8 @@
|
|||
<div v-loading="result.loading">
|
||||
<el-tabs type="border-card" :stretch="true">
|
||||
<el-tab-pane v-for="(item, key) in logContent" :key="key" :label="key" class="logging-content">
|
||||
{{item}}
|
||||
{{item.substring(0, 2048) }}...
|
||||
<el-link type="primary" @click="downloadLogFile(item)">{{$t('load_test.download_log_file')}}</el-link>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
@ -23,6 +24,22 @@
|
|||
this.result = this.$get("/performance/report/log/" + this.id, res => {
|
||||
this.logContent = res.data;
|
||||
})
|
||||
},
|
||||
downloadLogFile(content) {
|
||||
const filename = 'jmeter.log'
|
||||
const blob = new Blob([content]);
|
||||
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: {
|
||||
|
|
|
@ -181,6 +181,7 @@ export default {
|
|||
'create': 'Create Test',
|
||||
'select_resource_pool': 'Please Select Resource Pool',
|
||||
'resource_pool_is_null': 'Resource Pool is empty',
|
||||
'download_log_file': 'Download',
|
||||
},
|
||||
api_test: {
|
||||
'select_resource_pool': 'Please select resource pool'
|
||||
|
|
|
@ -183,7 +183,7 @@ export default {
|
|||
'create': '创建测试',
|
||||
'select_resource_pool': '请选择资源池',
|
||||
'resource_pool_is_null': '资源池为空',
|
||||
|
||||
'download_log_file': '下载完整日志文件',
|
||||
},
|
||||
api_test: {
|
||||
save_and_run: "保存并执行",
|
||||
|
|
Loading…
Reference in New Issue