Skip to content

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

fix editTagForEntry for sidecar tags (#1799)

Stanimir988e8fd0d7b7
diff --git a/app/components/CommonIcons.tsx b/app/components/CommonIcons.tsx
new file mode 100644
index 000000000..8af221685
--- /dev/null
+++ b/app/components/CommonIcons.tsx
@@ -0,0 +1,34 @@
+/**
+ * TagSpaces - universal file and folder organizer
+ * Copyright (C) 2017-present TagSpaces UG (haftungsbeschraenkt)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License (version 3) as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+import React from 'react';
+import ParentFolder from '@mui/icons-material/ReplyOutlined';
+import Help from '@mui/icons-material/Help';
+import Settings from '@mui/icons-material/Settings';
+import InfoIcon from '@mui/icons-material/Info';
+
+export const ParentFolderIcon = () => (
+ // <ParentDirIcon style={{ transform: 'rotate(-90deg)' }} /> SubdirectoryArrowLeft
+ <ParentFolder />
+);
+
+export const HelpIcon = () => <Help />;
+
+export const PerspectiveSettingsIcon = () => <Settings />;
+
+export const FolderPropertiesIcon = () => <InfoIcon />;
diff --git a/app/components/menus/FileMenu.tsx b/app/components/menus/FileMenu.tsx
index d153d20c7..d5c547d8b 100644
--- a/app/components/menus/FileMenu.tsx
+++ b/app/components/menus/FileMenu.tsx
@@ -28,6 +28,7 @@ import OpenParentFolder from '@mui/icons-material/FolderOpen';
import OpenFolderInternally from '@mui/icons-material/Folder';
import AddRemoveTags from '@mui/icons-material/Loyalty';
import MoveCopy from '@mui/icons-material/FileCopy';
+import MoveToTopIcon from '@mui/icons-material/VerticalAlignTop';
import DuplicateFile from '@mui/icons-material/PostAdd';
import ImageIcon from '@mui/icons-material/Image';
import ShareIcon from '@mui/icons-material/Link';
@@ -87,6 +88,7 @@ interface Props {
currentLocation: TS.Location;
locations: Array<TS.Location>;
setLastBackgroundImageChange: (number) => void;
+ reorderTop?: () => void;
}
function FileMenu(props: Props) {
@@ -356,6 +358,23 @@ function FileMenu(props: Props) {
<ListItemText primary={i18n.t('core:addRemoveTags')} />
</MenuItem>
);
+ if (props.reorderTop) {
+ menuItems.push(
+ <MenuItem
+ key="reorderTop"
+ data-tid="reorderTopTID"
+ onClick={() => {
+ onClose();
+ props.reorderTop();
+ }}
+ >
+ <ListItemIcon>
+ <MoveToTopIcon />
+ </ListItemIcon>
+ <ListItemText primary={i18n.t('core:moveToTop')} />
+ </MenuItem>
+ );
+ }
menuItems.push(
<MenuItem
key="fileMenuRenameFile"
diff --git a/app/locales/en/core.json b/app/locales/en/core.json
index 7d133c49c..237c62ba6 100644
--- a/app/locales/en/core.json
+++ b/app/locales/en/core.json
@@ -702,5 +702,6 @@
"hide": "Hide",
"show": "Show",
"chooseKanbanJSON": "Choose Trello JSON file",
+ "moveToTop": "Move to top",
"-": "-"
}
diff --git a/app/reducers/tagging-actions.ts b/app/reducers/tagging-actions.ts
index bffc9b578..bd20b31cc 100644
--- a/app/reducers/tagging-actions.ts
+++ b/app/reducers/tagging-actions.ts
@@ -368,18 +368,21 @@ const actions = {
delete tag.functionality;
delete tag.path;
delete tag.id;
+
+ const extractedTags: string[] = extractTags(
+ path,
+ settings.tagDelimiter,
+ PlatformIO.getDirSeparator()
+ );
// TODO: Handle adding already added tags
- if (tag.type === 'plain') {
+ if (extractedTags.includes(tag.title)) {
+ // tag.type === 'plain') {
const fileName = extractFileName(path, PlatformIO.getDirSeparator());
const containingDirectoryPath = extractContainingDirectoryPath(
path,
PlatformIO.getDirSeparator()
);
- const extractedTags = extractTags(
- path,
- settings.tagDelimiter,
- PlatformIO.getDirSeparator()
- );
+
let tagFoundPosition = -1;
for (let i = 0; i < extractedTags.length; i += 1) {
// check if tag is already in the tag array
@@ -410,7 +413,8 @@ const actions = {
)
);
}
- } else if (tag.type === 'sidecar') {
+ } else {
+ //if (tag.type === 'sidecar') {
loadMetaDataPromise(path)
.then(fsEntryMeta => {
let tagFoundPosition = -1;
diff --git a/app/tagspaces.namespace.d.ts b/app/tagspaces.namespace.d.ts
index faac44e47..fa918ad48 100644
--- a/app/tagspaces.namespace.d.ts
+++ b/app/tagspaces.namespace.d.ts
@@ -77,6 +77,9 @@ export namespace TS {
interface Tag {
title?: string;
+ /**
+ * @deprecated type can be auto recognized -> look at editTagForEntry
+ */
type?: 'plain' | 'sidecar' | 'smart'; // smart should be eventually removed from this list, functionality should be enough
id?: Uuid;
icon?: string;
diff --git a/package-lock.json b/package-lock.json
index 995cf4788..66f1cb1fb 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -102,7 +102,7 @@
"@babel/preset-react": "^7.16.7",
"@babel/preset-typescript": "^7.16.7",
"@babel/register": "^7.17.7",
- "@playwright/test": "^1.22.2",
+ "@playwright/test": "1.22.2",
"@tagspaces/dynamic-packages-loading": "^2.0.5",
"@types/jest": "^26.0.10",
"@types/react": "^17.0.48",
@@ -166,7 +166,7 @@
"mini-css-extract-plugin": "^2.6.1",
"node-polyfill-webpack-plugin": "^2.0.1",
"npm": "^8.5.5",
- "playwright": "^1.22.2",
+ "playwright": "1.22.2",
"prettier": "1.19.1",
"properties-reader": "^2.2.0",
"raw-loader": "^4.0.2",
@@ -11778,13 +11778,13 @@
}
},
"node_modules/@playwright/test": {
- "version": "1.27.1",
- "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.27.1.tgz",
- "integrity": "sha512-mrL2q0an/7tVqniQQF6RBL2saskjljXzqNcCOVMUjRIgE6Y38nCNaP+Dc2FBW06bcpD3tqIws/HT9qiMHbNU0A==",
+ "version": "1.22.2",
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.22.2.tgz",
+ "integrity": "sha512-cCl96BEBGPtptFz7C2FOSN3PrTnJ3rPpENe+gYCMx4GNNDlN4tmo2D89y13feGKTMMAIVrXfSQ/UmaQKLy1XLA==",
"dev": true,
"dependencies": {
"@types/node": "*",
- "playwright-core": "1.27.1"
+ "playwright-core": "1.22.2"
},
"bin": {
"playwright": "cli.js"
@@ -39236,13 +39236,13 @@
}
},
"node_modules/playwright": {
- "version": "1.27.1",
- "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.27.1.tgz",
- "integrity": "sha512-xXYZ7m36yTtC+oFgqH0eTgullGztKSRMb4yuwLPl8IYSmgBM88QiB+3IWb1mRIC9/NNwcgbG0RwtFlg+EAFQHQ==",
+ "version": "1.22.2",
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.22.2.tgz",
+ "integrity": "sha512-hUTpg7LytIl3/O4t0AQJS1V6hWsaSY5uZ7w1oCC8r3a1AQN5d6otIdCkiB3cbzgQkcMaRxisinjMFMVqZkybdQ==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
- "playwright-core": "1.27.1"
+ "playwright-core": "1.22.2"
},
"bin": {
"playwright": "cli.js"
@@ -39252,9 +39252,9 @@
}
},
"node_modules/playwright-core": {
- "version": "1.27.1",
- "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.27.1.tgz",
- "integrity": "sha512-9EmeXDncC2Pmp/z+teoVYlvmPWUC6ejSSYZUln7YaP89Z6lpAaiaAnqroUt/BoLo8tn7WYShcfaCh+xofZa44Q==",
+ "version": "1.22.2",
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.22.2.tgz",
+ "integrity": "sha512-w/hc/Ld0RM4pmsNeE6aL/fPNWw8BWit2tg+TfqJ3+p59c6s3B6C8mXvXrIPmfQEobkcFDc+4KirNzOQ+uBSP1Q==",
"dev": true,
"bin": {
"playwright": "cli.js"
@@ -57897,13 +57897,13 @@
}
},
"@playwright/test": {
- "version": "1.27.1",
- "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.27.1.tgz",
- "integrity": "sha512-mrL2q0an/7tVqniQQF6RBL2saskjljXzqNcCOVMUjRIgE6Y38nCNaP+Dc2FBW06bcpD3tqIws/HT9qiMHbNU0A==",
+ "version": "1.22.2",
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.22.2.tgz",
+ "integrity": "sha512-cCl96BEBGPtptFz7C2FOSN3PrTnJ3rPpENe+gYCMx4GNNDlN4tmo2D89y13feGKTMMAIVrXfSQ/UmaQKLy1XLA==",
"dev": true,
"requires": {
"@types/node": "*",
- "playwright-core": "1.27.1"
+ "playwright-core": "1.22.2"
}
},
"@polka/url": {
@@ -79070,18 +79070,18 @@
}
},
"playwright": {
- "version": "1.27.1",
- "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.27.1.tgz",
- "integrity": "sha512-xXYZ7m36yTtC+oFgqH0eTgullGztKSRMb4yuwLPl8IYSmgBM88QiB+3IWb1mRIC9/NNwcgbG0RwtFlg+EAFQHQ==",
+ "version": "1.22.2",
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.22.2.tgz",
+ "integrity": "sha512-hUTpg7LytIl3/O4t0AQJS1V6hWsaSY5uZ7w1oCC8r3a1AQN5d6otIdCkiB3cbzgQkcMaRxisinjMFMVqZkybdQ==",
"dev": true,
"requires": {
- "playwright-core": "1.27.1"
+ "playwright-core": "1.22.2"
}
},
"playwright-core": {
- "version": "1.27.1",
- "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.27.1.tgz",
- "integrity": "sha512-9EmeXDncC2Pmp/z+teoVYlvmPWUC6ejSSYZUln7YaP89Z6lpAaiaAnqroUt/BoLo8tn7WYShcfaCh+xofZa44Q==",
+ "version": "1.22.2",
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.22.2.tgz",
+ "integrity": "sha512-w/hc/Ld0RM4pmsNeE6aL/fPNWw8BWit2tg+TfqJ3+p59c6s3B6C8mXvXrIPmfQEobkcFDc+4KirNzOQ+uBSP1Q==",
"dev": true
},
"please-upgrade-node": {
diff --git a/package.json b/package.json
index bbaafeb9a..b676ed441 100644
--- a/package.json
+++ b/package.json
@@ -239,7 +239,7 @@
"@babel/preset-react": "^7.16.7",
"@babel/preset-typescript": "^7.16.7",
"@babel/register": "^7.17.7",
- "@playwright/test": "^1.22.2",
+ "@playwright/test": "1.22.2",
"@tagspaces/dynamic-packages-loading": "^2.0.5",
"@types/jest": "^26.0.10",
"@types/react": "^17.0.48",
@@ -303,7 +303,7 @@
"mini-css-extract-plugin": "^2.6.1",
"node-polyfill-webpack-plugin": "^2.0.1",
"npm": "^8.5.5",
- "playwright": "^1.22.2",
+ "playwright": "1.22.2",
"prettier": "1.19.1",
"properties-reader": "^2.2.0",
"raw-loader": "^4.0.2",
diff --git a/tests/e2e/perspective-grid-right-button.pw.e2e.js b/tests/e2e/perspective-grid-right-button.pw.e2e.js
index 0aff61270..958f326d0 100644
--- a/tests/e2e/perspective-grid-right-button.pw.e2e.js
+++ b/tests/e2e/perspective-grid-right-button.pw.e2e.js
@@ -398,7 +398,7 @@ describe('TST50** - Right button on a file', () => {
test('TST5036 - Open directory properties (directory menu) [web,minio,electron]', async () => {
await openContextEntryMenu(selectorFolder, 'showProperties');
- await expectElementExist('[data-tid=fileNameProperties]', true);
+ await expectElementExist('[data-tid=fileNameProperties]', true, 5000);
});
test('TST5037 - Show sub folders [TST5037,web,minio,electron]', async () => {
@@ -462,7 +462,8 @@ describe('TST50** - Right button on a file', () => {
await expectElementExist(
// '[data-tid=' + gridDefaultSettings.testID + ']',
'[data-tid=gridPerspectiveContainer]',
- true
+ true,
+ 5000
);
await clickOn('[data-tid=openListPerspective]'); // openListPerspective
await expectElementExist(