From a834a563fb1ed19181fab81f81ee348197e0fe7e Mon Sep 17 00:00:00 2001 From: WangXu10 Date: Sun, 4 Feb 2024 21:04:03 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E9=A1=B9=E7=9B=AE=E7=AE=A1=E7=90=86):?= =?UTF-8?q?=20=E8=AF=AF=E6=8A=A5=E7=B1=BB=E5=9E=8B=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/project/dto/FakeErrorDTO.java | 7 ++++++- .../io/metersphere/project/enums/FakeErrorType.java | 12 ++++++++++++ .../menuManagement/components/falseAlermRule.vue | 8 ++++---- 3 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 backend/services/project-management/src/main/java/io/metersphere/project/enums/FakeErrorType.java diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/dto/FakeErrorDTO.java b/backend/services/project-management/src/main/java/io/metersphere/project/dto/FakeErrorDTO.java index 5c076ff7fd..97a42d3537 100644 --- a/backend/services/project-management/src/main/java/io/metersphere/project/dto/FakeErrorDTO.java +++ b/backend/services/project-management/src/main/java/io/metersphere/project/dto/FakeErrorDTO.java @@ -1,5 +1,9 @@ package io.metersphere.project.dto; +import io.metersphere.project.enums.FakeErrorType; +import io.metersphere.sdk.constants.TemplateScene; +import io.metersphere.system.valid.EnumValue; +import io.metersphere.validation.groups.Created; import io.swagger.v3.oas.annotations.media.Schema; import jakarta.validation.constraints.NotBlank; import lombok.Data; @@ -29,7 +33,8 @@ public class FakeErrorDTO implements Serializable { @NotBlank(message = "{fake_error.type.not_blank}") private String type; - @Schema(description = "匹配规则-内容类型/header/data/body", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "匹配规则-内容类型", requiredMode = Schema.RequiredMode.REQUIRED) + @EnumValue(enumClass = FakeErrorType.class, groups = {Created.class}) @NotBlank(message = "{fake_error.resp_type.not_blank}") private String respType; diff --git a/backend/services/project-management/src/main/java/io/metersphere/project/enums/FakeErrorType.java b/backend/services/project-management/src/main/java/io/metersphere/project/enums/FakeErrorType.java new file mode 100644 index 0000000000..6c2dbcbf91 --- /dev/null +++ b/backend/services/project-management/src/main/java/io/metersphere/project/enums/FakeErrorType.java @@ -0,0 +1,12 @@ +package io.metersphere.project.enums; + +/** + * @author: LAN + * @date: 2024/1/12 11:03 + * @version: 1.0 + */ +public enum FakeErrorType { + RESPONSE_HEADERS, + RESPONSE_DATA, + RESPONSE_CODE +} diff --git a/frontend/src/views/project-management/projectAndPermission/menuManagement/components/falseAlermRule.vue b/frontend/src/views/project-management/projectAndPermission/menuManagement/components/falseAlermRule.vue index 9c5568d51e..4f1c1b4dbf 100644 --- a/frontend/src/views/project-management/projectAndPermission/menuManagement/components/falseAlermRule.vue +++ b/frontend/src/views/project-management/projectAndPermission/menuManagement/components/falseAlermRule.vue @@ -133,9 +133,9 @@ const currentList = ref([]); const tableStore = useTableStore(); const headerOptions = computed(() => [ - { label: 'Response Headers', value: 'headers' }, - { label: 'Response Data', value: 'data' }, - { label: 'Response Code', value: 'code' }, + { label: 'Response Headers', value: 'RESPONSE_HEADERS' }, + { label: 'Response Data', value: 'RESPONSE_DATA' }, + { label: 'Response Code', value: 'RESPONSE_CODE' }, ]); const relationOptions = computed(() => [ { label: '包含', value: 'contain' }, @@ -452,7 +452,7 @@ type: 'select', options: headerOptions.value, className: 'w-[205px]', - defaultValue: 'headers', + defaultValue: 'RESPONSE_HEADERS', }, { filed: 'relation', // 匹配规则-操作类型