diff --git a/app/pages/Import/FileList/UploadConfigModal/index.tsx b/app/pages/Import/FileList/UploadConfigModal/index.tsx index 240dbc79..d01e783e 100644 --- a/app/pages/Import/FileList/UploadConfigModal/index.tsx +++ b/app/pages/Import/FileList/UploadConfigModal/index.tsx @@ -96,7 +96,7 @@ const UploadConfigModal = (props: IProps) => { }, [data]); const deletePreviewFile = useCallback((e: React.MouseEvent, index: number) => { e.stopPropagation(); - const isActive = activeItem.uid === data[index].uid; + const isActive = activeItem?.uid === data[index].uid; const newData = data.filter((_, i) => i !== index); const checkedNum = data.reduce((n, file) => n + (file.withHeader & 1), 0); setState({ @@ -175,7 +175,7 @@ const UploadConfigModal = (props: IProps) => { render: value => {value}, }; }) - : [], [previewContent, activeItem]); + : [], [previewContent, activeItem?.withHeader]); const handleConfirm = useCallback(() => { const existFileName = fileList.map((file) => file.name); const repeatFiles = data.filter((file) => existFileName.includes(file.name)); diff --git a/app/pages/Import/FileList/index.tsx b/app/pages/Import/FileList/index.tsx index 1fed645a..75877536 100644 --- a/app/pages/Import/FileList/index.tsx +++ b/app/pages/Import/FileList/index.tsx @@ -120,6 +120,7 @@ const FileList = () => { title={intl.get('common.ask')} okText={intl.get('common.confirm')} cancelText={intl.get('common.cancel')} + disabled={!selectFiles.length} > {intl.get('import.deleteFiles')} diff --git a/app/pages/Import/TaskCreate/SchemaConfig/FileMapping/index.tsx b/app/pages/Import/TaskCreate/SchemaConfig/FileMapping/index.tsx index 57277214..46114553 100644 --- a/app/pages/Import/TaskCreate/SchemaConfig/FileMapping/index.tsx +++ b/app/pages/Import/TaskCreate/SchemaConfig/FileMapping/index.tsx @@ -34,6 +34,8 @@ const VIDSetting = observer((props: { }) => { const { keyMap: { idKey, idFunction, idPrefix, label }, data } = props; const { intl } = useI18n(); + const { schema } = useStore(); + const { spaceVidType } = schema; return @@ -57,7 +59,7 @@ const VIDSetting = observer((props: { >} /> } key="default"> - {idFunction && + {spaceVidType === 'INT64' && idFunction && {intl.get('import.vidFunction')} { onClick={e => e.stopPropagation()} onChange={onSelect} > - {targetList.filter(t => !config.some(c => c.name === t)).map(t => ( + {targetList?.filter(t => !config.some(c => c.name === t)).map(t => ( {t} diff --git a/app/stores/global.ts b/app/stores/global.ts index a7e1534c..ee1107a5 100644 --- a/app/stores/global.ts +++ b/app/stores/global.ts @@ -63,9 +63,10 @@ export class GlobalStore { }, }, ); - resetStore(); + // clear storage before reset store, some store data is related to storage this.clearStorage(); this.clearCookies(); + resetStore(); this.ngqlRunner?.desctory(); this.history.push(`/login${location.search}`); }; @@ -120,13 +121,14 @@ export class GlobalStore { getGraphAddress = async () => { const { code, data } = await service.execNGQL({ gql: 'show hosts graph;' }); - return code !== 0 ? [] : data.tables.reduce((acc, cur) => { - if (isValidIP(cur.Host)) { + const list = code !== 0 ? [] : data.tables.reduce((acc, cur) => { + if (isValidIP(cur.Host) && cur.Status === 'ONLINE') { acc.push(`${cur.Host}:${cur.Port}`); } return acc; } , []); + return list.length ? list : [this.host]; }; }