fix: cosmetic webUI improvements

mainly in custom board profile and analog sensors settings. Now it looks more consistent with other settings pages.
This commit is contained in:
pswid
2022-11-07 10:41:57 +01:00
parent 757fcd3ea4
commit f25262c191
3 changed files with 61 additions and 54 deletions

View File

@@ -219,7 +219,7 @@ const MqttSettingsForm: FC = () => {
/> />
</Grid> </Grid>
{data.ha_enabled && ( {data.ha_enabled && (
<Grid item xs={6}> <Grid item xs={2}>
<ValidatedTextField <ValidatedTextField
name="discovery_prefix" name="discovery_prefix"
label={LL.MQTT_PUBLISH_TEXT_4()} label={LL.MQTT_PUBLISH_TEXT_4()}
@@ -227,7 +227,7 @@ const MqttSettingsForm: FC = () => {
variant="outlined" variant="outlined"
value={data.discovery_prefix} value={data.discovery_prefix}
onChange={updateFormValue} onChange={updateFormValue}
margin="normal" size="small"
/> />
</Grid> </Grid>
)} )}

View File

@@ -172,7 +172,7 @@ const DashboardData: FC = () => {
common_theme, common_theme,
{ {
Table: ` Table: `
--data-table-library_grid-template-columns: repeat(1, minmax(0, 1fr)) 140px 40px; --data-table-library_grid-template-columns: repeat(1, minmax(0, 1fr)) minmax(140px, max-content) 40px;
`, `,
BaseRow: ` BaseRow: `
.td { .td {
@@ -1038,32 +1038,34 @@ const DashboardData: FC = () => {
</DialogTitle> </DialogTitle>
<DialogContent dividers> <DialogContent dividers>
<Grid container spacing={2}> <Grid container spacing={2}>
<Grid item> <Grid item xs={12}>
<ValidatedTextField
name="n"
label={LL.ENTITY_NAME()}
value={analog.n}
fullWidth
variant="outlined"
onChange={updateValue(setAnalog)}
/>
</Grid>
<Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
name="g" name="g"
label="GPIO" label="GPIO"
value={analog.g} value={analog.g}
fullWidth
type="number" type="number"
variant="outlined" variant="outlined"
autoFocus autoFocus
onChange={updateValue(setAnalog)} onChange={updateValue(setAnalog)}
/> />
</Grid> </Grid>
<Grid item> <Grid item xs={8}>
<ValidatedTextField
name="n"
label={LL.ENTITY_NAME()}
value={analog.n}
sx={{ width: '20ch' }}
variant="outlined"
onChange={updateValue(setAnalog)}
/>
</Grid>
<Grid item>
<ValidatedTextField <ValidatedTextField
name="t" name="t"
label={LL.TYPE()} label={LL.TYPE()}
value={analog.t} value={analog.t}
fullWidth
select select
onChange={updateValue(setAnalog)} onChange={updateValue(setAnalog)}
> >
@@ -1076,11 +1078,12 @@ const DashboardData: FC = () => {
</Grid> </Grid>
{analog.t >= AnalogType.COUNTER && analog.t <= AnalogType.RATE && ( {analog.t >= AnalogType.COUNTER && analog.t <= AnalogType.RATE && (
<> <>
<Grid item> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
name="u" name="u"
label={LL.UNIT()} label={LL.UNIT()}
value={analog.u} value={analog.u}
fullWidth
select select
onChange={updateValue(setAnalog)} onChange={updateValue(setAnalog)}
> >
@@ -1092,12 +1095,12 @@ const DashboardData: FC = () => {
</ValidatedTextField> </ValidatedTextField>
</Grid> </Grid>
{analog.t === AnalogType.ADC && ( {analog.t === AnalogType.ADC && (
<Grid item> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
name="o" name="o"
label={LL.OFFSET()} label={LL.OFFSET()}
value={numberValue(analog.o)} value={numberValue(analog.o)}
sx={{ width: '20ch' }} fullWidth
type="number" type="number"
variant="outlined" variant="outlined"
onChange={updateValue(setAnalog)} onChange={updateValue(setAnalog)}
@@ -1109,12 +1112,12 @@ const DashboardData: FC = () => {
</Grid> </Grid>
)} )}
{analog.t === AnalogType.COUNTER && ( {analog.t === AnalogType.COUNTER && (
<Grid item> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
name="o" name="o"
label={LL.STARTVALUE()} label={LL.STARTVALUE()}
value={numberValue(analog.o)} value={numberValue(analog.o)}
sx={{ width: '20ch' }} fullWidth
type="number" type="number"
variant="outlined" variant="outlined"
onChange={updateValue(setAnalog)} onChange={updateValue(setAnalog)}
@@ -1122,12 +1125,12 @@ const DashboardData: FC = () => {
/> />
</Grid> </Grid>
)} )}
<Grid item> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
name="f" name="f"
label={LL.FACTOR()} label={LL.FACTOR()}
value={numberValue(analog.f)} value={numberValue(analog.f)}
sx={{ width: '20ch' }} fullWidth
type="number" type="number"
variant="outlined" variant="outlined"
onChange={updateValue(setAnalog)} onChange={updateValue(setAnalog)}
@@ -1138,12 +1141,12 @@ const DashboardData: FC = () => {
)} )}
{analog.t === AnalogType.DIGITAL_OUT && (analog.id === '25' || analog.id === '26') && ( {analog.t === AnalogType.DIGITAL_OUT && (analog.id === '25' || analog.id === '26') && (
<> <>
<Grid item> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
name="o" name="o"
label={LL.VALUE(0)} label={LL.VALUE(0)}
value={numberValue(analog.o)} value={numberValue(analog.o)}
sx={{ width: '20ch' }} fullWidth
type="number" type="number"
variant="outlined" variant="outlined"
onChange={updateValue(setAnalog)} onChange={updateValue(setAnalog)}
@@ -1154,12 +1157,12 @@ const DashboardData: FC = () => {
)} )}
{analog.t === AnalogType.DIGITAL_OUT && analog.id !== '25' && analog.id !== '26' && ( {analog.t === AnalogType.DIGITAL_OUT && analog.id !== '25' && analog.id !== '26' && (
<> <>
<Grid item> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
name="o" name="o"
label={LL.VALUE(0)} label={LL.VALUE(0)}
value={numberValue(analog.o)} value={numberValue(analog.o)}
sx={{ width: '20ch' }} fullWidth
type="number" type="number"
variant="outlined" variant="outlined"
onChange={updateValue(setAnalog)} onChange={updateValue(setAnalog)}
@@ -1170,12 +1173,12 @@ const DashboardData: FC = () => {
)} )}
{analog.t >= AnalogType.PWM_0 && ( {analog.t >= AnalogType.PWM_0 && (
<> <>
<Grid item> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
name="f" name="f"
label={LL.FREQ()} label={LL.FREQ()}
value={numberValue(analog.f)} value={numberValue(analog.f)}
sx={{ width: '20ch' }} fullWidth
type="number" type="number"
variant="outlined" variant="outlined"
onChange={updateValue(setAnalog)} onChange={updateValue(setAnalog)}
@@ -1185,12 +1188,12 @@ const DashboardData: FC = () => {
}} }}
/> />
</Grid> </Grid>
<Grid item> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
name="o" name="o"
label={LL.DUTY_CYCLE()} label={LL.DUTY_CYCLE()}
value={numberValue(analog.o)} value={numberValue(analog.o)}
sx={{ width: '20ch' }} fullWidth
type="number" type="number"
variant="outlined" variant="outlined"
onChange={updateValue(setAnalog)} onChange={updateValue(setAnalog)}

View File

@@ -127,6 +127,7 @@ const SettingsApplication: FC = () => {
label={LL.BOARD_PROFILE()} label={LL.BOARD_PROFILE()}
value={data.board_profile} value={data.board_profile}
disabled={processingBoard} disabled={processingBoard}
fullWidth
variant="outlined" variant="outlined"
onChange={changeBoardProfile} onChange={changeBoardProfile}
margin="normal" margin="normal"
@@ -183,7 +184,7 @@ const SettingsApplication: FC = () => {
disabled={saving} disabled={saving}
/> />
</Grid> </Grid>
<Grid item> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
fieldErrors={fieldErrors} fieldErrors={fieldErrors}
name="dallas_gpio" name="dallas_gpio"
@@ -197,7 +198,7 @@ const SettingsApplication: FC = () => {
disabled={saving} disabled={saving}
/> />
</Grid> </Grid>
<Grid item> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
fieldErrors={fieldErrors} fieldErrors={fieldErrors}
name="led_gpio" name="led_gpio"
@@ -211,7 +212,6 @@ const SettingsApplication: FC = () => {
disabled={saving} disabled={saving}
/> />
</Grid> </Grid>
</Grid>
<Grid item xs={4}> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
name="phy_type" name="phy_type"
@@ -229,9 +229,10 @@ const SettingsApplication: FC = () => {
<MenuItem value={2}>TLK110</MenuItem> <MenuItem value={2}>TLK110</MenuItem>
</ValidatedTextField> </ValidatedTextField>
</Grid> </Grid>
</Grid>
{data.phy_type !== 0 && ( {data.phy_type !== 0 && (
<Grid container spacing={1} direction="row" justifyContent="flex-start" alignItems="flex-start"> <Grid container spacing={1} direction="row" justifyContent="flex-start" alignItems="flex-start">
<Grid item> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
name="eth_power" name="eth_power"
label={LL.GPIO_OF('PHY Power') + ' (-1=' + LL.DISABLED(1) + ')'} label={LL.GPIO_OF('PHY Power') + ' (-1=' + LL.DISABLED(1) + ')'}
@@ -244,7 +245,7 @@ const SettingsApplication: FC = () => {
disabled={saving} disabled={saving}
/> />
</Grid> </Grid>
<Grid item> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
name="eth_phy_addr" name="eth_phy_addr"
label={LL.ADDRESS_OF('PHY I²C')} label={LL.ADDRESS_OF('PHY I²C')}
@@ -257,7 +258,7 @@ const SettingsApplication: FC = () => {
disabled={saving} disabled={saving}
/> />
</Grid> </Grid>
<Grid item> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
name="eth_clock_mode" name="eth_clock_mode"
label="PHY Clk" label="PHY Clk"
@@ -279,7 +280,7 @@ const SettingsApplication: FC = () => {
)} )}
</> </>
)} )}
<Typography variant="h6" color="primary"> <Typography sx={{ pt: 2 }} variant="h6" color="primary">
{LL.SETTINGS_OF(LL.EMS_BUS(0))} {LL.SETTINGS_OF(LL.EMS_BUS(0))}
</Typography> </Typography>
<Grid container spacing={1} direction="row" justifyContent="flex-start" alignItems="flex-start"> <Grid container spacing={1} direction="row" justifyContent="flex-start" alignItems="flex-start">
@@ -404,7 +405,7 @@ const SettingsApplication: FC = () => {
/> />
{data.shower_alert && ( {data.shower_alert && (
<> <>
<Grid item xs={4}> <Grid>
<ValidatedTextField <ValidatedTextField
fieldErrors={fieldErrors} fieldErrors={fieldErrors}
name="shower_alert_trigger" name="shower_alert_trigger"
@@ -416,9 +417,11 @@ const SettingsApplication: FC = () => {
value={data.shower_alert_trigger} value={data.shower_alert_trigger}
type="number" type="number"
onChange={updateFormValue} onChange={updateFormValue}
size="small"
disabled={!data.shower_timer} disabled={!data.shower_timer}
/> />
</Grid> </Grid>
&nbsp;&nbsp;
<Grid item xs={4}> <Grid item xs={4}>
<ValidatedTextField <ValidatedTextField
fieldErrors={fieldErrors} fieldErrors={fieldErrors}
@@ -431,6 +434,7 @@ const SettingsApplication: FC = () => {
value={data.shower_alert_coldshot} value={data.shower_alert_coldshot}
type="number" type="number"
onChange={updateFormValue} onChange={updateFormValue}
size="small"
disabled={!data.shower_timer} disabled={!data.shower_timer}
/> />
</Grid> </Grid>