config.ts 1.96 KB
import { FormSchema } from '/@/components/Form';
import { useI18n } from '/@/hooks/web/useI18n';

export enum FormFieldsEnum {
  NAME = 'name',
  LABEL = 'label',
  ROUTINGKEY = 'routingKey',
  SECRET = 'secret',
  TYPE = 'type',
  DESCRIPTION = 'description',
  TEXTSEARCH = 'textSearch',
}

const { t } = useI18n();
export const formSchema: FormSchema[] = [
  {
    field: FormFieldsEnum.NAME,
    label: t('edge.instance.search.instanceName'),
    component: 'Input',
    required: true,
    componentProps: {
      maxLength: 255,
      placeholder: t('edge.instance.search.instanceNamePlaceholder'),
    },
  },
  {
    field: FormFieldsEnum.TYPE,
    label: t('edge.instance.search.instanceType'),
    component: 'Input',
    required: true,
    defaultValue: 'default',
    componentProps: {
      disabled: true,
      placeholder: t('edge.instance.search.instanceTypePlaceholder'),
    },
  },
  {
    field: FormFieldsEnum.ROUTINGKEY,
    label: t('edge.instance.search.edgeKey'),
    slot: 'routingKey',
    required: true,
    component: 'Input',
  },
  {
    field: FormFieldsEnum.SECRET,
    label: t('edge.instance.search.edgeSecret'),
    slot: 'secret',
    required: true,
    component: 'Input',
  },
  {
    field: FormFieldsEnum.LABEL,
    label: t('edge.instance.search.label'),
    component: 'Input',
    componentProps: {
      maxLength: 255,
      placeholder: t('edge.instance.search.labelPlaceholder'),
    },
  },
  {
    field: FormFieldsEnum.DESCRIPTION,
    label: t('edge.instance.search.desc'),
    component: 'InputTextArea',
    componentProps: {
      maxLength: 255,
      placeholder: t('edge.instance.search.descPlaceholder'),
    },
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: FormFieldsEnum.TEXTSEARCH,
    label: t('edge.instance.search.instanceName'),
    component: 'Input',
    colProps: { span: 6 },
    componentProps: {
      maxLength: 255,
      placeholder: t('edge.instance.search.instanceNamePlaceholder'),
    },
  },
];