admin: better english

Massimo Melina committed Apr 11, 2024 at 14:14 UTC ba5c2a88448920ca8f79774aa5c60962ab8ea8e9
4 files changed +11 -8
admin/src/ArrayField.ts
+5 -2
@@ -9,10 +9,10 @@ import { BoolField, FieldDescriptor, FieldProps, labelFromKey } from '@hfs/mui-g
9 import { Box, FormHelperText, FormLabel } from '@mui/material'
10 import { DateTimeField } from './DateTimeField'
11 import _ from 'lodash'
12 -import { IconBtn } from './mui'
12 +import { Center, IconBtn } from './mui'
13
14 type ArrayFieldProps<T> = FieldProps<T[]> & { fields: FieldDescriptor[], height?: number, reorder?: boolean, prepend?: boolean }
15 -export function ArrayField<T extends object>({ label, helperText, fields, value, onChange, onError, setApi, reorder, prepend, ...rest }: ArrayFieldProps<T>) {
15 +export function ArrayField<T extends object>({ label, helperText, fields, value, onChange, onError, setApi, reorder, prepend, noRows, ...rest }: ArrayFieldProps<T>) {
16 const rows = useMemo(() => (value||[]).map((x,$idx) =>
17 setHidden({ ...x } as any, x.hasOwnProperty('id') ? { $idx } : { id: $idx })),
18 [JSON.stringify(value)]) //eslint-disable-line
@@ -30,6 +30,9 @@ export function ArrayField<T extends object>({ label, helperText, fields, value,
30 sx: { '.MuiDataGrid-virtualScroller': { minHeight: '3em' } },
31 hideFooterSelectedRowCount: true,
32 hideFooter: true,
33 + slots: {
34 + noRowsOverlay: () => h(Center, {}, noRows || "No entries"),
35 + },
36 slotProps: {
37 pagination: {
38 showFirstButton: true,
admin/src/DataTable.ts
+2 -2
@@ -118,8 +118,9 @@ export function DataTable({ columns, initialState={}, actions, actionsProps, ini
118 density: compact ? 'compact' : 'standard',
119 columns: manipulatedColumns,
120 apiRef,
121 + ...rest,
122 slots: {
122 - ...(noRows || initializing) && { noRowsOverlay: () => initializing ? null : h(Center, {}, noRows) },
123 + noRowsOverlay: () => initializing ? null : h(Center, {}, noRows || "No entries"),
124 footer: CustomFooter,
125 },
126 slotProps: {
@@ -161,7 +162,6 @@ export function DataTable({ columns, initialState={}, actions, actionsProps, ini
162 }
163 })
164 },
164 - ...rest,
165 onColumnVisibilityModelChange: x => setVis(x),
166 columnVisibilityModel: {
167 ...Object.fromEntries(hideCols.map(x => [x, false])),
admin/src/VfsMenuBar.ts
+1 -1
@@ -60,7 +60,7 @@ export default function VfsMenuBar({ statusApi }: { statusApi: ApiObject }) {
60 helperText: "You can decide different home-folders (in the VFS) for different domains, a bit like virtual hosts. If none is matched, the default home will be used.",
61 comp: ArrayField,
62 fields: [
63 - { k: 'host', label: "Domain/Host", helperText: "Wildcards supported: domain.*|other.*" },
63 + { k: 'host', label: "Domain/Host", helperText: "Wildcards supported: *.domain.com|other.com" },
64 { k: 'root', label: "Home/Root", comp: VfsPathField, placeholder: "default", helperText: "Root path in VFS" },
65 ],
66 toField: x => Object.entries(x || {}).map(([host,root]) => ({ host, root })),
frontend/src/BrowseFiles.ts
+3 -3
@@ -190,11 +190,11 @@ const PAGE_SEPARATOR_CLASS = 'page-separator'
190
191 interface EntryProps { entry: DirEntry, midnight: Date, separator?: string }
192 const Entry = ({ entry, midnight, separator }: EntryProps) => {
193 - const { uri, isFolder, name } = entry
193 + const { uri, isFolder, name, n } = entry
194 const { showFilter, selected, file_menu_on_link } = useSnapState()
195 const isLink = Boolean(entry.url)
196 - const containerDir = isFolder || isLink ? '' : uri.substring(0, (uri.lastIndexOf('/') || -1) +1)
197 - const containerName = containerDir && entry.n.slice(0, -name.length)
196 + const containerDir = isFolder ? '' : n.substring(0, (n.lastIndexOf('/') || -1) +1) // n works both for files and links
197 + const containerName = containerDir && n.slice(0, -name.length)
198 let className = isFolder ? 'folder' : 'file'
199 if (entry.cantOpen)
200 className += ' cant-open'