@samitouri / QOSami-HFS / commits / 5eb5a9a5

admin/fs: offer upload/delete permission on virtual folders, so that it is inherited by subfolders with a source

Massimo Melina committed May 28, 2024 at 14:23 UTC 5eb5a9a54a847140c41366fc152ddbade7ba8793
1 file changed +6 -6
admin/src/FileForm.ts
+6 -6
@@ -63,14 +63,14 @@ export default function FileForm({ file, addToBar, statusApi, accounts, saved }:
63 const barColors = useDialogBarColors()
64 const { movingFile } = useSnapState()
65
66 - const needSourceWarning = !hasSource && "Works only on folders with source! "
66 + const needSourceWarning = !hasSource && h(Box, { color: 'warning.main', component: 'span' }, "Works only on folders with disk source! ")
67 const show: Record<keyof VfsPerms, boolean> = {
68 can_read: !isLink,
69 can_see: true,
70 can_archive: !isLink,
71 can_list: isDir,
72 - can_upload: isDir && hasSource,
73 - can_delete: isDir && hasSource,
72 + can_upload: isDir,
73 + can_delete: isDir,
74 }
75 return h(Form, {
76 values,
@@ -146,9 +146,9 @@ export default function FileForm({ file, addToBar, statusApi, accounts, saved }:
146 : isDir && hasSource && h(Alert, { severity: 'info' }, `To set permissions on individual items in folder, add them by clicking Add button, and then "from disk"`),
147 !isRoot && { k: 'name', required: true, xl: true, helperText: hasSource && "You can decide a name that's different from the one on your disk" },
148 isLink ? { k: 'url', label: "URL", lg: 12, required: true }
149 - : { k: 'source', label: "Load content from disk", xl: true, comp: FileField, files: isUnknown || !isDir, folders: isUnknown || isDir,
150 - placeholder: "no",
151 - helperText: !values.source ? "This field is empty, and thus this element is a virtual-folder. You can set this field, pointing at any folder/file on disk."
149 + : { k: 'source', label: "Disk source", xl: true, comp: FileField, files: isUnknown || !isDir, folders: isUnknown || isDir,
150 + placeholder: "none",
151 + helperText: !values.source ? "This field is currently empty, and thus this element is a virtual-folder, no upload or delete is possible here."
152 : isDir ? "Content from this path on disk will be listed, but you can also add more" : undefined,
153 },
154 { k: 'id', comp: LinkField, statusApi, xs: 12 },