From 65966e2b1d5f66f2884fc3f9d5268672d49e3b8b Mon Sep 17 00:00:00 2001 From: Pedro Lamas Date: Thu, 13 Apr 2023 16:40:26 +0100 Subject: [PATCH] feat: show read-only files as such Signed-off-by: Pedro Lamas --- src/components/widgets/filesystem/FileSystem.vue | 2 +- src/components/widgets/filesystem/FileSystemBrowser.vue | 6 ++++++ src/components/widgets/filesystem/FileSystemContextMenu.vue | 4 ++-- src/globals.ts | 2 ++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/widgets/filesystem/FileSystem.vue b/src/components/widgets/filesystem/FileSystem.vue index 4ba0733c85..2bc53cdcba 100644 --- a/src/components/widgets/filesystem/FileSystem.vue +++ b/src/components/widgets/filesystem/FileSystem.vue @@ -684,7 +684,7 @@ export default class FileSystem extends Mixins(StateMixin, FilesMixin, ServicesM contents: response.data, filename: file.filename, loading: false, - readonly: this.rootProperties.readonly + readonly: file.permissions === 'r' || this.rootProperties.readonly } } }) diff --git a/src/components/widgets/filesystem/FileSystemBrowser.vue b/src/components/widgets/filesystem/FileSystemBrowser.vue index 4666cb886d..eab035f1da 100644 --- a/src/components/widgets/filesystem/FileSystemBrowser.vue +++ b/src/components/widgets/filesystem/FileSystemBrowser.vue @@ -338,6 +338,10 @@ export default class FileSystemBrowser extends Mixins(FilesMixin) { ) } + get readonly () { + return this.$store.getters['files/getRootProperties'](this.root).readonly + } + get thumbnailSize () { const thumbnailSize = this.$store.state.config.uiSettings.general.thumbnailSize @@ -392,6 +396,8 @@ export default class FileSystemBrowser extends Mixins(FilesMixin) { if (item.type === 'file') { if (item.extension === 'zip') { return '$fileZip' + } else if (item.permissions === 'r' || this.readonly) { + return '$fileLock' } else { return '$file' } diff --git a/src/components/widgets/filesystem/FileSystemContextMenu.vue b/src/components/widgets/filesystem/FileSystemContextMenu.vue index d127072c82..b399db2dbc 100644 --- a/src/components/widgets/filesystem/FileSystemContextMenu.vue +++ b/src/components/widgets/filesystem/FileSystemContextMenu.vue @@ -58,7 +58,7 @@ @@ -70,7 +70,7 @@ diff --git a/src/globals.ts b/src/globals.ts index 3370d92553..d7837722be 100644 --- a/src/globals.ts +++ b/src/globals.ts @@ -37,6 +37,7 @@ import { mdiAlertCircle, mdiFolderPlus, mdiFile, + mdiFileLock, mdiFolder, mdiPencil, mdiMagnify, @@ -292,6 +293,7 @@ export const Icons = Object.freeze({ fileRefresh: mdiFileRefreshOutline, files: mdiFileTableOutline, file: mdiFile, + fileLock: mdiFileLock, fileCancel: mdiFileCancel, pause: mdiPause, cancel: mdiWindowClose,