admin/config: nicer layout

Massimo Melina committed Apr 14, 2022 at 11:28 UTC ba574b1b2c0a1d8701d054a3c4fed5eee5faf009
1 file changed +7 -7
admin/src/ConfigPage.ts
+7 -7
@@ -73,6 +73,8 @@ export default function ConfigPage() {
73 : { sm: 6 }
74 },
75 fields: [
76 + { k: 'max_kbps', ...maxSpeedDefaults, label: "Limit output KB/s", helperText: "Doesn't apply to localhost" },
77 + { k: 'max_kbps_per_ip', ...maxSpeedDefaults, label: "Limit output KB/s per-ip" },
78 { k: 'port', comp: ServerPort, label:"HTTP port", status: status?.http||true, suggestedPort: 80 },
79 { k: 'https_port', comp: ServerPort, label: "HTTPS port", status: status?.https||true, suggestedPort: 443,
80 onChange(v: number) {
@@ -83,17 +85,15 @@ export default function ConfigPage() {
85 },
86 values.https_port >= 0 && { k: 'cert', comp: FileField, label: "HTTPS certificate file" },
87 values.https_port >= 0 && { k: 'private_key', comp: FileField, label: "HTTPS private key file" },
86 - { k: 'max_kbps', ...maxSpeedDefaults, label: "Limit output KB/s", helperText: "Doesn't apply to localhost" },
87 - { k: 'max_kbps_per_ip', ...maxSpeedDefaults, label: "Limit output KB/s per-ip" },
88 - ...Object.entries(logLabels).map(a => ({ k: a[0], label: a[1], lg: 3 })),
89 - { k: 'log_rotation', comp: SelectField, options: [{ value:'', label:"disabled" }, 'daily', 'weekly', 'monthly' ],
90 - helperText: "To avoid an endlessly-growing single log file, you can opt for rotation"
91 - },
88 { k: 'open_browser_at_start', comp: BoolField },
89 { k: 'localhost_admin', comp: BoolField, label: "Admin access for localhost connections",
90 validate: x => x || admins?.length>0 || "First create at least one admin account",
91 helperText: "To access Admin without entering credentials"
92 },
93 + ...Object.entries(logLabels).map(a => ({ k: a[0], label: a[1], lg: 3 })),
94 + { k: 'log_rotation', comp: SelectField, options: [{ value:'', label:"disabled" }, 'daily', 'weekly', 'monthly' ],
95 + helperText: "To avoid an endlessly-growing single log file, you can opt for rotation"
96 + },
97 { k: 'proxies', comp: NumberField, min: 0, max: 9, sm: 6, lg: 6, label: "How many HTTP proxies between this server and users?",
98 error: proxyWarning(values, status),
99 helperText: "Wrong number will prevent detection of users' IP address"
@@ -172,7 +172,7 @@ function ServerPort({ label, value, onChange, status, suggestedPort=1 }: FieldPr
172 ],
173 onChange,
174 }),
175 - value! > 0 && h(NumberField, { label: 'Number', fullWidth: false, value, onChange, min: 1, max: 65535 }),
175 + value! > 0 && h(NumberField, { label: 'Number', fullWidth: false, value, onChange, min: 1, max: 65535, sx: { minWidth:'5.5em' } }),
176 ),
177 status && h(FormHelperText, { error: Boolean(error) },
178 status === true ? '...'