fix(接口定义): 修复用例多次运行结果未及时更新问题。

This commit is contained in:
fit2-zhao 2021-06-07 16:34:06 +08:00 committed by BugKing
parent fecf24e514
commit 7e7d726832
3 changed files with 74 additions and 66 deletions

View File

@ -16,12 +16,12 @@
</template> </template>
<script> <script>
import ApiBaseComponent from "../common/ApiBaseComponent"; import ApiBaseComponent from "../common/ApiBaseComponent";
import MsRequestResultTail from "../../../definition/components/response/RequestResultTail"; import MsRequestResultTail from "../../../definition/components/response/RequestResultTail";
import ElCollapseTransition from "element-ui/src/transitions/collapse-transition"; import ElCollapseTransition from "element-ui/src/transitions/collapse-transition";
import MsRequestMetric from "../../../definition/components/response/RequestMetric"; import MsRequestMetric from "../../../definition/components/response/RequestMetric";
export default { export default {
name: "ApiResponseComponent", name: "ApiResponseComponent",
components: {ElCollapseTransition, MsRequestResultTail, ApiBaseComponent, MsRequestMetric}, components: {ElCollapseTransition, MsRequestResultTail, ApiBaseComponent, MsRequestMetric},
props: {apiItem: {}, result: {}, currentProtocol: String}, props: {apiItem: {}, result: {}, currentProtocol: String},
@ -32,7 +32,7 @@
} }
}, },
created() { created() {
if (!this.result) { if (!this.result || !this.result.responseResult) {
this.getExecResult(); this.getExecResult();
if (this.apiItem.isActive) { if (this.apiItem.isActive) {
// this.isActive = true; // this.isActive = true;
@ -44,10 +44,14 @@
}, },
watch: { watch: {
result() { result() {
if (this.result.responseResult) {
this.response = this.result; this.response = this.result;
} else {
this.getExecResult();
}
this.isActive = true; this.isActive = true;
}, },
apiItem(){ apiItem() {
this.getExecResult(); this.getExecResult();
} }
}, },
@ -70,33 +74,33 @@
this.isActive = !this.isActive; this.isActive = !this.isActive;
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.header { .header {
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
} }
/deep/ .el-card__body { /deep/ .el-card__body {
padding: 15px; padding: 15px;
} }
.icon.is-active { .icon.is-active {
transform: rotate(90deg); transform: rotate(90deg);
} }
.el-icon-arrow-right { .el-icon-arrow-right {
float: left; float: left;
display: block; display: block;
height: 30px; height: 30px;
line-height: 30px; line-height: 30px;
} }
.metric-container { .metric-container {
margin-left: 25px; margin-left: 25px;
} }
</style> </style>

View File

@ -107,7 +107,7 @@
<esb-definition-response v-xpack v-if="showXpackCompnent" :currentProtocol="apiCase.request.protocol" :request="apiCase.request" :is-api-component="false" :show-options-button="false" :show-header="true" :api-item="apiCase"/> <esb-definition-response v-xpack v-if="showXpackCompnent" :currentProtocol="apiCase.request.protocol" :request="apiCase.request" :is-api-component="false" :show-options-button="false" :show-header="true" :api-item="apiCase"/>
</div> </div>
<div v-else> <div v-else>
<api-response-component :currentProtocol="apiCase.request.protocol" :api-item="apiCase"/> <api-response-component :currentProtocol="apiCase.request.protocol" :api-item="apiCase" :result="runResult"/>
</div> </div>
<ms-jmx-step :request="apiCase.request" :response="apiCase.responseData"/> <ms-jmx-step :request="apiCase.request" :response="apiCase.responseData"/>
@ -192,6 +192,7 @@
} }
}, },
props: { props: {
runResult:{},
apiCase: { apiCase: {
type: Object, type: Object,
default() { default() {

View File

@ -33,6 +33,7 @@
:environment="environment" :environment="environment"
:is-case-edit="isCaseEdit" :is-case-edit="isCaseEdit"
:api="api" :api="api"
:runResult="runResult"
:api-case="item" :index="index" ref="apiCaseItem"/> :api-case="item" :index="index" ref="apiCaseItem"/>
</div> </div>
</el-main> </el-main>
@ -86,6 +87,7 @@ export default {
batchLoadingIds: [], batchLoadingIds: [],
singleLoading: false, singleLoading: false,
singleRunId: "", singleRunId: "",
runResult: {},
runData: [], runData: [],
selectdCases: [], selectdCases: [],
reportId: "", reportId: "",
@ -208,6 +210,7 @@ export default {
// //
let obj = {envId: this.environment, show: true}; let obj = {envId: this.environment, show: true};
this.batchEdit(obj); this.batchEdit(obj);
this.runResult = {testId: getUUID()};
this.$success(this.$t('organization.integration.successful_operation')); this.$success(this.$t('organization.integration.successful_operation'));
}, },
errorRefresh() { errorRefresh() {
@ -434,7 +437,7 @@ export default {
this.$success(this.$t('commons.save_success')); this.$success(this.$t('commons.save_success'));
} }
this.selectdCases = []; this.selectdCases = [];
this.getApiTest(); //this.getApiTest();
}); });
}, },
} }