Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix issues #469

Merged
merged 1 commit into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/pages/Import/FileList/UploadConfigModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -175,7 +175,7 @@ const UploadConfigModal = (props: IProps) => {
render: value => <span className={styles.limitWidth}>{value}</span>,
};
})
: [], [previewContent, activeItem]);
: [], [previewContent, activeItem?.withHeader]);
const handleConfirm = useCallback(() => {
const existFileName = fileList.map((file) => file.name);
const repeatFiles = data.filter((file) => existFileName.includes(file.name));
Expand Down
1 change: 1 addition & 0 deletions app/pages/Import/FileList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ const FileList = () => {
title={intl.get('common.ask')}
okText={intl.get('common.confirm')}
cancelText={intl.get('common.cancel')}
disabled={!selectFiles.length}
>
<Button className={styles.deleteBtn} disabled={!selectFiles.length}>
{intl.get('import.deleteFiles')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <div className={styles.row}>
<Collapse bordered={false} ghost className={styles.vidCollapse}>
<Panel header={<div className={cls(styles.panelTitle, styles.spaceBetween)}>
Expand All @@ -57,7 +59,7 @@ const VIDSetting = observer((props: {
</div>
</>} />
</div>} key="default">
{idFunction && <div className={styles.rowItem}>
{spaceVidType === 'INT64' && idFunction && <div className={styles.rowItem}>
<span className={styles.label}>{intl.get('import.vidFunction')}</span>
<Select
bordered={false}
Expand Down
2 changes: 1 addition & 1 deletion app/pages/Import/TaskCreate/SchemaConfig/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const SelectMappingTargetHeader = observer((props: IHeaderProps) => {
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 => (
<Option value={t} key={t}>
{t}
</Option>
Expand Down
8 changes: 5 additions & 3 deletions app/stores/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
};
Expand Down Expand Up @@ -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];
};
}

Expand Down