TagSpaces is an offline, open source, document manager with tagging support
TSN548 - Kanban perspective improvements (#1771)
Stanimir6123ac187fa6
diff --git a/app/components/FolderContainer.tsx b/app/components/FolderContainer.tsxindex 7d3811b9d..a5bbe34c8 100644--- a/app/components/FolderContainer.tsx+++ b/app/components/FolderContainer.tsx@@ -50,9 +50,7 @@ import {getCurrentDirectoryPerspective,OpenedEntry,getSelectedEntries,- getProgress,- getCurrentDirectoryFiles,- getCurrentDirectoryDirs+ getProgress} from '../reducers/app';import TaggingActions from '../reducers/tagging-actions';import LoadingLazy from '../components/LoadingLazy';@@ -175,8 +173,6 @@ interface Props {windowHeight: number;windowWidth: number;directoryContent: Array<Object>;- currentDirectoryFiles: Array<any>;- currentDirectoryDirs: Array<any>;currentDirectoryPath: string | null;searchResultCount: number;addTags: () => void;@@ -342,8 +338,6 @@ function FolderContainer(props: Props) {return (<KanBanPerspectiveAsyncdirectoryContent={props.directoryContent}- currentDirectoryFiles={props.currentDirectoryFiles}- currentDirectoryDirs={props.currentDirectoryDirs}loadDirectoryContent={props.loadDirectoryContent}openFsEntry={props.openFsEntry}openRenameEntryDialog={() => setIsRenameEntryDialogOpened(true)}@@ -630,8 +624,6 @@ function mapStateToProps(state) {settings: state.settings,selectedEntries: getSelectedEntries(state),directoryContent: getDirectoryContent(state),- currentDirectoryFiles: getCurrentDirectoryFiles(state),- currentDirectoryDirs: getCurrentDirectoryDirs(state),currentDirectoryPerspective: getCurrentDirectoryPerspective(state),searchResultCount: getSearchResultCount(state),currentLocationPath: getCurrentLocationPath(state),diff --git a/app/package.json b/app/package.jsonindex 755e444af..e3a81266b 100644--- a/app/package.json+++ b/app/package.json@@ -16,7 +16,7 @@"@tagspaces/extensions": "1.0.35"},"nodeDependencies": {- "@tagspaces/tagspaces-ws": "2.0.39",+ "@tagspaces/tagspaces-ws": "2.0.40","@tagspaces/extensions": "1.0.35","sharp": "^0.30.7"}diff --git a/app/perspectives/grid-perspective/components/GridPagination.tsx b/app/perspectives/grid-perspective/components/GridPagination.tsxindex 7f6bbbec1..f4deec47d 100644--- a/app/perspectives/grid-perspective/components/GridPagination.tsx+++ b/app/perspectives/grid-perspective/components/GridPagination.tsx@@ -53,7 +53,8 @@ import { TS } from '-/tagspaces.namespace';import {getMetaForEntry,getDescriptionPreview,- normalizeUrl+ getFolderThumbPath,+ getFolderBgndPath} from '-/services/utils-io';import PlatformIO from '-/services/platform-facade';import { MilkdownEditor } from '@tagspaces/tagspaces-md';@@ -371,35 +372,6 @@ function GridPagination(props: Props) {PlatformIO.getDirSeparator());- function getFolderThumbPath(path: string, lastThumbnailImageChange: number) {- let tmbPath = getThumbFileLocationForDirectory(- path,- PlatformIO.getDirSeparator()- );- if (PlatformIO.haveObjectStoreSupport() || PlatformIO.haveWebDavSupport()) {- tmbPath = PlatformIO.getURLforPath(tmbPath);- } else {- tmbPath =- normalizeUrl(tmbPath) +- (lastThumbnailImageChange ? '?' + lastThumbnailImageChange : '');- }- return tmbPath;- }-- function getFolderBgndPath(path: string, lastBackgroundImageChange: number) {- let bgndPath = getBgndFileLocationForDirectory(- path,- PlatformIO.getDirSeparator()- );- if (PlatformIO.haveObjectStoreSupport() || PlatformIO.haveWebDavSupport()) {- bgndPath = PlatformIO.getURLforPath(bgndPath);- } else {- bgndPath =- normalizeUrl(bgndPath) +- (lastBackgroundImageChange ? '?' + lastBackgroundImageChange : '');- }- return bgndPath;- }const dirColor = currentDirectoryColor || 'transparent';const folderSummary =diff --git a/app/reducers/app.ts b/app/reducers/app.tsindex 68ec64929..aa4fbaa70 100644--- a/app/reducers/app.ts+++ b/app/reducers/app.ts@@ -116,6 +116,7 @@ export const types = {'APP/TOGGLE_DELETE_MULTIPLE_ENTRIES_DIALOG',TOGGLE_IMPORT_KANBAN_DIALOG: 'APP/TOGGLE_IMPORT_KANBAN_DIALOG',TOGGLE_UPLOAD_DIALOG: 'APP/TOGGLE_UPLOAD_DIALOG',+ SET_CURRENT_DIRECTORY_DIRS: 'APP/SET_CURRENT_DIRECTORY_DIRS',CLEAR_UPLOAD_DIALOG: 'APP/CLEAR_UPLOAD_DIALOG',TOGGLE_PROGRESS_DIALOG: 'APP/TOGGLE_PROGRESS_DIALOG',OPEN_LOCATIONMANAGER_PANEL: 'APP/OPEN_LOCATIONMANAGER_PANEL',@@ -300,6 +301,27 @@ export default (state: any = initialState, action: any) => {// relative pathsdirectoryPath = PlatformIO.resolveFilePath(directoryPath);}+ let currentDirectoryFiles: Array<TS.OrderVisibilitySettings> = [];+ if (+ action.directoryMeta &&+ action.directoryMeta.perspectiveSettings &&+ action.directoryMeta.perspectiveSettings[PerspectiveIDs.KANBAN] &&+ action.directoryMeta.perspectiveSettings[PerspectiveIDs.KANBAN].files+ ) {+ currentDirectoryFiles =+ action.directoryMeta.perspectiveSettings[PerspectiveIDs.KANBAN].files;+ }+ let currentDirectoryDirs: Array<TS.OrderVisibilitySettings> = [];+ if (+ action.directoryMeta &&+ action.directoryMeta.perspectiveSettings &&+ action.directoryMeta.perspectiveSettings[PerspectiveIDs.KANBAN] &&+ action.directoryMeta.perspectiveSettings[PerspectiveIDs.KANBAN].columns+ ) {+ currentDirectoryDirs =+ action.directoryMeta.perspectiveSettings[PerspectiveIDs.KANBAN]+ .columns;+ }return {...state,currentDirectoryEntries: action.directoryContent,@@ -321,15 +343,11 @@ export default (state: any = initialState, action: any) => {/*** used for reorder files in KanBan*/- currentDirectoryFiles: action.directoryMeta- ? action.directoryMeta.files- : [],+ currentDirectoryFiles: currentDirectoryFiles,/*** used for reorder dirs in KanBan*/- currentDirectoryDirs: action.directoryMeta- ? action.directoryMeta.dirs- : [],+ currentDirectoryDirs: currentDirectoryDirs,isLoading: action.showIsLoading || false};}@@ -445,6 +463,12 @@ export default (state: any = initialState, action: any) => {}return state;}+ case types.SET_CURRENT_DIRECTORY_DIRS: {+ return {+ ...state,+ currentDirectoryDirs: action.dirs+ };+ }case types.CLEAR_UPLOAD_DIALOG: {// if (PlatformIO.haveObjectStoreSupport()) {// upload dialog have objectStore support only@@ -978,6 +1002,10 @@ export const actions = {toggleUploadDialog: () => ({type: types.TOGGLE_UPLOAD_DIALOG}),+ setCurrentDirectoryDirs: dirs => ({+ type: types.SET_CURRENT_DIRECTORY_DIRS,+ dirs+ }),clearUploadDialog: () => (dispatch: (action) => void,getState: () => anydiff --git a/app/services/utils-io.ts b/app/services/utils-io.tsindex 5743f4951..3ecad00d8 100644--- a/app/services/utils-io.ts+++ b/app/services/utils-io.ts@@ -307,7 +307,7 @@ export function prepareDirectoryContent();}-export function orderDirectories(directories, metaArray) {+export function orderDirectories(directories, metaArray: Array<TS.OrderVisibilitySettings>) {// if (sortBy === 'custom') {try {// const metaDirData = await loadMetaDataPromise(currentLocationPath);@@ -316,11 +316,11 @@ export function orderDirectories(directories, metaArray) {const arrLength = directories.length;return directories.sort((a, b) => {let indexA = metaArray.findIndex(- meta => meta.path === a.path+ meta => meta.name === a.name// meta => meta.path === Object.keys(a)[0]);let indexB = metaArray.findIndex(- meta => meta.path === b.path+ meta => meta.name === b.name// meta => meta.path === Object.keys(b)[0]);// set new dirs last@@ -340,7 +340,7 @@ export function orderDirectories(directories, metaArray) {return directories;}-export function orderByMetaArray(arr, metaArray) {+export function orderByMetaArray(arr, metaArray: Array<TS.OrderVisibilitySettings>) {const arrLength = arr.length;return arr.sort((a, b) => {let indexA = metaArray.findIndex(metaFiles => metaFiles.name === a.name);@@ -864,12 +864,6 @@ export function cleanMetaData(if (metaData.description) {cleanedMeta.description = metaData.description;}- if (metaData.files && metaData.files.length > 0) {- cleanedMeta.files = metaData.files;- }- if (metaData.dirs && metaData.dirs.length > 0) {- cleanedMeta.dirs = metaData.dirs;- }if (metaData.perspectiveSettings) {cleanedMeta.perspectiveSettings = metaData.perspectiveSettings;}@@ -1266,3 +1260,55 @@ function mergeTags(oldTagsArray: Array<TS.Tag>, newTagsArray: Array<TS.Tag>) {);return [...oldTagsArray, ...uniqueTags];}++export function getFolderThumbPath(+ path: string,+ lastThumbnailImageChange: number+) {+ return getThumbPath(+ getThumbFileLocationForDirectory(path, PlatformIO.getDirSeparator()),+ lastThumbnailImageChange+ );+}++export function getThumbPath(+ thumbPath: string,+ lastThumbnailImageChange: number+) {+ if (!thumbPath) {+ return undefined;+ }+ if (PlatformIO.haveObjectStoreSupport() || PlatformIO.haveWebDavSupport()) {+ return PlatformIO.getURLforPath(thumbPath);+ }+ return (+ normalizeUrl(thumbPath) ++ (lastThumbnailImageChange ? '?' + lastThumbnailImageChange : '')+ );+}++export function getFolderBgndPath(+ path: string,+ lastBackgroundImageChange: number+) {+ return getBgndPath(+ getBgndFileLocationForDirectory(path, PlatformIO.getDirSeparator()),+ lastBackgroundImageChange+ );+}++export function getBgndPath(+ bgndPath: string,+ lastBackgroundImageChange: number+) {+ if (!bgndPath) {+ return undefined;+ }+ if (PlatformIO.haveObjectStoreSupport() || PlatformIO.haveWebDavSupport()) {+ return PlatformIO.getURLforPath(bgndPath);+ }+ return (+ normalizeUrl(bgndPath) ++ (lastBackgroundImageChange ? '?' + lastBackgroundImageChange : '')+ );+}diff --git a/app/tagspaces.namespace.d.ts b/app/tagspaces.namespace.d.tsindex fa39bc2e3..e3eeb7363 100644--- a/app/tagspaces.namespace.d.ts+++ b/app/tagspaces.namespace.d.ts@@ -139,8 +139,6 @@ export namespace TS {appName: string;appVersion: string;lastUpdated: string;- files?: Array<FileSystemEntry>;- dirs?: Array<FileSystemEntry>;perspectiveSettings?: PerspectiveSettings;}interface HistoryItem {@@ -182,6 +180,13 @@ export namespace TS {thumbnailMode?: string;gridPageLimit?: number;isLocal?: boolean;+ columns?: Array<OrderVisibilitySettings>;+ files?: Array<OrderVisibilitySettings>;+ }++ interface OrderVisibilitySettings {+ uuid: string;+ name: string;}interface MapTileServer {diff --git a/configs/webpack.config.renderer.dev.babel.js b/configs/webpack.config.renderer.dev.babel.jsindex 4a13b087d..84b37a2dd 100644--- a/configs/webpack.config.renderer.dev.babel.js+++ b/configs/webpack.config.renderer.dev.babel.js@@ -41,6 +41,7 @@ if (!requiredByDLLConfig && !(fs.existsSync(dll) && fs.existsSync(manifest))) {}export default merge(baseConfig, {+ cache: false,devtool: 'inline-source-map', // eval-source-mapmode: 'development',diff --git a/configs/webpack.config.renderer.dev.dll.babel.js b/configs/webpack.config.renderer.dev.dll.babel.jsindex 3da279e23..ef367733e 100644--- a/configs/webpack.config.renderer.dev.dll.babel.js+++ b/configs/webpack.config.renderer.dev.dll.babel.js@@ -18,6 +18,7 @@ const targetPlatform = 'electron-io'; // electron-io | webdav-io | cordova-io |const dist = path.join(__dirname, '..', 'dll');export default merge(baseConfig, {+ cache: false,context: path.join(__dirname, '..'),devtool: 'eval',diff --git a/configs/webpack.config.web.dev.babel.js b/configs/webpack.config.web.dev.babel.jsindex 94ce1f64d..c945cef40 100644--- a/configs/webpack.config.web.dev.babel.js+++ b/configs/webpack.config.web.dev.babel.js@@ -16,6 +16,7 @@ const targetPlatform = 'webdav-io'; // electron-io | webdav-io | cordova-io | pr// CheckNodeEnv('production');export default merge(baseConfig, {+ cache: false,devtool: 'inline-source-map',mode: 'development',diff --git a/package.json b/package.jsonindex f8e46f412..3f6d22f16 100644--- a/package.json+++ b/package.json@@ -157,7 +157,7 @@"@mui/material": "^5.9.2","@mui/styles": "^5.9.2","@tagspaces/tagspaces-md": "2.0.34",- "@tagspaces/tagspaces-platforms": "2.0.39",+ "@tagspaces/tagspaces-platforms": "2.0.40","aws-amplify": "^4.3.8","aws-sdk": "^2.1036.0","babel-polyfill": "^6.26.0",