TagSpaces is an offline, open source, document manager with tagging support
Close and clear do not clears uploads (#1853)
Stanimir12a1deff521c
diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsxindex 81b87374b..33021b156 100644--- a/app/components/FolderContainer.tsx+++ b/app/components/FolderContainer.tsx@@ -766,7 +766,7 @@ const areEqual = (prevProp: Props, nextProp: Props) =>prevProp.currentDirectoryPerspective &&/* this props is set before currentDirectoryEntries is loaded and will reload FolderContainer *//* nextProp.currentLocationPath === prevProp.currentLocationPath && */-+ JSON.stringify(nextProp.progress) === JSON.stringify(prevProp.progress) &&JSON.stringify(nextProp.directoryContent) ===JSON.stringify(prevProp.directoryContent) &&JSON.stringify(nextProp.openedFiles) ===diff --git a/app/components/dialogs/FileUploadDialog.tsx b/app/components/dialogs/FileUploadDialog.tsxindex 0be02bca6..acbb54592 100644--- a/app/components/dialogs/FileUploadDialog.tsx+++ b/app/components/dialogs/FileUploadDialog.tsx@@ -24,6 +24,7 @@ import DialogTitle from '@mui/material/DialogTitle';import Dialog from '@mui/material/Dialog';import CloseIcon from '@mui/icons-material/Close';import { connect } from 'react-redux';+import { cleanFrontDirSeparator } from '@tagspaces/tagspaces-common/paths';import { bindActionCreators } from 'redux';import Typography from '@mui/material/Typography';import Box from '@mui/material/Box';@@ -33,12 +34,15 @@ import PlatformIO from '-/services/platform-facade';import {actions as AppActions,getCurrentDirectoryPerspective,+ getDirectoryPath,getProgress} from '-/reducers/app';import { extractFileName } from '@tagspaces/tagspaces-common/paths';import i18n from '-/services/i18n';import DialogCloseButton from '-/components/dialogs/DialogCloseButton';import { PerspectiveIDs } from '-/perspectives';+import { getCurrentLocation } from '-/reducers/locations';+import { TS } from '-/tagspaces.namespace';interface Props {open: boolean;@@ -46,6 +50,13 @@ interface Props {onClose: () => void;clearUploadDialog: () => void;currentDirectoryPerspective: string;+ currentDirectoryPath: string;+ currentLocation: TS.Location;+ loadDirectoryContent: (+ path: string,+ generateThumbnails: boolean,+ loadDirMeta?: boolean+ ) => void;}function FileUploadDialog(props: Props) {@@ -80,6 +91,39 @@ function FileUploadDialog(props: Props) {let haveProgress = false;+ function getTargetURL() {+ if (props.currentLocation) {+ if (props.currentLocation.endpointURL) {+ return (+ props.currentLocation.endpointURL ++ (props.currentLocation.path+ ? '/' + cleanFrontDirSeparator(props.currentLocation.path)+ : '') ++ (props.currentDirectoryPath+ ? '/' + cleanFrontDirSeparator(props.currentDirectoryPath)+ : '')+ );+ } else if (+ props.currentLocation.region &&+ props.currentLocation.bucketName+ ) {+ return (+ 'https://s3.' ++ props.currentLocation.region ++ '.amazonaws.com/' ++ props.currentLocation.bucketName ++ (props.currentLocation.path+ ? '/' + cleanFrontDirSeparator(props.currentLocation.path)+ : '') ++ (props.currentDirectoryPath+ ? '/' + cleanFrontDirSeparator(props.currentDirectoryPath)+ : '')+ );+ }+ }+ return props.currentDirectoryPath ? props.currentDirectoryPath : '/';+ }+return (<Dialogopen={open}@@ -102,6 +146,7 @@ function FileUploadDialog(props: Props) {flexGrow: 1}}>+ <p>{i18n.t('core:moveCopyToPath') + ': ' + getTargetURL()}</p>{props.progress &&props.progress.sort((a, b) => ('' + a.path).localeCompare(b.path))@@ -160,8 +205,9 @@ function FileUploadDialog(props: Props) {data-tid="uploadCloseDialog"onClick={() => {onClose();+ props.clearUploadDialog();if (props.currentDirectoryPerspective === PerspectiveIDs.GRID) {- props.clearUploadDialog();+ props.loadDirectoryContent(props.currentDirectoryPath, false);}}}color="primary"@@ -193,14 +239,17 @@ function FileUploadDialog(props: Props) {function mapStateToProps(state) {return {progress: getProgress(state),- currentDirectoryPerspective: getCurrentDirectoryPerspective(state)+ currentDirectoryPerspective: getCurrentDirectoryPerspective(state),+ currentDirectoryPath: getDirectoryPath(state),+ currentLocation: getCurrentLocation(state)};}function mapDispatchToProps(dispatch) {return bindActionCreators({- clearUploadDialog: AppActions.clearUploadDialog+ clearUploadDialog: AppActions.clearUploadDialog,+ loadDirectoryContent: AppActions.loadDirectoryContent},dispatch);diff --git a/app/reducers/app.ts b/app/reducers/app.tsindex 0209e8796..0a1a92b76 100644--- a/app/reducers/app.ts+++ b/app/reducers/app.ts@@ -1142,15 +1142,15 @@ export const actions = {dirs}),clearUploadDialog: () => (- dispatch: (action) => void,- getState: () => any+ dispatch: (action) => void+ // getState: () => any) => {// const currentLocation: Location = getState().locations.find(location => location.uuid === getCurrentLocationId(getState()))if (PlatformIO.haveObjectStoreSupport()) {// && currentLocation.type === locationType.TYPE_AMPLIFY) {- const { currentDirectoryPath } = getState().app;dispatch(actions.clearUploadDialogInt());- dispatch(actions.loadDirectoryContent(currentDirectoryPath, false));+ // const { currentDirectoryPath } = getState().app;+ // dispatch(actions.loadDirectoryContent(currentDirectoryPath, false));}},clearUploadDialogInt: () => ({diff --git a/app/services/electron-menus.ts b/app/services/electron-menus.tsindex 85006b102..31f3dfaa9 100644--- a/app/services/electron-menus.ts+++ b/app/services/electron-menus.ts@@ -132,7 +132,9 @@ export default function buildDesktopMenu(props: any, i18n) {{label: i18n.t('showDevTools'),click: (item, focusedWindow) => {- focusedWindow.toggleDevTools();+ if (focusedWindow) {+ focusedWindow.toggleDevTools();+ }}},{