From ab1c90a47b18efd7b51984e773d6c8108a41a23c Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Wed, 28 Oct 2020 17:28:37 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20sql=E8=AF=B7=E6=B1=82=E7=BB=93=E6=9E=9C=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/report/ApiReportViewDetail.vue | 10 ++- .../report/components/RequestResultTail.vue | 7 +- .../api/report/components/ResponseText.vue | 73 +++++++++++------- .../api/report/components/SqlResultTable.vue | 75 +++++++++++++++++++ .../components/request/ApiRequestForm.vue | 2 +- 5 files changed, 133 insertions(+), 34 deletions(-) create mode 100644 frontend/src/business/components/api/report/components/SqlResultTable.vue diff --git a/frontend/src/business/components/api/report/ApiReportViewDetail.vue b/frontend/src/business/components/api/report/ApiReportViewDetail.vue index 8b29bf8f33..8184192e82 100644 --- a/frontend/src/business/components/api/report/ApiReportViewDetail.vue +++ b/frontend/src/business/components/api/report/ApiReportViewDetail.vue @@ -23,7 +23,7 @@ - + @@ -47,6 +47,7 @@ import MsApiReportExport from "./ApiReportExport"; import {exportPdf} from "../../../../common/js/utils"; import html2canvas from "html2canvas"; import MsApiReportViewHeader from "./ApiReportViewHeader"; +import {RequestFactory} from "../test/model/ScenarioModel"; export default { name: "MsApiReportViewDetail", @@ -67,7 +68,8 @@ export default { isRequestResult: false, request: {}, scenarioName: null, - reportExportVisible: false + reportExportVisible: false, + requestType: undefined, } }, props: ['reportId'], @@ -140,6 +142,10 @@ export default { }, requestResult(requestResult) { this.isRequestResult = false; + this.requestType = undefined; + if (requestResult.request.body.indexOf('[Callable Statement]') > -1) { + this.requestType = RequestFactory.TYPES.SQL; + } this.$nextTick(function () { this.isRequestResult = true; this.request = requestResult.request; diff --git a/frontend/src/business/components/api/report/components/RequestResultTail.vue b/frontend/src/business/components/api/report/components/RequestResultTail.vue index 097c60c008..d9f51e0c06 100644 --- a/frontend/src/business/components/api/report/components/RequestResultTail.vue +++ b/frontend/src/business/components/api/report/components/RequestResultTail.vue @@ -69,14 +69,14 @@
- +

- +
@@ -95,7 +95,8 @@ components: {MsResponseText, MsRequestText, MsAssertionResults, MsRequestMetric, MsRequestResult}, props: { request: Object, - scenarioName: String + scenarioName: String, + requestType: String }, data() { diff --git a/frontend/src/business/components/api/report/components/ResponseText.vue b/frontend/src/business/components/api/report/components/ResponseText.vue index 8831dae6c9..ed56ac3be8 100644 --- a/frontend/src/business/components/api/report/components/ResponseText.vue +++ b/frontend/src/business/components/api/report/components/ResponseText.vue @@ -6,8 +6,9 @@ - - + + +
{{ response.headers }}
@@ -20,7 +21,7 @@
{{response.vars}}
- + @@ -35,18 +36,21 @@ import MsAssertionResults from "./AssertionResults"; import MsCodeEdit from "../../../common/components/MsCodeEdit"; import MsDropdown from "../../../common/components/MsDropdown"; -import {BODY_FORMAT} from "../../test/model/ScenarioModel"; +import {BODY_FORMAT, RequestFactory, Request, SqlRequest} from "../../test/model/ScenarioModel"; +import MsSqlResultTable from "./SqlResultTable"; export default { name: "MsResponseText", components: { + MsSqlResultTable, MsDropdown, MsCodeEdit, MsAssertionResults, }, props: { + requestType: String, response: Object }, @@ -75,39 +79,52 @@ export default { if (this.response.headers.indexOf("Content-Type: application/json") > 0) { this.mode = BODY_FORMAT.JSON; } + }, + + computed: { + isSqlType() { + return (this.requestType === RequestFactory.TYPES.SQL && this.response.responseCode === '200'); + } } } diff --git a/frontend/src/business/components/api/report/components/SqlResultTable.vue b/frontend/src/business/components/api/report/components/SqlResultTable.vue new file mode 100644 index 0000000000..9d54f806ee --- /dev/null +++ b/frontend/src/business/components/api/report/components/SqlResultTable.vue @@ -0,0 +1,75 @@ + + + + + diff --git a/frontend/src/business/components/api/test/components/request/ApiRequestForm.vue b/frontend/src/business/components/api/test/components/request/ApiRequestForm.vue index d7bdab7a27..41d1dcf1a0 100644 --- a/frontend/src/business/components/api/test/components/request/ApiRequestForm.vue +++ b/frontend/src/business/components/api/test/components/request/ApiRequestForm.vue @@ -2,7 +2,7 @@
-