TagSpaces is an offline, open source, document manager with tagging support
fix: cleaning up tag import functionality
Ilian Sapundshieve7d841edb524
diff --git a/app/components/TagLibrary.tsx b/app/components/TagLibrary.tsxindex 966500cfa..62a71f615 100644--- a/app/components/TagLibrary.tsx+++ b/app/components/TagLibrary.tsx@@ -92,6 +92,11 @@ interface Props {editTagGroup: () => void;editTag: () => void;deleteTag: (tagTitle: string, parentTagGroupUuid: Uuid) => void;+ showNotification: (+ text: string,+ notificationType?: string, // NotificationTypes+ autohide?: boolean+ ) => void;selectedEntries: Array<FileSystemEntry>;tagGroupCollapsed: Array<string>;}@@ -300,7 +305,7 @@ const TagLibrary = (props: Props) => {}}- const { tagGroups, classes, allTags } = props;+ const { tagGroups, classes, allTags, showNotification } = props;return (<div className={classes.panel} style={props.style}>@@ -393,6 +398,7 @@ const TagLibrary = (props: Props) => {importTagGroups={props.importTagGroups}exportTagGroups={props.exportTagGroups}showCreateTagGroupDialog={showCreateTagGroupDialog}+ showNotification={showNotification}openURLExternally={props.openURLExternally}/>{Boolean(tagMenuAnchorEl) && (@@ -474,7 +480,8 @@ function mapDispatchToProps(dispatch) {addTag: TagLibraryActions.addTag,addTags: TaggingActions.addTags,collectTagsFromLocation: TaggingActions.collectTagsFromLocation,- openURLExternally: AppActions.openURLExternally+ openURLExternally: AppActions.openURLExternally,+ showNotification: AppActions.showNotification},dispatch);diff --git a/app/components/menus/TagLibraryMenu.tsx b/app/components/menus/TagLibraryMenu.tsxindex e6603af24..8cda8a2f9 100644--- a/app/components/menus/TagLibraryMenu.tsx+++ b/app/components/menus/TagLibraryMenu.tsx@@ -25,7 +25,6 @@ import ImportExportIcon from '@material-ui/icons/ImportExport';import HelpIcon from '@material-ui/icons/Help';import AddIcon from '@material-ui/icons/Add';import ImportExportTagGroupsDialog from '../dialogs/ImportExportTagGroupsDialog';-// import SelectDirectoryDialog from '../dialogs/SelectDirectoryDialog';import i18n from '-/services/i18n';import AppConfig from '-/config';@@ -39,17 +38,17 @@ interface Props {importTagGroups: () => void;exportTagGroups: () => void;showCreateTagGroupDialog: () => void;+ showNotification: (+ text: string,+ notificationType?: string, // NotificationTypes+ autohide?: boolean+ ) => void;}const TagLibraryMenu = (props: Props) => {const fileInput = useRef<HTMLInputElement>(null);const tagGroupsImported = useRef([]);// const [tagGroups, setTagGroups] = useState(null);- // const [selectedDirectoryPath, setSelectedDirectoryPath] = useState('');- // const [- // isSelectDirectoryDialogOpened,- // setIsSelectDirectoryDialogOpened- // ] = useState(false);const [isImportExportTagGroupDialogOpened,setIsImportExportTagGroupDialogOpened@@ -67,25 +66,10 @@ const TagLibraryMenu = (props: Props) => {setIsImportExportTagGroupDialogOpened(true);}- // function showSelectDirectoryDialog() {- // setIsSelectDirectoryDialogOpened(true);- // // setSelectedDirectoryPath('');- // }-- // function closeSelectDirectoryExtDialog() {- // setIsSelectDirectoryDialogOpened(false);- // }-function handleImportTagGroup() {props.onClose();setDialogModeImport(true);-- // if (AppConfig.isCordovaAndroid && AppConfig.isCordovaiOS) {- // // TODO Select directory or file from dialog- // showSelectDirectoryDialog();- // } else {fileInput.current.click();- // }}function handleFileInputChange(selection: any) {@@ -100,17 +84,14 @@ const TagLibraryMenu = (props: Props) => {tagGroupsImported.current = jsonObj.tagGroups;setIsImportExportTagGroupDialogOpened(true);} else {- // TODO connect showNotification- /* props.showNotification(+ props.showNotification(i18n.t('core:invalidImportFile', 'warning', true)- ); */+ );}} catch (e) {- console.error('Error : ', e);- // TODO connect showNotification- /* props.showNotification(+ props.showNotification(i18n.t('core:invalidImportFile', 'warning', true)- ); */+ );}};reader.readAsText(file);@@ -131,10 +112,6 @@ const TagLibraryMenu = (props: Props) => {importTagGroups={props.importTagGroups}/>)}- {/* <SelectDirectoryDialog- open={isSelectDirectoryDialogOpened}- onClose={closeSelectDirectoryExtDialog}- /> */}<Menu anchorEl={props.anchorEl} open={props.open} onClose={props.onClose}><MenuItemdata-tid="createNewTagGroup"