fix(接口测试): 报告

This commit is contained in:
wenyann 2020-08-12 16:48:54 +08:00
parent 9dca87376e
commit b0e0aa1327
5 changed files with 16 additions and 26 deletions

View File

@ -10,27 +10,9 @@
</header> </header>
<main v-if="this.isNotRunning"> <main v-if="this.isNotRunning">
<ms-metric-chart :content="content" :totalTime="totalTime"/> <ms-metric-chart :content="content" :totalTime="totalTime"/>
<!--<el-container>
<el-aside width="900px">
<el-tabs v-model="activeName">
<el-tab-pane :label="$t('api_report.total')" name="total">
<ms-scenario-results :scenarios="content.scenarios"/>
</el-tab-pane>
<el-tab-pane name="fail">
<template slot="label">
<span class="fail">{{ $t('api_report.fail') }}</span>
</template>
<ms-scenario-results :scenarios="fails"/>
</el-tab-pane>
</el-tabs>
</el-aside>
<el-main style="margin-top: 20px">
</el-main>
</el-container>-->
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-tabs v-model="activeName"> <el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane :label="$t('api_report.total')" name="total"> <el-tab-pane :label="$t('api_report.total')" name="total">
<ms-scenario-results :scenarios="content.scenarios" v-on:requestResult="requestResult"/> <ms-scenario-results :scenarios="content.scenarios" v-on:requestResult="requestResult"/>
</el-tab-pane> </el-tab-pane>
@ -85,6 +67,9 @@
this.content = {}; this.content = {};
this.fails = []; this.fails = [];
}, },
handleClick(tab, event) {
this.isRequestResult = false
},
getReport() { getReport() {
this.init(); this.init();

View File

@ -94,7 +94,7 @@
data() { data() {
return { return {
isActive: false, isActive: true,
activeName: "sub", activeName: "sub",
} }
}, },

View File

@ -30,7 +30,7 @@
data() { data() {
return { return {
isActive: false, isActive: true,
activeName: "body", activeName: "body",
} }
}, },

View File

@ -7,7 +7,10 @@
<el-collapse-transition> <el-collapse-transition>
<el-tabs v-model="activeName" v-show="isActive"> <el-tabs v-model="activeName" v-show="isActive">
<el-tab-pane label="Body" name="body" class="pane"> <el-tab-pane label="Body" name="body" class="pane">
<ms-code-edit :mode="mode" :read-only="true" :data="response.body" :modes="modes" ref="codeEdit"/> <!--
<ms-code-edit :mode="mode" :read-only="true" :data="response.body" :modes="modes" ref="codeEdit"/>
-->
<pre>{{response.body}}</pre>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="Headers" name="headers" class="pane"> <el-tab-pane label="Headers" name="headers" class="pane">
<pre>{{response.headers}}</pre> <pre>{{response.headers}}</pre>
@ -48,7 +51,7 @@
data() { data() {
return { return {
isActive: false, isActive: true,
activeName: "body", activeName: "body",
modes: ['text', 'json', 'xml', 'html'], modes: ['text', 'json', 'xml', 'html'],
mode: BODY_FORMAT.TEXT mode: BODY_FORMAT.TEXT

View File

@ -1,5 +1,7 @@
<template> <template>
<editor v-model="formatData" :lang="mode" @init="editorInit" theme="chrome"/> <div>
<editor v-model="formatData" :lang="mode" @init="editorInit" theme="chrome"/>
</div>
</template> </template>
<script> <script>
@ -63,7 +65,7 @@
this.init(editor); this.init(editor);
} }
}, },
format() { /*format() {
if (this.mode === 'json') { if (this.mode === 'json') {
try { try {
this.formatData = JSON.stringify(JSON.parse(this.data), null, '\t'); this.formatData = JSON.stringify(JSON.parse(this.data), null, '\t');
@ -77,7 +79,7 @@
this.formatData = this.data; this.formatData = this.data;
} }
} }
} }*/
} }
} }
</script> </script>