refactor(项目管理): 误报类型枚举

This commit is contained in:
WangXu10 2024-02-04 21:04:03 +08:00 committed by Craftsman
parent 6aa7112d16
commit a834a563fb
3 changed files with 22 additions and 5 deletions

View File

@ -1,5 +1,9 @@
package io.metersphere.project.dto; 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 io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotBlank;
import lombok.Data; import lombok.Data;
@ -29,7 +33,8 @@ public class FakeErrorDTO implements Serializable {
@NotBlank(message = "{fake_error.type.not_blank}") @NotBlank(message = "{fake_error.type.not_blank}")
private String type; 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}") @NotBlank(message = "{fake_error.resp_type.not_blank}")
private String respType; private String respType;

View File

@ -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
}

View File

@ -133,9 +133,9 @@
const currentList = ref<FakeTableListItem[]>([]); const currentList = ref<FakeTableListItem[]>([]);
const tableStore = useTableStore(); const tableStore = useTableStore();
const headerOptions = computed(() => [ const headerOptions = computed(() => [
{ label: 'Response Headers', value: 'headers' }, { label: 'Response Headers', value: 'RESPONSE_HEADERS' },
{ label: 'Response Data', value: 'data' }, { label: 'Response Data', value: 'RESPONSE_DATA' },
{ label: 'Response Code', value: 'code' }, { label: 'Response Code', value: 'RESPONSE_CODE' },
]); ]);
const relationOptions = computed(() => [ const relationOptions = computed(() => [
{ label: '包含', value: 'contain' }, { label: '包含', value: 'contain' },
@ -452,7 +452,7 @@
type: 'select', type: 'select',
options: headerOptions.value, options: headerOptions.value,
className: 'w-[205px]', className: 'w-[205px]',
defaultValue: 'headers', defaultValue: 'RESPONSE_HEADERS',
}, },
{ {
filed: 'relation', // - filed: 'relation', // -