Skip to content

TagSpaces is an offline, open source, document manager with tagging support

Enable move directories v2 (#1897)

Stanimir19b4e18088f8
diff --git a/app/components/CommonIcons.tsx b/app/components/CommonIcons.tsx
index 07f1d67a9..7f55abb4f 100644
--- a/app/components/CommonIcons.tsx
+++ b/app/components/CommonIcons.tsx
@@ -17,26 +17,7 @@
*/
import React from 'react';
-import ParentFolder from '@mui/icons-material/ReplyOutlined';
-import Help from '@mui/icons-material/Help';
-import InfoOutlined from '@mui/icons-material/InfoOutlined';
-import Info from '@mui/icons-material/Info';
-import AnnouncementIcon from '@mui/icons-material/AnnouncementOutlined';
-import Remove from '@mui/icons-material/RemoveCircleOutline';
-import History from '@mui/icons-material/ChangeHistoryTwoTone';
-import Settings from '@mui/icons-material/Settings';
-import AddIcon from '@mui/icons-material/Add';
-import Suitcase from '@mui/icons-material/WorkOutline';
-import Link from '@mui/icons-material/Link';
-import KeyShortcuts from '@mui/icons-material/Keyboard';
-import Menu from '@mui/icons-material/Menu';
-import ArrowBack from '@mui/icons-material/ArrowBack';
-import ArrowForward from '@mui/icons-material/ArrowForward';
-import Folder from '@mui/icons-material/Folder';
-import File from '@mui/icons-material/InsertDriveFile';
import KeyboardReturnIcon from '@mui/icons-material/KeyboardReturn';
-import SubdirectoryArrowLeftIcon from '@mui/icons-material/SubdirectoryArrowLeft';
-import Cancel from '@mui/icons-material/DoDisturbOn';
export const ParentFolderIcon = props => (
<KeyboardReturnIcon style={{ transform: 'rotate(90deg)' }} />
@@ -45,36 +26,36 @@ export const ParentFolderIcon = props => (
export const NavigateToFolderIcon = props => <KeyboardReturnIcon />;
-export const FolderIcon = props => <Folder {...props} />;
+export { default as InfoTooltipIcon } from '@mui/icons-material/InfoOutlined';
-export const FileIcon = props => <File {...props} />;
+export { default as FolderIcon } from '@mui/icons-material/Folder';
-export const MainMenuIcon = props => <Menu {...props} />;
+export { default as FileIcon } from '@mui/icons-material/InsertDriveFile';
-export const GoBackIcon = props => <ArrowBack {...props} />;
+export { default as MainMenuIcon } from '@mui/icons-material/Menu';
-export const GoForwardIcon = props => <ArrowForward {...props} />;
+export { default as GoBackIcon } from '@mui/icons-material/ArrowBack';
-export const HelpIcon = props => <Help {...props} />;
+export { default as GoForwardIcon } from '@mui/icons-material/ArrowForward';
-export const InfoIcon = props => <AnnouncementIcon {...props} />;
+export { default as HelpIcon } from '@mui/icons-material/Help';
-export const InfoTooltipIcon = props => <InfoOutlined {...props} />;
+export { default as InfoIcon } from '@mui/icons-material/AnnouncementOutlined';
-export const FolderPropertiesIcon = props => <Info {...props} />;
+export { default as FolderPropertiesIcon } from '@mui/icons-material/Info';
-export const RemoveIcon = props => <Remove {...props} />;
+export { default as RemoveIcon } from '@mui/icons-material/Remove';
-export const HistoryIcon = props => <History {...props} />;
+export { default as HistoryIcon } from '@mui/icons-material/History';
-export const PerspectiveSettingsIcon = props => <Settings {...props} />;
+export { default as PerspectiveSettingsIcon } from '@mui/icons-material/Settings';
-export const CreateFileIcon = props => <AddIcon {...props} />;
+export { default as CreateFileIcon } from '@mui/icons-material/Add';
-export const LocalLocationIcon = props => <Suitcase {...props} />;
+export { default as LocalLocationIcon } from '@mui/icons-material/WorkOutline';
-export const OpenLinkIcon = props => <Link {...props} />;
+export { default as OpenLinkIcon } from '@mui/icons-material/Link';
-export const KeyShortcutsIcon = props => <KeyShortcuts {...props} />;
+export { default as KeyShortcutsIcon } from '@mui/icons-material/Keyboard';
-export const CancelIcon = props => <Cancel {...props} />;
+export { default as CancelIcon } from '@mui/icons-material/Cancel';
diff --git a/app/components/DirectoryListView.tsx b/app/components/DirectoryListView.tsx
index 192427db1..c4c2f5c3a 100644
--- a/app/components/DirectoryListView.tsx
+++ b/app/components/DirectoryListView.tsx
@@ -1,5 +1,8 @@
import React, { useRef, useState, useEffect } from 'react';
import { connect } from 'react-redux';
+import { bindActionCreators } from 'redux';
+import Button from '@mui/material/Button';
+import NewFolderIcon from '@mui/icons-material/CreateNewFolder';
import Select from '@mui/material/Select';
import MenuItem from '@mui/material/MenuItem';
import List from '@mui/material/List';
@@ -12,7 +15,7 @@ import { extractContainingDirectoryPath } from '@tagspaces/tagspaces-common/path
import AppConfig from '-/AppConfig';
import i18n from '-/services/i18n';
import { TS } from '-/tagspaces.namespace';
-import { getCurrentLocationId } from '-/reducers/app';
+import { actions as AppActions, getCurrentLocationId } from '-/reducers/app';
import { ParentFolderIcon } from '-/components/CommonIcons';
import { getLocations } from '-/reducers/locations';
import PlatformIO from '-/services/platform-facade';
@@ -21,6 +24,7 @@ interface Props {
setTargetDir: (dirPath: string) => void;
locations: Array<TS.Location>;
currentLocationId: string;
+ toggleCreateDirectoryDialog: (props: any) => void;
}
function DirectoryListView(props: Props) {
const { locations, currentLocationId } = props;
@@ -45,12 +49,17 @@ function DirectoryListView(props: Props) {
location => location.uuid === chosenLocationId.current
);
if (chosenLocation) {
- props.setTargetDir(chosenLocation.path);
listDirectory(chosenLocation.path);
}
};
function getLocations() {
+ const currentLocation = locations.find(
+ location => location.uuid === chosenLocationId.current
+ );
+ if (currentLocation.type !== locationType.TYPE_LOCAL) {
+ return null;
+ }
return (
<Select
onChange={handleLocationChange}
@@ -77,7 +86,12 @@ function DirectoryListView(props: Props) {
)
.then(results => {
if (results !== undefined) {
- setDirectoryContent(results.filter(entry => !entry.isFile));
+ setDirectoryContent(
+ results
+ .filter(entry => !entry.isFile)
+ .sort((a, b) => b.lmdt - a.lmdt)
+ );
+ props.setTargetDir(directoryPath);
}
return true;
})
@@ -114,6 +128,36 @@ function DirectoryListView(props: Props) {
return (
<div style={{ marginTop: 10 }}>
{getLocations()}
+ <Button
+ variant="outlined"
+ startIcon={<ParentFolderIcon />}
+ style={{ backgroundColor: '#fefefe80', margin: 5 }}
+ onClick={() => {
+ if (chosenDirectory.current) {
+ let currentPath = chosenDirectory.current;
+ if (currentPath.endsWith(PlatformIO.getDirSeparator())) {
+ currentPath = currentPath.slice(0, -1);
+ }
+ listDirectory(extractContainingDirectoryPath(currentPath));
+ }
+ }}
+ >
+ {i18n.t('core:navigateToParentDirectory')}
+ </Button>
+ <Button
+ variant="outlined"
+ startIcon={<NewFolderIcon />}
+ style={{ backgroundColor: '#fefefe80', margin: 5 }}
+ onClick={() => {
+ props.toggleCreateDirectoryDialog({
+ rootDirPath: chosenDirectory.current,
+ callback: () => listDirectory(chosenDirectory.current),
+ reflect: false
+ });
+ }}
+ >
+ {i18n.t('core:newSubdirectory')}
+ </Button>
<List
dense
style={{
@@ -123,21 +167,6 @@ function DirectoryListView(props: Props) {
overflowY: AppConfig.isFirefox ? 'auto' : 'overlay'
}}
>
- <ListItem
- title={i18n.t('core:navigateToParentDirectory')}
- style={{ maxWidth: 250 }}
- button
- onClick={() => {
- listDirectory(
- extractContainingDirectoryPath(chosenDirectory.current)
- );
- }}
- >
- <ListItemIcon style={{ minWidth: 35 }}>
- <ParentFolderIcon />
- </ListItemIcon>
- <ListItemText primary={i18n.t('core:navigateToParentDirectory')} />
- </ListItem>
{getFolderContent()}
</List>
</div>
@@ -151,4 +180,16 @@ function mapStateToProps(state) {
};
}
-export default connect(mapStateToProps)(DirectoryListView);
+function mapActionCreatorsToProps(dispatch) {
+ return bindActionCreators(
+ {
+ toggleCreateDirectoryDialog: AppActions.toggleCreateDirectoryDialog
+ },
+ dispatch
+ );
+}
+
+export default connect(
+ mapStateToProps,
+ mapActionCreatorsToProps
+)(DirectoryListView);
diff --git a/app/components/EntryProperties.tsx b/app/components/EntryProperties.tsx
index 5debe7c8c..0396e6edc 100644
--- a/app/components/EntryProperties.tsx
+++ b/app/components/EntryProperties.tsx
@@ -258,17 +258,23 @@ function EntryProperties(props: Props) {
const [displayColorPicker, setDisplayColorPicker] = useState<boolean>(false);
const bgndUrl = useRef<string>(getBgndUrl());
const thumbUrl = useRef<string>(getThumbUrl());
+ const dirProps = useRef<TS.DirProp>();
const [ignored, forceUpdate] = useReducer(x => x + 1, 0);
const firstRender = useFirstRender();
useEffect(() => {
if (!currentEntry.current.isFile) {
- PlatformIO.getDirProperties(currentEntry.current.path).then(
- (dirProps: TS.DirProp) => {
- currentEntry.current.size = dirProps.totalSize;
- forceUpdate();
- }
- );
+ try {
+ PlatformIO.getDirProperties(currentEntry.current.path).then(
+ (dProps: TS.DirProp) => {
+ dirProps.current = dProps;
+ currentEntry.current.size = dProps.totalSize;
+ forceUpdate();
+ }
+ );
+ } catch (ex) {
+ console.debug('getDirProperties:', ex);
+ }
}
}, []);
@@ -963,19 +969,38 @@ function EntryProperties(props: Props) {
/>
</Grid>
<Grid item xs={6}>
- <TextField
- margin="dense"
- fullWidth={true}
- value={
- currentEntry.current.size
- ? formatBytes(currentEntry.current.size)
- : i18n.t('core:notAvailable')
+ <Tooltip
+ title={
+ !PlatformIO.haveObjectStoreSupport() &&
+ dirProps.current &&
+ !currentEntry.current.isFile &&
+ i18n.t('core:directories') +
+ ': ' +
+ dirProps.current.dirsCount +
+ ' ' +
+ i18n.t('core:files') +
+ ': ' +
+ dirProps.current.filesCount
}
- label={i18n.t('core:fileSize')}
- InputProps={{
- readOnly: true
- }}
- />
+ >
+ <TextField
+ margin="dense"
+ fullWidth={true}
+ value={
+ currentEntry.current.size
+ ? formatBytes(currentEntry.current.size)
+ : i18n.t(
+ PlatformIO.haveObjectStoreSupport()
+ ? 'core:notAvailable'
+ : 'core:counting'
+ )
+ }
+ label={i18n.t('core:fileSize')}
+ InputProps={{
+ readOnly: true
+ }}
+ />
+ </Tooltip>
</Grid>
</Grid>
diff --git a/app/components/dialogs/CreateDirectoryDialog.tsx b/app/components/dialogs/CreateDirectoryDialog.tsx
index 151eda793..fa92c0267 100644
--- a/app/components/dialogs/CreateDirectoryDialog.tsx
+++ b/app/components/dialogs/CreateDirectoryDialog.tsx
@@ -39,7 +39,12 @@ interface Props {
open: boolean;
onClose: () => void;
selectedDirectoryPath: string;
- createDirectory: (directoryPath: string) => void;
+ createDirectory: (
+ directoryPath: string,
+ reflect: boolean
+ ) => Promise<boolean>;
+ callback?: () => void;
+ reflect?: boolean;
}
function CreateDirectoryDialog(props: Props) {
@@ -47,7 +52,7 @@ function CreateDirectoryDialog(props: Props) {
const isFirstRun = useRef(true);
const [disableConfirmButton, setDisableConfirmButton] = useState(true);
const [name, setName] = useState('');
- const { open, onClose } = props;
+ const { open, onClose, reflect } = props;
useEffect(() => {
if (isFirstRun.current) {
@@ -76,7 +81,9 @@ function CreateDirectoryDialog(props: Props) {
props.selectedDirectoryPath,
name
);
- props.createDirectory(dirPath);
+ props
+ .createDirectory(dirPath, reflect !== undefined ? reflect : true)
+ .then(() => props.callback());
resetState();
props.onClose();
}
@@ -155,6 +162,7 @@ function CreateDirectoryDialog(props: Props) {
}
function mapActionCreatorsToProps(dispatch) {
+ //: Dispatch<CreateDirectoryAction>) {
return bindActionCreators(
{
createDirectory: AppActions.createDirectory
@@ -166,4 +174,5 @@ function mapActionCreatorsToProps(dispatch) {
export default connect(
undefined,
mapActionCreatorsToProps
+ // @ts-ignore
)(CreateDirectoryDialog);
diff --git a/app/components/dialogs/CreateEditLocationDialog.tsx b/app/components/dialogs/CreateEditLocationDialog.tsx
index 96cbb2bf8..c62573792 100644
--- a/app/components/dialogs/CreateEditLocationDialog.tsx
+++ b/app/components/dialogs/CreateEditLocationDialog.tsx
@@ -66,7 +66,7 @@ import InfoIcon from '-/components/InfoIcon';
import { ProLabel, BetaLabel, ProTooltip } from '-/components/HelperComponents';
import { actions as LocationActions, getLocations } from '-/reducers/locations';
import { NotificationTypes, actions as AppActions } from '-/reducers/app';
-import { getPersistTagsInSidecarFile } from '-/reducers/settings';
+import { getPersistTagsInSidecarFile, isDevMode } from '-/reducers/settings';
import ConfirmDialog from '-/components/dialogs/ConfirmDialog';
import { actions as LocationIndexActions } from '-/reducers/location-index';
import PlatformIO from '-/services/platform-facade';
@@ -98,6 +98,7 @@ interface Props {
notificationType?: string, // NotificationTypes
autohide?: boolean
) => void;
+ isDevMode: boolean;
}
function CreateEditLocationDialog(props: Props) {
@@ -554,7 +555,7 @@ function CreateEditLocationDialog(props: Props) {
<MenuItem key="TYPE_CLOUD" value={locationType.TYPE_CLOUD}>
{i18n.t('core:objectStorage') + ' (AWS, MinIO, Wasabi,...)'}
</MenuItem>
- {Pro && (
+ {Pro && props.isDevMode && (
<MenuItem
key="TYPE_WEBDAV"
value={locationType.TYPE_WEBDAV}
@@ -958,7 +959,8 @@ function CreateEditLocationDialog(props: Props) {
function mapStateToProps(state) {
return {
isPersistTagsInSidecar: getPersistTagsInSidecarFile(state),
- locations: getLocations(state)
+ locations: getLocations(state),
+ isDevMode: isDevMode(state)
};
}
diff --git a/app/components/dialogs/FileUploadDialog.tsx b/app/components/dialogs/FileUploadDialog.tsx
index 148d9ece2..6f25cd75b 100644
--- a/app/components/dialogs/FileUploadDialog.tsx
+++ b/app/components/dialogs/FileUploadDialog.tsx
@@ -62,7 +62,7 @@ interface Props {
function FileUploadDialog(props: Props) {
const { open = false, onClose } = props;
- const targetPath = React.useRef<string>(undefined);
+ const targetPath = React.useRef<string>(getTargetPath());
function LinearProgressWithLabel(prop) {
return (
@@ -93,6 +93,14 @@ function FileUploadDialog(props: Props) {
let haveProgress = false;
+ function getTargetPath() {
+ const pathProgress = props.progress.find(fileProgress => fileProgress.path);
+ if (pathProgress) {
+ return pathProgress.path;
+ }
+ return undefined;
+ }
+
function getTargetURL() {
if (props.currentLocation) {
if (props.currentLocation.endpointURL) {
@@ -164,12 +172,8 @@ function FileUploadDialog(props: Props) {
.sort((a, b) => ('' + a.path).localeCompare(b.path))
.map(fileProgress => {
const percentage = fileProgress.progress;
- const { path } = fileProgress;
+ const { path, filePath } = fileProgress;
targetPath.current = path.split('?')[0];
- const fileName = extractFileName(
- targetPath.current,
- PlatformIO.getDirSeparator()
- );
let { abort } = fileProgress;
if (percentage > -1 && percentage < 100) {
haveProgress = true;
@@ -187,9 +191,18 @@ function FileUploadDialog(props: Props) {
<Grid
item
xs={10}
- style={{ display: 'flex', alignItems: 'center' }}
+ style={{
+ display: 'flex',
+ alignItems: 'center',
+ wordBreak: 'break-word'
+ }}
>
- {fileName}
+ {filePath
+ ? filePath
+ : extractFileName(
+ targetPath.current,
+ PlatformIO.getDirSeparator()
+ )}
{percentage === -1 && (
<Tooltip title={i18n.t('core:fileExist')}>
<WarningIcon color="secondary" />
diff --git a/app/components/dialogs/MoveCopyFilesDialog.tsx b/app/components/dialogs/MoveCopyFilesDialog.tsx
index 3a37dd239..4c69edc3f 100644
--- a/app/components/dialogs/MoveCopyFilesDialog.tsx
+++ b/app/components/dialogs/MoveCopyFilesDialog.tsx
@@ -67,7 +67,7 @@ interface Props {
}
function MoveCopyFilesDialog(props: Props) {
- const [disableConfirmButton, setDisableConfirmButton] = useState(true);
+ // const [disableConfirmButton, setDisableConfirmButton] = useState(true);
const [targetPath, setTargetPath] = useState('');
const dirProp = useRef({});
@@ -101,17 +101,17 @@ function MoveCopyFilesDialog(props: Props) {
}
}, []);
- useEffect(() => {
+ /*useEffect(() => {
handleValidation();
- }, [targetPath]);
+ }, [targetPath]);*/
- function handleValidation() {
+ /*function handleValidation() {
if (targetPath && targetPath.length > 0) {
setDisableConfirmButton(false);
} else {
setDisableConfirmButton(true);
}
- }
+ }*/
function getEntriesCount(): number {
let total = 0;
@@ -121,43 +121,41 @@ function MoveCopyFilesDialog(props: Props) {
}
function handleCopyFiles() {
- if (!disableConfirmButton) {
- if (selectedFiles.length > 0) {
- props.copyFiles(selectedFiles, targetPath);
- setDisableConfirmButton(true);
- setTargetPath('');
- }
- if (selectedDirs.length > 0) {
- props.resetProgress();
- props.toggleUploadDialog('copyEntriesTitle');
- props.copyDirs(
- selectedDirs,
- getEntriesCount(),
- targetPath,
- props.onUploadProgress
- );
- }
+ //if (!disableConfirmButton) {
+ if (selectedFiles.length > 0) {
+ props.copyFiles(selectedFiles, targetPath);
+ //setDisableConfirmButton(true);
+ setTargetPath('');
+ }
+ if (selectedDirs.length > 0) {
+ props.resetProgress();
+ props.toggleUploadDialog('copyEntriesTitle');
+ props.copyDirs(
+ selectedDirs,
+ getEntriesCount(),
+ targetPath,
+ props.onUploadProgress
+ );
}
props.onClose(true);
}
function handleMoveFiles() {
- if (!disableConfirmButton) {
- if (selectedFiles.length > 0) {
- props.moveFiles(selectedFiles, targetPath);
- setDisableConfirmButton(true);
- setTargetPath('');
- }
- if (selectedDirs.length > 0) {
- props.resetProgress();
- props.toggleUploadDialog('moveEntriesTitle');
- props.moveDirs(
- selectedDirs,
- getEntriesCount(),
- targetPath,
- props.onUploadProgress
- );
- }
+ // if (!disableConfirmButton) {
+ if (selectedFiles.length > 0) {
+ props.moveFiles(selectedFiles, targetPath);
+ // setDisableConfirmButton(true);
+ setTargetPath('');
+ }
+ if (selectedDirs.length > 0) {
+ props.resetProgress();
+ props.toggleUploadDialog('moveEntriesTitle');
+ props.moveDirs(
+ selectedDirs,
+ getEntriesCount(),
+ targetPath,
+ props.onUploadProgress
+ );
}
props.onClose(true);
}
@@ -240,7 +238,7 @@ function MoveCopyFilesDialog(props: Props) {
</Button>
<Button
data-tid="confirmMoveFiles"
- disabled={disableConfirmButton}
+ disabled={!targetPath}
onClick={handleMoveFiles}
color="primary"
>
@@ -249,7 +247,7 @@ function MoveCopyFilesDialog(props: Props) {
<Button
onClick={handleCopyFiles}
data-tid="confirmCopyFiles"
- disabled={disableConfirmButton}
+ disabled={!targetPath}
color="primary"
>
{i18n.t('core:copyFilesButton')}
diff --git a/app/components/menus/DirectoryMenu.tsx b/app/components/menus/DirectoryMenu.tsx
index ca43d934e..0207d44a3 100644
--- a/app/components/menus/DirectoryMenu.tsx
+++ b/app/components/menus/DirectoryMenu.tsx
@@ -411,6 +411,7 @@ Do you want to continue?`)
}
const menuItems = getDirectoryMenuItems(
+ currentLocation,
props.selectedEntries.length,
props.lastSelectedEntryPath !== props.currentDirectoryPath,
props.isReadOnlyMode,
diff --git a/app/containers/MainPage.tsx b/app/containers/MainPage.tsx
index 3e2340a98..0f4e3369d 100644
--- a/app/containers/MainPage.tsx
+++ b/app/containers/MainPage.tsx
@@ -136,7 +136,7 @@ interface Props {
isReadOnlyMode: boolean;
isSettingsDialogOpened: boolean;
isCreateFileDialogOpened: boolean;
- isCreateDirectoryOpened: boolean;
+ isCreateDirectoryOpened: any;
toggleCreateDirectoryDialog: () => void;
isAboutDialogOpened: boolean;
isLocationDialogOpened: boolean;
@@ -764,11 +764,18 @@ function MainPage(props: Props) {
onClose={toggleProgressDialog}
/>
)}
- {props.isCreateDirectoryOpened && (
+ {props.isCreateDirectoryOpened !== null && (
<CreateDirectoryDialog
- open={props.isCreateDirectoryOpened}
+ open={true}
onClose={toggleCreateDirectoryDialog}
- selectedDirectoryPath={directoryPath}
+ selectedDirectoryPath={
+ props.isCreateDirectoryOpened &&
+ props.isCreateDirectoryOpened.rootDirPath
+ ? props.isCreateDirectoryOpened.rootDirPath
+ : directoryPath
+ }
+ callback={props.isCreateDirectoryOpened?.callback}
+ reflect={props.isCreateDirectoryOpened?.reflect}
/>
)}
{props.isCreateFileDialogOpened && (
@@ -1000,7 +1007,8 @@ const areEqual = (prevProp, nextProp) =>
JSON.stringify(prevProp.theme.palette) && */
nextProp.directoryPath === prevProp.directoryPath &&
nextProp.isAboutDialogOpened === prevProp.isAboutDialogOpened &&
- nextProp.isCreateDirectoryOpened === prevProp.isCreateDirectoryOpened &&
+ JSON.stringify(nextProp.isCreateDirectoryOpened) ===
+ JSON.stringify(prevProp.isCreateDirectoryOpened) &&
nextProp.isCreateFileDialogOpened === prevProp.isCreateFileDialogOpened &&
nextProp.isDeleteMultipleEntriesDialogOpened ===
prevProp.isDeleteMultipleEntriesDialogOpened &&
diff --git a/app/locales/en/core.json b/app/locales/en/core.json
index 2f76cf7e5..9596337d6 100644
--- a/app/locales/en/core.json
+++ b/app/locales/en/core.json
@@ -713,6 +713,7 @@
"changeBackgroundImage": "Change Background Image",
"noItems": "No items found",
"notAvailable": "Not available",
+ "counting": "counting...",
"clearBackground": "Clear background image",
"password": "Password",
"userAccount": "User Account",
@@ -771,5 +772,8 @@
"noSuitableLocation": "Files or folders can't be created. No suitable location found!",
"openEntry": "Open entry",
"openSearch": "Open search",
+ "copyingDirsFailed": "Copying Dirs Failed",
+ "directories": "Directories",
+ "files": "Files",
"-": "-"
}
diff --git a/app/package.json b/app/package.json
index 65599f99a..6790444e5 100644
--- a/app/package.json
+++ b/app/package.json
@@ -16,7 +16,7 @@
"@tagspaces/extensions": "1.0.78"
},
"nodeDependencies": {
- "@tagspaces/tagspaces-ws": "2.1.26",
+ "@tagspaces/tagspaces-ws": "2.1.27",
"@tagspaces/extensions": "1.0.78",
"sharp": "0.31.3"
}
diff --git a/app/perspectives/common/DirectoryMenuItems.tsx b/app/perspectives/common/DirectoryMenuItems.tsx
index 1d70d4d60..279b7d545 100644
--- a/app/perspectives/common/DirectoryMenuItems.tsx
+++ b/app/perspectives/common/DirectoryMenuItems.tsx
@@ -4,6 +4,7 @@ import OpenFolderIcon from '@mui/icons-material/SubdirectoryArrowLeft';
import MoveCopy from '@mui/icons-material/FileCopy';
import ListItemText from '@mui/material/ListItemText';
import i18n from '-/services/i18n';
+import { locationType } from '@tagspaces/tagspaces-common/misc';
import AutoRenew from '@mui/icons-material/Autorenew';
import RenameFolderIcon from '@mui/icons-material/FormatTextdirectionLToR';
import DeleteForeverIcon from '@mui/icons-material/DeleteForever';
@@ -22,8 +23,10 @@ import { BetaLabel, ProLabel } from '-/components/HelperComponents';
import { AvailablePerspectives } from '-/perspectives';
import PropertiesIcon from '@mui/icons-material/Info';
import React from 'react';
+import { TS } from '-/tagspaces.namespace';
export function getDirectoryMenuItems(
+ currentLocation: TS.Location,
selectedEntriesLength: number,
perspectiveMode: boolean,
isReadOnlyMode: boolean,
@@ -100,7 +103,12 @@ export function getDirectoryMenuItems(
}
}
- if (!isReadOnlyMode && openMoveCopyDialog) {
+ if (
+ !isReadOnlyMode &&
+ openMoveCopyDialog &&
+ currentLocation &&
+ currentLocation.type === locationType.TYPE_LOCAL
+ ) {
menuItems.push(
<MenuItem
key="fileMenuMoveCopyDirectory"
diff --git a/app/perspectives/grid-perspective/components/MainToolbar.tsx b/app/perspectives/grid-perspective/components/MainToolbar.tsx
index f91410b21..adba944d4 100644
--- a/app/perspectives/grid-perspective/components/MainToolbar.tsx
+++ b/app/perspectives/grid-perspective/components/MainToolbar.tsx
@@ -45,11 +45,12 @@ import { getKeyBindingObject } from '-/reducers/settings';
import { getAllPropertiesPromise } from '-/services/utils-io';
import { TS } from '-/tagspaces.namespace';
import { actions as AppActions } from '-/reducers/app';
+import PlatformIO from '-/services/platform-facade';
interface Props {
classes: any;
isReadOnlyMode: boolean;
- selectedEntries: Array<Object>;
+ selectedEntries: Array<TS.FileSystemEntry>;
loadParentDirectoryContent: () => void;
toggleSelectAllFiles: (event: any) => void;
someFileSelected: boolean;
@@ -188,7 +189,13 @@ function MainToolbar(props: Props) {
<IconButton
aria-label={i18n.t('core:copyMoveSelectedEntries')}
data-tid="gridPerspectiveCopySelectedFiles"
- disabled={selectedEntries.length < 1}
+ disabled={
+ selectedEntries.length < 1 ||
+ (PlatformIO.haveObjectStoreSupport() &&
+ selectedEntries.some(
+ (entry: TS.FileSystemEntry) => !entry.isFile
+ ))
+ }
onClick={openMoveCopyFilesDialog}
size="large"
>
diff --git a/app/reducers/app.ts b/app/reducers/app.ts
index e66349043..4a8b3e519 100644
--- a/app/reducers/app.ts
+++ b/app/reducers/app.ts
@@ -251,7 +251,7 @@ export const initialState = {
licenseDialogOpened: false,
thirdPartyLibsDialogOpened: false,
settingsDialogOpened: false,
- createDirectoryDialogOpened: false,
+ createDirectoryDialogOpened: null,
importKanBanDialogOpened: false,
// lastSelectedEntry: null,
selectedEntries: [],
@@ -315,7 +315,12 @@ export default (state: any = initialState, action: any) => {
}
case types.PROGRESS: {
const arrProgress = [
- { path: action.path, progress: action.progress, abort: action.abort }
+ {
+ path: action.path,
+ filePath: action.filePath,
+ progress: action.progress,
+ abort: action.abort
+ }
];
state.progress.map(fileProgress => {
if (fileProgress.path !== action.path) {
@@ -506,9 +511,11 @@ export default (state: any = initialState, action: any) => {
return { ...state, settingsDialogOpened: !state.settingsDialogOpened };
}
case types.TOGGLE_CREATE_DIRECTORY_DIALOG: {
+ // dialog closed = null
return {
...state,
- createDirectoryDialogOpened: !state.createDirectoryDialogOpened
+ createDirectoryDialogOpened:
+ state.createDirectoryDialogOpened !== null ? null : action.props
};
}
case types.TOGGLE_UPLOAD_DIALOG: {
@@ -1103,20 +1110,25 @@ export const actions = {
type: types.SET_NEW_VERSION_AVAILABLE,
isUpdateAvailable
}),
- setProgress: (path, progress, abort) => ({
+ setProgress: (path, progress, abort, filePath = undefined) => ({
type: types.PROGRESS,
path,
+ filePath,
progress,
abort
}),
resetProgress: () => ({ type: types.RESET_PROGRESS }),
- onUploadProgress: (progress, abort) => (dispatch: (action) => void) => {
+ onUploadProgress: (progress, abort, fileName = undefined) => (
+ dispatch: (action) => void
+ ) => {
const progressPercentage = Math.round(
(progress.loaded / progress.total) * 100
);
console.log(progressPercentage);
- dispatch(actions.setProgress(progress.key, progressPercentage, abort));
+ dispatch(
+ actions.setProgress(progress.key, progressPercentage, abort, fileName)
+ );
},
showCreateDirectoryDialog: () => (
dispatch: (action) => void,
@@ -1170,8 +1182,9 @@ export const actions = {
type: types.TOGGLE_THIRD_PARTY_LIBS_DIALOG
}),
toggleSettingsDialog: () => ({ type: types.TOGGLE_SETTINGS_DIALOG }),
- toggleCreateDirectoryDialog: () => ({
- type: types.TOGGLE_CREATE_DIRECTORY_DIALOG
+ toggleCreateDirectoryDialog: (props = undefined) => ({
+ type: types.TOGGLE_CREATE_DIRECTORY_DIALOG,
+ props
}),
toggleCreateFileDialog: () => ({ type: types.TOGGLE_CREATE_FILE_DIALOG }),
toggleDeleteMultipleEntriesDialog: () => ({
@@ -1674,7 +1687,9 @@ export const actions = {
);
throw error;
}),
- createDirectory: (directoryPath: string) => (dispatch: (action) => void) => {
+ createDirectory: (directoryPath: string, reflect = true) => (
+ dispatch: (action) => void
+ ) =>
PlatformIO.createDirectoryPromise(directoryPath)
.then(result => {
if (result !== undefined && result.dirPath !== undefined) {
@@ -1682,7 +1697,9 @@ export const actions = {
directoryPath = result.dirPath;
}
console.log(`Creating directory ${directoryPath} successful.`);
- dispatch(actions.reflectCreateEntry(directoryPath, false));
+ if (reflect) {
+ dispatch(actions.reflectCreateEntry(directoryPath, false));
+ }
dispatch(
actions.showNotification(
`Creating directory ${extractDirectoryName(
@@ -1707,9 +1724,9 @@ export const actions = {
true
)
);
+ return false;
// dispatch stopLoadingAnimation
- });
- },
+ }),
createFile: () => (dispatch: (action) => void, getState: () => any) => {
const { app } = getState();
if (app.currentDirectoryPath) {
@@ -2983,3 +3000,5 @@ export const getSearchResultsCount = (state: any) =>
state.app.searchResultsCount;
export const isSearchMode = (state: any) => state.app.searchMode;
export const getSearchFilter = (state: any) => state.app.searchFilter;
+
+// export type CreateDirectoryAction = ReturnType<typeof actions.createDirectory>;
diff --git a/package-lock.json b/package-lock.json
index fe45eaad1..ceda59984 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -22,7 +22,7 @@
"@mui/styles": "5.10.15",
"@mui/x-date-pickers": "^5.0.8",
"@tagspaces/tagspaces-md": "2.1.6",
- "@tagspaces/tagspaces-platforms": "2.1.26",
+ "@tagspaces/tagspaces-platforms": "2.1.27",
"aws-amplify": "^4.3.8",
"aws-sdk": "^2.1036.0",
"babel-polyfill": "^6.26.0",
@@ -13824,9 +13824,9 @@
}
},
"node_modules/@tagspaces/tagspaces-platforms": {
- "version": "2.1.26",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-2.1.26.tgz",
- "integrity": "sha512-322cQNHgMPdGmOjprbNP7pnZ6JNmiRRfbilVQ5GcQmoDPov+C7yNBscKGANNfhqrZE0QE//kamx7sq8cQQDsSQ==",
+ "version": "2.1.27",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-2.1.27.tgz",
+ "integrity": "sha512-QF1AcMK3mt9I4sKJoJYfowQGq1AGHIVQ0I+W0/H3palzcjjvZRrjiQWdnZLCcGWkuR/VFgAi8thFtrh+2tVVCw==",
"hasInstallScript": true
},
"node_modules/@testim/chrome-version": {
@@ -59541,9 +59541,9 @@
}
},
"@tagspaces/tagspaces-platforms": {
- "version": "2.1.26",
- "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-2.1.26.tgz",
- "integrity": "sha512-322cQNHgMPdGmOjprbNP7pnZ6JNmiRRfbilVQ5GcQmoDPov+C7yNBscKGANNfhqrZE0QE//kamx7sq8cQQDsSQ=="
+ "version": "2.1.27",
+ "resolved": "https://registry.npmjs.org/@tagspaces/tagspaces-platforms/-/tagspaces-platforms-2.1.27.tgz",
+ "integrity": "sha512-QF1AcMK3mt9I4sKJoJYfowQGq1AGHIVQ0I+W0/H3palzcjjvZRrjiQWdnZLCcGWkuR/VFgAi8thFtrh+2tVVCw=="
},
"@testim/chrome-version": {
"version": "1.1.3",
diff --git a/package.json b/package.json
index 66c987ecd..1f8806049 100644
--- a/package.json
+++ b/package.json
@@ -161,7 +161,7 @@
"@mui/styles": "5.10.15",
"@mui/x-date-pickers": "^5.0.8",
"@tagspaces/tagspaces-md": "2.1.6",
- "@tagspaces/tagspaces-platforms": "2.1.26",
+ "@tagspaces/tagspaces-platforms": "2.1.27",
"aws-amplify": "^4.3.8",
"aws-sdk": "^2.1036.0",
"babel-polyfill": "^6.26.0",