TagSpaces is an offline, open source, document manager with tagging support
added extra activity indicator for thumb generation
Ilian Sapundshiev8b30c80b6f6d
diff --git a/app/containers/MainPage.js b/app/containers/MainPage.jsindex 4ea29f86c..e1cd200a0 100644--- a/app/containers/MainPage.js+++ b/app/containers/MainPage.js@@ -49,6 +49,7 @@ import {import {actions as AppActions,getNotificationStatus,+ isGeneratingThumbs,isFileOpened,// isFileDragged,isEntryInFullWidth,@@ -107,6 +108,7 @@ type Props = {isFileOpened: boolean,// isFileDragged: boolean,isIndexing: boolean,+ isGeneratingThumbs: boolean,isEntryInFullWidth: boolean,classes: Object,notificationStatus: Object,@@ -469,6 +471,21 @@ class MainPage extends Component<Props, State> {</IconButton>,]}/>+ <Snackbar+ anchorOrigin={{ vertical: 'top', horizontal: 'center' }}+ open={this.props.isGeneratingThumbs}+ autoHideDuration={undefined}+ message={'Loading or generating thumbnails...'}+ action={[+ // <Button+ // color="secondary"+ // size="small"+ // onClick={this.props.cancelDirectoryIndexing}+ // >+ // Cancel indexing+ // </Button>+ ]}+ /><SnackbaranchorOrigin={{ vertical: 'top', horizontal: 'center' }}open={this.props.isIndexing}@@ -522,6 +539,7 @@ class MainPage extends Component<Props, State> {function mapStateToProps(state) {return {isIndexing: isIndexing(state),+ isGeneratingThumbs: isGeneratingThumbs(state),isFileOpened: isFileOpened(state),// isFileDragged: isFileDragged(state),isEntryInFullWidth: isEntryInFullWidth(state),diff --git a/app/reducers/app.js b/app/reducers/app.jsindex ed4ec3f3d..6b291b988 100644--- a/app/reducers/app.js+++ b/app/reducers/app.js@@ -59,6 +59,7 @@ export const types = {UPDATE_THUMB_URL: 'APP/UPDATE_THUMB_URL',UPDATE_THUMB_URLS: 'APP/UPDATE_THUMB_URLS',SET_NOTIFICATION: 'APP/SET_NOTIFICATION',+ SET_GENERATING_THUMBNAILS: 'APP/SET_GENERATING_THUMBNAILS',SET_NEW_VERSION_AVAILABLE: 'APP/SET_NEW_VERSION_AVAILABLE',SET_CURRENLOCATIONID: 'APP/SET_CURRENLOCATIONID',SET_LAST_SELECTED_ENTRY: 'APP/SET_LAST_SELECTED_ENTRY',@@ -131,7 +132,8 @@ export const initialState = {createDirectoryDialogOpened: false,selectDirectoryDialogOpened: false,lastSelectedEntry: null,- isEntryInFullWidth: false+ isEntryInFullWidth: false,+ isGeneratingThumbs: false};// The state described here will not be persisted@@ -236,6 +238,12 @@ export default (state: Object = initialState, action: Object) => {}};}+ case types.SET_GENERATING_THUMBNAILS: {+ return {+ ...state,+ isGeneratingThumbs: action.isGeneratingThumbs+ };+ }case types.OPEN_FILE: {return {...state,@@ -618,7 +626,7 @@ export const actions = {) => (dispatch: (actions: Object) => void) => {- // dispatch(actions.hideNotifications()); // relaying on the tmb generation hiding+ dispatch(actions.hideNotifications());dispatch(actions.loadDirectorySuccessInt(directoryPath, directoryContent));},loadDirectorySuccessInt: (@@ -648,6 +656,10 @@ export const actions = {type: types.UPDATE_THUMB_URLS,tmbURLs}),+ setGeneratingThumbnails: (isGeneratingThumbs: boolean) => ({+ type: types.SET_GENERATING_THUMBNAILS,+ isGeneratingThumbs+ }),setLastSelectedEntry: (entryPath: string | null) => ({type: types.SET_LAST_SELECTED_ENTRY,entryPath@@ -1197,7 +1209,8 @@ function prepareDirectoryContent(}return true;});- dispatch(actions.hideNotifications());+ dispatch(actions.setGeneratingThumbnails(false));+ // dispatch(actions.hideNotifications());if (tmbURLs.length > 0) {dispatch(actions.updateThumbnailUrls(tmbURLs));}@@ -1206,18 +1219,21 @@ function prepareDirectoryContent(function handleTmbGenerationFailed(error) {console.warn('Thumb generation failed: ' + error);+ dispatch(actions.setGeneratingThumbnails(false));dispatch(actions.showNotification('Generating thumbnails failed', 'warning', true));}if (tmbGenerationPromises.length > 0) {- dispatch(actions.showNotification('Checking thumbnails', 'info', false));+ dispatch(actions.setGeneratingThumbnails(true));+ // dispatch(actions.showNotification('Checking thumbnails', 'info', false));Promise.all(tmbGenerationPromises).then(handleTmbGenerationResults).catch(handleTmbGenerationFailed);}if (tmbGenerationList.length > 0) {- dispatch(actions.showNotification('Loading or generating thumbnails...', 'info', false));+ dispatch(actions.setGeneratingThumbnails(true));+ // dispatch(actions.showNotification('Loading or generating thumbnails...', 'info', false));PlatformIO.createThumbnailsInWorker(tmbGenerationList).then(handleTmbGenerationResults).catch(handleTmbGenerationFailed);@@ -1316,6 +1332,7 @@ export const isUpdateInProgress = (state: Object) =>export const isOnline = (state: Object) => state.app.isOnline;export const getLastSelectedEntry = (state: Object) => state.app.lastSelectedEntry;export const isFileOpened = (state: Object) => state.app.openedFiles.length > 0;+export const isGeneratingThumbs = (state: Object) => state.app.isGeneratingThumbs;// export const isFileDragged = (state: Object) => state.app.isFileDragged;export const isReadOnlyMode = (state: Object) => state.app.isReadOnlyMode;export const isAboutDialogOpened = (state: Object) => state.app.aboutDialogOpened;