Skip to content

Commit

Permalink
feat: show read-only files as such
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <[email protected]>
  • Loading branch information
pedrolamas committed Apr 13, 2023
1 parent 98a7e2c commit 65966e2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/widgets/filesystem/FileSystem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
})
Expand Down
6 changes: 6 additions & 0 deletions src/components/widgets/filesystem/FileSystemBrowser.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/widgets/filesystem/FileSystemContextMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</v-list-item>

<v-list-item
v-if="!Array.isArray(file) && file.type !== 'directory' && rootProperties.canEdit"
v-if="!Array.isArray(file) && file.type !== 'directory' && (file.permissions === 'rw' || (!file.permissions && rootProperties.canEdit))"
@click="$emit('edit', file)"
>
<v-list-item-icon>
Expand All @@ -70,7 +70,7 @@
</v-list-item>

<v-list-item
v-if="!Array.isArray(file) && file.type !== 'directory' && rootProperties.canView"
v-if="!Array.isArray(file) && file.type !== 'directory' && (file.permissions === 'r' || (!file.permissions && rootProperties.canView))"
@click="$emit('view', file)"
>
<v-list-item-icon>
Expand Down
2 changes: 2 additions & 0 deletions src/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {
mdiAlertCircle,
mdiFolderPlus,
mdiFile,
mdiFileLock,
mdiFolder,
mdiPencil,
mdiMagnify,
Expand Down Expand Up @@ -292,6 +293,7 @@ export const Icons = Object.freeze({
fileRefresh: mdiFileRefreshOutline,
files: mdiFileTableOutline,
file: mdiFile,
fileLock: mdiFileLock,
fileCancel: mdiFileCancel,
pause: mdiPause,
cancel: mdiWindowClose,
Expand Down

0 comments on commit 65966e2

Please sign in to comment.