ux: better mime-type editor
Massimo Melina committed
Dec 5, 2023 at 09:40 UTC
c33badd2e75093e0adb52ce3717e939051246093
1 file changed
+4
-2
admin/src/OptionsPage.ts
+4
-2
@@ -151,7 +151,7 @@ export default function OptionsPage() {
151
},
152
{ k: 'mime', comp: ArrayField, label: false, reorder: true, prepend: true, md: 6,
153
fields: [
154
- { k: 'k', label: "File mask", $width: 1, $column: {
154
+ { k: 'k', label: "File mask", helperText: h(WildcardsSupported), $width: 1, $column: {
155
renderCell: ({ value, id }: any) => h('code', {},
156
value,
157
value === '*' && id < _.size(values.mime) - 1
@@ -159,7 +159,9 @@ export default function OptionsPage() {
159
color: 'warning.main', ml: 1
160
}))
161
} },
162
- { k: 'v', label: "Mime type", fromField: _.toLower, $width: 2 },
162
+ { k: 'v', label: "Mime type", placeholder: "auto", $width: 2,
163
+ toField: (x: any) => x === 'auto' ? '' : x, fromField: (x: string) => !x ? 'auto' : x.toLowerCase(),
164
+ helperText: "Leave empty to get automatic value", },
165
],
166
toField: x => Object.entries(x || {}).map(([k,v]) => ({ k, v })),
167
fromField: x => Object.fromEntries(x.map((row: any) => [row.k, row.v])),