admin/fs: better english
Massimo Melina committed
Jan 24, 2024 at 17:50 UTC
d8727691adf5fc464b84e1f301217d15ebc5f42d
1 file changed
+8
-8
admin/src/FileForm.ts
+8
-8
@@ -169,7 +169,7 @@ export default function FileForm({ file, addToBar, statusApi }: FileFormProps) {
169
comp: WhoField,
170
k: perm, lg: 6, xl: 4,
171
parent, accounts, helperText, isDir,
172
- otherPerms: others.map(x => ({ value: x, label: "As " +perm2word(x) })),
172
+ otherPerms: others.map(x => ({ value: x, label: who2desc(x) })),
173
label: "Who can " + perm2word(perm),
174
inherit: file.inherited?.[perm] ?? defaultPerms[perm],
175
byMasks: byMasks?.[perm],
@@ -194,8 +194,8 @@ interface WhoFieldProps extends FieldProps<Who | undefined> {
194
}
195
function WhoField({ value, onChange, parent, inherit, accounts, helperText, otherPerms, byMasks,
196
hideValues, isChildren, isDir, contentText="folder content", setApi, ...rest }: WhoFieldProps): ReactElement {
197
- const defaultLabel = (byMasks !== undefined ? "As per mask: " : parent !== undefined ? "As parent: " : "Default: " )
198
- + who2desc(byMasks ?? inherit)
197
+ const defaultLabel = who2desc(byMasks ?? inherit)
198
+ + prefix(' (', byMasks !== undefined ? "from masks" : parent !== undefined ? "inherited" : "default", ')')
199
const objectMode = isWhoObject(value)
200
const thisValue = objectMode ? value.this : value
201
@@ -208,7 +208,7 @@ function WhoField({ value, onChange, parent, inherit, accounts, helperText, othe
208
...otherPerms,
209
{ value: [], label: "Select accounts" },
210
].map(x => !hideValues?.includes(x.value)
211
- && { label: _.capitalize(who2desc(x.value)), ...x })), // default label
211
+ && { label: who2desc(x.value), ...x })), // default label
212
[inherit, parent, thisValue])
213
214
const timeout = 500
@@ -260,11 +260,11 @@ function WhoField({ value, onChange, parent, inherit, accounts, helperText, othe
260
}
261
262
function who2desc(who: any) {
263
- return who === false ? "no one"
264
- : who === true ? "anyone"
265
- : who === '*' ? "any account (login required)"
263
+ return who === false ? "No one"
264
+ : who === true ? "Anyone"
265
+ : who === '*' ? "Any account (login required)"
266
: Array.isArray(who) ? who.join(', ')
267
- : typeof who === 'string' ? "as " + perm2word(who)
267
+ : typeof who === 'string' ? `As "can ${perm2word(who)}"`
268
: "*UNKNOWN*" + JSON.stringify(who)
269
}
270