chore: remove labels
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import LabelSelector from '@/components/label-selector';
|
||||
import SealInput from '@/components/seal-form/seal-input';
|
||||
import SealSelect from '@/components/seal-form/seal-select';
|
||||
import { PageAction } from '@/config';
|
||||
@@ -13,7 +12,6 @@ import { useQueryModelInstancesList } from '@/pages/llmodels/services/use-query-
|
||||
import { useQueryModelList } from '@/pages/llmodels/services/use-query-model-list';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { Form } from 'antd';
|
||||
import _ from 'lodash';
|
||||
import React, { useEffect } from 'react';
|
||||
import { useFormContext } from '../config/form-context';
|
||||
import { FormData } from '../config/types';
|
||||
@@ -21,7 +19,6 @@ import { FormData } from '../config/types';
|
||||
const BasicForm: React.FC = () => {
|
||||
const intl = useIntl();
|
||||
const form = Form.useFormInstance();
|
||||
const labels = Form.useWatch('labels', form);
|
||||
const { getRuleMessage } = useAppUtils();
|
||||
const { action, open } = useFormContext();
|
||||
const {
|
||||
@@ -43,10 +40,6 @@ const BasicForm: React.FC = () => {
|
||||
instanceList
|
||||
} = useQueryModelInstancesList();
|
||||
|
||||
const handleLabelsChange = (labels: object) => {
|
||||
form.setFieldValue('labels', labels);
|
||||
};
|
||||
|
||||
const onModelListOpenChange = async (open: boolean) => {
|
||||
if (open && modelList.length === 0) {
|
||||
await form.validateFields(['cluster_id']);
|
||||
@@ -186,41 +179,7 @@ const BasicForm: React.FC = () => {
|
||||
required
|
||||
></SealSelect>
|
||||
</Form.Item>
|
||||
<Form.Item<FormData>
|
||||
name="labels"
|
||||
rules={[
|
||||
() => ({
|
||||
validator(rule, value) {
|
||||
if (_.keys(value).length > 0) {
|
||||
if (_.some(_.keys(value), (k: string) => !value[k])) {
|
||||
return Promise.reject(
|
||||
intl.formatMessage(
|
||||
{
|
||||
id: 'common.validate.value'
|
||||
},
|
||||
{
|
||||
name: intl.formatMessage({
|
||||
id: 'resources.form.label'
|
||||
})
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
})
|
||||
]}
|
||||
>
|
||||
<LabelSelector
|
||||
label={intl.formatMessage({
|
||||
id: 'resources.table.labels'
|
||||
})}
|
||||
labels={labels}
|
||||
btnText={intl.formatMessage({ id: 'common.button.addLabel' })}
|
||||
onChange={handleLabelsChange}
|
||||
></LabelSelector>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item<FormData> name="description">
|
||||
<SealInput.TextArea
|
||||
scaleSize={true}
|
||||
|
||||
Reference in New Issue
Block a user