From ac0d65ee1eba271775209344d87aed66d95d6221 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Mon, 23 Nov 2020 12:32:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E5=AE=9A=E4=B9=89):=20?= =?UTF-8?q?=E6=96=AD=E8=A8=80=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assertion/ApiAssertionDuration.vue | 23 +++- .../assertion/ApiAssertionJsonPath.vue | 4 +- .../assertion/ApiAssertionJsr223.vue | 2 +- .../assertion/ApiAssertionRegex.vue | 4 +- .../components/assertion/ApiAssertionText.vue | 4 +- .../assertion/ApiAssertionsEdit.vue | 117 ++++++++++++------ .../assertion/ApiJsonpathSuggestList.vue | 2 +- 7 files changed, 105 insertions(+), 51 deletions(-) diff --git a/frontend/src/business/components/api/definition/components/assertion/ApiAssertionDuration.vue b/frontend/src/business/components/api/definition/components/assertion/ApiAssertionDuration.vue index 5ae71ef2d2..9412f0c145 100644 --- a/frontend/src/business/components/api/definition/components/assertion/ApiAssertionDuration.vue +++ b/frontend/src/business/components/api/definition/components/assertion/ApiAssertionDuration.vue @@ -2,12 +2,14 @@
- - Add + + {{ $t('api_test.request.assertions.add') }} +
@@ -33,17 +35,28 @@ methods: { add() { - this.duration.value = this.value; - this.callback(); + if (this.validate()) { + this.duration.value = this.value; + this.callback(); + } }, remove() { this.duration.value = undefined; }, change(value) { - this.$emit('change', value); + if (this.validate()) { + this.$emit('change', value); + } }, input(value) { this.$emit('input', value); + }, + validate() { + if (Number(this.value) < 0 || this.value=='') { + this.$error(this.$t('commons.formatErr')); + return false; + } + return true; } } } diff --git a/frontend/src/business/components/api/definition/components/assertion/ApiAssertionJsonPath.vue b/frontend/src/business/components/api/definition/components/assertion/ApiAssertionJsonPath.vue index b09a29e497..7e6c76efb3 100644 --- a/frontend/src/business/components/api/definition/components/assertion/ApiAssertionJsonPath.vue +++ b/frontend/src/business/components/api/definition/components/assertion/ApiAssertionJsonPath.vue @@ -11,7 +11,9 @@ - Add + + {{ $t('api_test.request.assertions.add') }} + diff --git a/frontend/src/business/components/api/definition/components/assertion/ApiAssertionJsr223.vue b/frontend/src/business/components/api/definition/components/assertion/ApiAssertionJsr223.vue index 729a529474..5261c01154 100644 --- a/frontend/src/business/components/api/definition/components/assertion/ApiAssertionJsr223.vue +++ b/frontend/src/business/components/api/definition/components/assertion/ApiAssertionJsr223.vue @@ -56,7 +56,7 @@ diff --git a/frontend/src/business/components/api/definition/components/assertion/ApiJsonpathSuggestList.vue b/frontend/src/business/components/api/definition/components/assertion/ApiJsonpathSuggestList.vue index 9d84806ca9..24b0b1a975 100644 --- a/frontend/src/business/components/api/definition/components/assertion/ApiJsonpathSuggestList.vue +++ b/frontend/src/business/components/api/definition/components/assertion/ApiJsonpathSuggestList.vue @@ -65,7 +65,7 @@ }; }, props: { - request: {}, + request: HttpRequest, }, methods: { close() {