TagSpaces is an offline, open source, document manager with tagging support
added menu for manual index refresh
Ilian Sapundshiev19492ea2163f
diff --git a/app/components/LocationManager.js b/app/components/LocationManager.jsindex 504aa3f36..b9f902f80 100644--- a/app/components/LocationManager.js+++ b/app/components/LocationManager.js@@ -32,6 +32,7 @@ import FolderIcon from 'material-ui-icons/Folder';// import StartupFolderIcon from 'material-ui-icons/FolderSpecial';import AddIcon from 'material-ui-icons/Add';import EditIcon from 'material-ui-icons/Edit';+import RefreshIcon from 'material-ui-icons/Refresh';import DeleteIcon from 'material-ui-icons/DeleteForever';import CloseIcon from 'material-ui-icons/Close';import DefaultLocationIcon from 'material-ui-icons/LightbulbOutline';@@ -60,7 +61,7 @@ import { isObj } from '../utils/misc';type Props = {classes: Object,locations: Array<Location>,- perspectives: Array<string>,+ perspectives: Array<Object>,currentLocationId: string,loadDirectoryContent: (path: string) => void,openLocation: (path: string) => void,@@ -138,6 +139,13 @@ class LocationManager extends React.Component<Props, State> {});};+ indexLocation = () => {+ this.handleRequestCloseContextMenus();+ if (this.state.selectedLocation && this.state.selectedLocation.uuid) {+ this.props.createDirectoryIndex(this.state.selectedLocation.paths[0]);+ }+ };+moveLocationUp = () => {this.handleRequestCloseContextMenus();if (this.state.selectedLocation && this.state.selectedLocation.uuid) {@@ -327,7 +335,6 @@ class LocationManager extends React.Component<Props, State> {onClose={this.handleCloseDialogs}location={this.state.selectedLocation}editLocation={this.props.editLocation}- createDirectoryIndex={this.props.createDirectoryIndex}perspectives={this.props.perspectives}showSelectDirectoryDialog={this.showSelectDirectoryDialog}selectedDirectoryPath={this.state.selectedDirectoryPath}@@ -375,6 +382,17 @@ class LocationManager extends React.Component<Props, State> {</ListItemIcon><ListItemText inset primary={i18n.t('core:editLocationTitle')} /></MenuItem>+ { this.state.selectedLocation && this.props.currentLocationId === this.state.selectedLocation.uuid && (+ <MenuItem+ data-tid="indexLocation"+ onClick={this.indexLocation}+ >+ <ListItemIcon>+ <RefreshIcon />+ </ListItemIcon>+ <ListItemText inset primary={i18n.t('core:indexLocation')} />+ </MenuItem>+ )}<MenuItem data-tid="moveLocationUp" onClick={this.moveLocationUp}><ListItemIcon><ArrowUpwardIcon />diff --git a/app/components/dialogs/EditLocationDialog.js b/app/components/dialogs/EditLocationDialog.jsindex 533b1e0bb..645d406ef 100644--- a/app/components/dialogs/EditLocationDialog.js+++ b/app/components/dialogs/EditLocationDialog.js@@ -43,8 +43,7 @@ type Props = {onClose: () => void,location?: Location | null,editLocation: (location: Location) => void,- createDirectoryIndex: (path: string) => void,- perspectives: Array<string>,+ perspectives: Array<Object>,showSelectDirectoryDialog: () => void,selectedDirectoryPath?: string | null};@@ -154,14 +153,6 @@ class EditLocationDialog extends React.Component<Props, State> {}};- onIndexLocation = () => {- this.handleValidation();- if (this.state.path && this.state.path.length > 0 && this.state.name && this.state.name.length > 0) {- this.props.createDirectoryIndex(this.state.path);- this.props.onClose();- }- };-renderTitle = () => (<DialogTitle>{i18n.t('core:editLocationTitle')}</DialogTitle>);@@ -276,12 +267,6 @@ class EditLocationDialog extends React.Component<Props, State> {renderActions = () => (<DialogActions>- <Button- data-tid="closeEditLocationDialog"- onClick={this.onIndexLocation}- >- {i18n.t('core:indexLocation')}- </Button><Buttondata-tid="closeEditLocationDialog"color="primary"diff --git a/app/locales/en/core.json b/app/locales/en/core.jsonindex 718c4a108..d89a612ec 100644--- a/app/locales/en/core.json+++ b/app/locales/en/core.json@@ -316,6 +316,7 @@"showHideDirectories": "Show / hide directories","sort": "Sort","thirdPartyLibs": "Third Party Libraries",+ "indexLocation": "Refresh Location Index","readonlyModeSwitch": "Open location in readonly mode","persistIndexSwitch": "Switch to manual index creation with persisted search index","-": "-"