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', // 匹配规则-操作类型