admin/config: tighter fields
Massimo Melina committed
Mar 8, 2022 at 16:25 UTC
c6c0dd8675f915a6c040ac737b8923b6874f3481
1 file changed
+12
-9
admin/src/ConfigPage.ts
+12
-9
@@ -27,7 +27,7 @@ export default function ConfigPage() {
27
const { changes } = snap
28
const config = (loaded !== res) ? (state.config = loaded = res) : snap.config
29
return h(Form, {
30
- sx: { maxWidth:'80em' },
30
+ sx: { maxWidth:'90em' },
31
values: config,
32
set(v, { k }) {
33
if (v || config[k])
@@ -46,8 +46,11 @@ export default function ConfigPage() {
46
startIcon: h(Refresh),
47
}, 'Reload')],
48
defaults({ comp }) {
49
- const shortField = comp === NumberField || comp === BoolField
50
- return { md: shortField ? 3 : 6 }
49
+ if (comp === ServerPort)
50
+ return { md: 6, xl: 4 }
51
+ if (comp === NumberField)
52
+ return { md:3, xl: 2 }
53
+ return { md: 6, xl: 4 }
54
},
55
fields: [
56
{ k: 'port', comp: ServerPort, label:'HTTP port', status: status?.http||true, suggestedPort: 80 },
@@ -61,22 +64,22 @@ export default function ConfigPage() {
64
{ value: '0.0.0.0', label: 'any network' }
65
]
66
},
64
- { k: 'admin_login', md: 6, comp: BoolField, label: 'Admin requires login',
67
+ { k: 'admin_login', comp: BoolField, label: 'Admin requires login',
68
disabled: !status?.any_admin_account,
69
helperText: (config.admin_network === '127.0.0.1' ? '' : "You should enable this because access is not restricted to localhost.")
70
+ (status?.any_admin_account ? '' : " Before this, you must go to Accounts and give Admin access to some account.")
71
},
72
{ k: 'max_kbps', comp: NumberField, label: 'Max KB/s', helperText: "Limit output bandwidth" },
73
{ k: 'max_kbps_per_ip', comp: NumberField, label: 'Max KB/s per-ip' },
71
- { k: 'log', comp: StringField, label: 'Main log file' },
72
- { k: 'error_log', comp: StringField, label: 'Error log file' },
73
- { k: 'log_rotation', comp: SelectField, options: [{ value:'', label:"disabled" }, 'daily', 'weekly', 'monthly' ],
74
+ { k: 'log', xl: 4, comp: StringField, label: 'Main log file' },
75
+ { k: 'error_log', xl: 4, comp: StringField, label: 'Error log file' },
76
+ { k: 'log_rotation', xl: 4, comp: SelectField, options: [{ value:'', label:"disabled" }, 'daily', 'weekly', 'monthly' ],
77
helperText: "To avoid an endlessly-growing single log file, you can opt for rotation"
78
},
79
{ k: 'accounts', comp: StringField, label: 'Accounts file' },
80
{ k: 'open_browser_at_start', comp: BoolField },
78
- { k: 'zip_calculate_size_for_seconds', comp: NumberField, label: 'Calculate ZIP size for seconds',
79
- helperText: "If time is not enough the browser will not show download percentage" },
81
+ { k: 'zip_calculate_size_for_seconds', comp: NumberField, md: 6, xl:4, label: 'Calculate ZIP size for seconds',
82
+ helperText: "If time is not enough, the browser will not show download percentage" },
83
{ k: 'mime', comp: StringStringField,
84
keyLabel: 'Files', keyWidth: 7,
85
valueLabel: 'Mime type', valueWidth: 4