fix: update form value trigger tips
This commit is contained in:
@@ -43,6 +43,34 @@ interface AdvanceConfigProps {
|
||||
source: string;
|
||||
}
|
||||
|
||||
const placementStrategyTips = [
|
||||
{
|
||||
title: 'Spread',
|
||||
tips: 'resources.form.spread.tips'
|
||||
},
|
||||
{
|
||||
title: 'Binpack',
|
||||
tips: 'resources.form.binpack.tips'
|
||||
}
|
||||
];
|
||||
|
||||
const scheduleTypeTips = [
|
||||
{
|
||||
title: {
|
||||
text: 'models.form.scheduletype.auto',
|
||||
locale: true
|
||||
},
|
||||
tips: 'models.form.scheduletype.auto.tips'
|
||||
},
|
||||
{
|
||||
title: {
|
||||
text: 'models.form.scheduletype.manual',
|
||||
locale: true
|
||||
},
|
||||
tips: 'models.form.scheduletype.manual.tips'
|
||||
}
|
||||
];
|
||||
|
||||
const CheckboxField: React.FC<{
|
||||
title: string;
|
||||
label: string;
|
||||
@@ -78,40 +106,6 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
||||
const worker_selector = Form.useWatch('worker_selector', form);
|
||||
const { onValuesChange } = useFormContext();
|
||||
|
||||
const placementStrategyTips = [
|
||||
{
|
||||
title: 'Spread',
|
||||
tips: intl.formatMessage({
|
||||
id: 'resources.form.spread.tips'
|
||||
})
|
||||
},
|
||||
{
|
||||
title: 'Binpack',
|
||||
tips: intl.formatMessage({
|
||||
id: 'resources.form.binpack.tips'
|
||||
})
|
||||
}
|
||||
];
|
||||
|
||||
const scheduleTypeTips = [
|
||||
{
|
||||
title: intl.formatMessage({
|
||||
id: 'models.form.scheduletype.auto'
|
||||
}),
|
||||
tips: intl.formatMessage({
|
||||
id: 'models.form.scheduletype.auto.tips'
|
||||
})
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({
|
||||
id: 'models.form.scheduletype.manual'
|
||||
}),
|
||||
tips: intl.formatMessage({
|
||||
id: 'models.form.scheduletype.manual.tips'
|
||||
})
|
||||
}
|
||||
];
|
||||
|
||||
const paramsConfig = useMemo(() => {
|
||||
if (backend === backendOptionsMap.llamaBox) {
|
||||
return llamaConfig;
|
||||
|
||||
@@ -154,7 +154,6 @@ const AddModal: FC<AddModalProps> = (props) => {
|
||||
|
||||
const handleOnSelectModel = (item: any, evaluate?: boolean) => {
|
||||
setSelectedModel(item);
|
||||
console.log('item.isGGUF=========>', item.isGGUF);
|
||||
if (!item.isGGUF) {
|
||||
setIsGGUF(false);
|
||||
form.current?.form?.resetFields(resetFields);
|
||||
|
||||
@@ -81,6 +81,13 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
||||
}
|
||||
};
|
||||
|
||||
const customizer = (val1: any, val2: any) => {
|
||||
if ((val1 === null && val2 === '') || (val1 === '' && val2 === null)) {
|
||||
return true;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
const handleOnValuesChange = (data: any) => {
|
||||
const formdata = form.getFieldsValue?.();
|
||||
let alldata = {};
|
||||
@@ -100,7 +107,7 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
||||
worker_selector: originFormData.current?.worker_selector || null
|
||||
};
|
||||
}
|
||||
const isEqual = _.isEqual(alldata, originFormData.current);
|
||||
const isEqual = _.isEqualWith(alldata, originFormData.current, customizer);
|
||||
if (isEqual) {
|
||||
setWarningStatus({
|
||||
show: false,
|
||||
|
||||
Reference in New Issue
Block a user