fix: ignore the fields when compare data
This commit is contained in:
@@ -20,7 +20,8 @@ import {
|
|||||||
localPathTipsList,
|
localPathTipsList,
|
||||||
modelSourceMap,
|
modelSourceMap,
|
||||||
ollamaModelOptions,
|
ollamaModelOptions,
|
||||||
sourceOptions
|
sourceOptions,
|
||||||
|
updateIgnoreFields
|
||||||
} from '../config';
|
} from '../config';
|
||||||
import { FormContext } from '../config/form-context';
|
import { FormContext } from '../config/form-context';
|
||||||
import { FormData, ListItem } from '../config/types';
|
import { FormData, ListItem } from '../config/types';
|
||||||
@@ -115,8 +116,13 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const originalData = _.pick(originFormData.current, Object.keys(alldata));
|
const originalData = _.pick(originFormData.current, Object.keys(alldata));
|
||||||
|
console.log('alldata:', alldata, originalData);
|
||||||
|
|
||||||
const isEqual = _.isEqualWith(alldata, originalData, customizer);
|
const isEqual = _.isEqualWith(
|
||||||
|
_.omit(alldata, updateIgnoreFields),
|
||||||
|
_.omit(originalData, updateIgnoreFields),
|
||||||
|
customizer
|
||||||
|
);
|
||||||
if (isEqual) {
|
if (isEqual) {
|
||||||
setWarningStatus({
|
setWarningStatus({
|
||||||
show: false,
|
show: false,
|
||||||
|
|||||||
@@ -477,6 +477,9 @@ export const excludeFields = [
|
|||||||
'gpu_selector'
|
'gpu_selector'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// ingore fields when compare old and new data
|
||||||
|
export const updateIgnoreFields = ['categories', 'replicas', 'description'];
|
||||||
|
|
||||||
// if some fields need to trigger manual check, add them here
|
// if some fields need to trigger manual check, add them here
|
||||||
export const updateExcludeFields = [
|
export const updateExcludeFields = [
|
||||||
'repo_id',
|
'repo_id',
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import { RcFile } from 'antd/es/upload';
|
|||||||
import { debounce, round } from 'lodash';
|
import { debounce, round } from 'lodash';
|
||||||
import React, { useCallback, useRef } from 'react';
|
import React, { useCallback, useRef } from 'react';
|
||||||
|
|
||||||
|
const acceptImageType = ['image/png', 'image/jpg', 'image/jpeg'];
|
||||||
|
|
||||||
interface UploadImgProps {
|
interface UploadImgProps {
|
||||||
size?: 'small' | 'middle' | 'large';
|
size?: 'small' | 'middle' | 'large';
|
||||||
height?: number;
|
height?: number;
|
||||||
@@ -34,7 +36,7 @@ const UploadImg: React.FC<UploadImgProps> = ({
|
|||||||
children,
|
children,
|
||||||
icon,
|
icon,
|
||||||
title,
|
title,
|
||||||
accept = 'image/*',
|
accept = acceptImageType.join(','),
|
||||||
size = 'small'
|
size = 'small'
|
||||||
}) => {
|
}) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|||||||
Reference in New Issue
Block a user