TagSpaces is an offline, open source, document manager with tagging support
add close and clear button in the upload status dialog (#1229)
Stanimira79825ce1f26
diff --git a/app/components/dialogs/FileUploadDialog.tsx b/app/components/dialogs/FileUploadDialog.tsxindex ebffd16c4..c760a94ea 100644--- a/app/components/dialogs/FileUploadDialog.tsx+++ b/app/components/dialogs/FileUploadDialog.tsx@@ -29,14 +29,16 @@ import { LinearProgress, Grid, Tooltip } from '@material-ui/core';import CloseIcon from '@material-ui/icons/Close';import WarningIcon from '@material-ui/icons/Warning';import PlatformIO from '-/services/platform-io';-import { getProgress } from '-/reducers/app';+import { actions as AppActions, getProgress } from '-/reducers/app';import { extractFileName } from '-/utils/paths';import i18n from '-/services/i18n';+import { bindActionCreators } from 'redux';interface Props {open: boolean;progress?: Array<any>;onClose: () => void;+ clearUploadDialog: () => void;}const FileUploadDialog = (props: Props) => {@@ -148,12 +150,21 @@ const FileUploadDialog = (props: Props) => {})}</DialogContent><DialogActions>+ {!haveProgress && (+ <Button+ data-tid="uploadCloseDialog"+ onClick={props.clearUploadDialog}+ color="primary"+ >+ {i18n.t('core:closeAndClear')}+ </Button>+ )}<Buttondata-tid="uploadCloseDialog"onClick={props.onClose}color="primary">- {i18n.t('core:close')}+ {i18n.t('core:minimize')}</Button>{haveProgress && (<Button@@ -175,4 +186,13 @@ function mapStateToProps(state) {};}-export default connect(mapStateToProps)(FileUploadDialog);+function mapDispatchToProps(dispatch) {+ return bindActionCreators(+ {+ clearUploadDialog: AppActions.clearUploadDialog+ },+ dispatch+ );+}++export default connect(mapStateToProps, mapDispatchToProps)(FileUploadDialog);diff --git a/app/locales/en/core.json b/app/locales/en/core.jsonindex b35cf35a5..63a2b79fb 100644--- a/app/locales/en/core.json+++ b/app/locales/en/core.json@@ -278,6 +278,8 @@"moveDown": "Move Down","chooseSearchQuery": "Choose a search query","closeButton": "Close",+ "minimize": "Minimize",+ "closeAndClear": "Close & Clear","addNewFileType": "Add new file type","dropHere": "Drop tags here","confirmFileTypeDeletion": "Do you want to delete this file type?",diff --git a/app/reducers/app.ts b/app/reducers/app.tsindex f97fd1b72..f059e504a 100644--- a/app/reducers/app.ts+++ b/app/reducers/app.ts@@ -89,6 +89,7 @@ export const types = {TOGGLE_CREATE_FILE_DIALOG: 'APP/TOGGLE_CREATE_FILE_DIALOG',TOGGLE_SELECT_DIRECTORY_DIALOG: 'APP/TOGGLE_SELECT_DIRECTORY_DIALOG',TOGGLE_UPLOAD_DIALOG: 'APP/TOGGLE_UPLOAD_DIALOG',+ CLEAR_UPLOAD_DIALOG: 'APP/CLEAR_UPLOAD_DIALOG',TOGGLE_PROGRESS_DIALOG: 'APP/TOGGLE_PROGRESS_DIALOG',OPEN_LOCATIONMANAGER_PANEL: 'APP/OPEN_LOCATIONMANAGER_PANEL',OPEN_TAGLIBRARY_PANEL: 'APP/OPEN_TAGLIBRARY_PANEL',@@ -347,6 +348,17 @@ export default (state: any = initialState, action: any) => {}return state;}+ case types.CLEAR_UPLOAD_DIALOG: {+ if (PlatformIO.haveObjectStoreSupport()) {+ // upload dialog have objectStore support only+ return {+ ...state,+ progress: [],+ uploadDialogOpened: false+ };+ }+ return state;+ }case types.TOGGLE_PROGRESS_DIALOG: {return {...state,@@ -757,6 +769,9 @@ export const actions = {toggleUploadDialog: () => ({type: types.TOGGLE_UPLOAD_DIALOG}),+ clearUploadDialog: () => ({+ type: types.CLEAR_UPLOAD_DIALOG+ }),toggleProgressDialog: () => ({type: types.TOGGLE_PROGRESS_DIALOG}),