Skip to content

Commit

Permalink
Merge pull request emsesp#733 from pswid/dev
Browse files Browse the repository at this point in the history
fix: cosmetic webUI improvements
  • Loading branch information
proddy authored Nov 13, 2022
2 parents 8ed7898 + dfd7647 commit 92ac601
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 71 deletions.
19 changes: 10 additions & 9 deletions interface/src/framework/mqtt/MqttSettingsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,30 +214,31 @@ const MqttSettingsForm: FC = () => {
<Grid container spacing={1} direction="row" justifyContent="flex-start" alignItems="flex-start">
<Grid item>
<BlockFormControlLabel
sx={{ pb: 2 }}
control={<Checkbox name="ha_enabled" checked={data.ha_enabled} onChange={updateFormValue} />}
label={LL.MQTT_PUBLISH_TEXT_3()}
/>
</Grid>
{data.ha_enabled && (
<Grid item xs={6}>
<Grid item sx={{ pb: 3 }}>
<ValidatedTextField
name="discovery_prefix"
label={LL.MQTT_PUBLISH_TEXT_4()}
fullWidth
variant="outlined"
value={data.discovery_prefix}
onChange={updateFormValue}
margin="normal"
size="small"
/>
</Grid>
)}
</Grid>
)}
<Typography sx={{ pt: 2 }} variant="h6" color="primary">
<Typography variant="h6" color="primary">
{LL.MQTT_PUBLISH_INTERVALS()}&nbsp;(0=auto)
</Typography>
<Grid container spacing={1} direction="row" justifyContent="flex-start" alignItems="flex-start">
<Grid item xs={4}>
<Grid item xs={6} sm={4}>
<ValidatedTextField
fieldErrors={fieldErrors}
name="publish_time_boiler"
Expand All @@ -253,7 +254,7 @@ const MqttSettingsForm: FC = () => {
margin="normal"
/>
</Grid>
<Grid item xs={4}>
<Grid item xs={6} sm={4}>
<ValidatedTextField
fieldErrors={fieldErrors}
name="publish_time_thermostat"
Expand All @@ -269,7 +270,7 @@ const MqttSettingsForm: FC = () => {
margin="normal"
/>
</Grid>
<Grid item xs={4}>
<Grid item xs={6} sm={4}>
<ValidatedTextField
fieldErrors={fieldErrors}
name="publish_time_solar"
Expand All @@ -285,7 +286,7 @@ const MqttSettingsForm: FC = () => {
margin="normal"
/>
</Grid>
<Grid item xs={4}>
<Grid item xs={6} sm={4}>
<ValidatedTextField
fieldErrors={fieldErrors}
name="publish_time_mixer"
Expand All @@ -301,7 +302,7 @@ const MqttSettingsForm: FC = () => {
margin="normal"
/>
</Grid>
<Grid item xs={4}>
<Grid item xs={6} sm={4}>
<ValidatedTextField
fieldErrors={fieldErrors}
name="publish_time_sensor"
Expand All @@ -317,7 +318,7 @@ const MqttSettingsForm: FC = () => {
margin="normal"
/>
</Grid>
<Grid item xs={4}>
<Grid item xs={6} sm={4}>
<ValidatedTextField
fieldErrors={fieldErrors}
name="publish_time_other"
Expand Down
59 changes: 31 additions & 28 deletions interface/src/project/DashboardData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ const DashboardData: FC = () => {
common_theme,
{
Table: `
--data-table-library_grid-template-columns: repeat(1, minmax(0, 1fr)) 140px 40px;
--data-table-library_grid-template-columns: minmax(0, 1fr) 35% 40px;
`,
BaseRow: `
.td {
Expand Down Expand Up @@ -1038,32 +1038,34 @@ const DashboardData: FC = () => {
</DialogTitle>
<DialogContent dividers>
<Grid container spacing={2}>
<Grid item>
<Grid item xs={12}>
<ValidatedTextField
name="g"
label="GPIO"
value={analog.g}
type="number"
name="n"
label={LL.ENTITY_NAME()}
value={analog.n}
fullWidth
variant="outlined"
autoFocus
onChange={updateValue(setAnalog)}
/>
</Grid>
<Grid item>
<Grid item xs={4}>
<ValidatedTextField
name="n"
label={LL.ENTITY_NAME()}
value={analog.n}
sx={{ width: '20ch' }}
name="g"
label="GPIO"
value={analog.g}
fullWidth
type="number"
variant="outlined"
autoFocus
onChange={updateValue(setAnalog)}
/>
</Grid>
<Grid item>
<Grid item xs={8}>
<ValidatedTextField
name="t"
label={LL.TYPE()}
value={analog.t}
fullWidth
select
onChange={updateValue(setAnalog)}
>
Expand All @@ -1076,11 +1078,12 @@ const DashboardData: FC = () => {
</Grid>
{analog.t >= AnalogType.COUNTER && analog.t <= AnalogType.RATE && (
<>
<Grid item>
<Grid item xs={4}>
<ValidatedTextField
name="u"
label={LL.UNIT()}
value={analog.u}
fullWidth
select
onChange={updateValue(setAnalog)}
>
Expand All @@ -1092,12 +1095,12 @@ const DashboardData: FC = () => {
</ValidatedTextField>
</Grid>
{analog.t === AnalogType.ADC && (
<Grid item>
<Grid item xs={4}>
<ValidatedTextField
name="o"
label={LL.OFFSET()}
value={numberValue(analog.o)}
sx={{ width: '20ch' }}
fullWidth
type="number"
variant="outlined"
onChange={updateValue(setAnalog)}
Expand All @@ -1109,25 +1112,25 @@ const DashboardData: FC = () => {
</Grid>
)}
{analog.t === AnalogType.COUNTER && (
<Grid item>
<Grid item xs={4}>
<ValidatedTextField
name="o"
label={LL.STARTVALUE()}
value={numberValue(analog.o)}
sx={{ width: '20ch' }}
fullWidth
type="number"
variant="outlined"
onChange={updateValue(setAnalog)}
inputProps={{ min: '0', step: '1' }}
/>
</Grid>
)}
<Grid item>
<Grid item xs={4}>
<ValidatedTextField
name="f"
label={LL.FACTOR()}
value={numberValue(analog.f)}
sx={{ width: '20ch' }}
fullWidth
type="number"
variant="outlined"
onChange={updateValue(setAnalog)}
Expand All @@ -1138,12 +1141,12 @@ const DashboardData: FC = () => {
)}
{analog.t === AnalogType.DIGITAL_OUT && (analog.id === '25' || analog.id === '26') && (
<>
<Grid item>
<Grid item xs={4}>
<ValidatedTextField
name="o"
label={LL.VALUE(0)}
value={numberValue(analog.o)}
sx={{ width: '20ch' }}
fullWidth
type="number"
variant="outlined"
onChange={updateValue(setAnalog)}
Expand All @@ -1154,12 +1157,12 @@ const DashboardData: FC = () => {
)}
{analog.t === AnalogType.DIGITAL_OUT && analog.id !== '25' && analog.id !== '26' && (
<>
<Grid item>
<Grid item xs={4}>
<ValidatedTextField
name="o"
label={LL.VALUE(0)}
value={numberValue(analog.o)}
sx={{ width: '20ch' }}
fullWidth
type="number"
variant="outlined"
onChange={updateValue(setAnalog)}
Expand All @@ -1170,12 +1173,12 @@ const DashboardData: FC = () => {
)}
{analog.t >= AnalogType.PWM_0 && (
<>
<Grid item>
<Grid item xs={4}>
<ValidatedTextField
name="f"
label={LL.FREQ()}
value={numberValue(analog.f)}
sx={{ width: '20ch' }}
fullWidth
type="number"
variant="outlined"
onChange={updateValue(setAnalog)}
Expand All @@ -1185,12 +1188,12 @@ const DashboardData: FC = () => {
}}
/>
</Grid>
<Grid item>
<Grid item xs={4}>
<ValidatedTextField
name="o"
label={LL.DUTY_CYCLE()}
value={numberValue(analog.o)}
sx={{ width: '20ch' }}
fullWidth
type="number"
variant="outlined"
onChange={updateValue(setAnalog)}
Expand Down
Loading

0 comments on commit 92ac601

Please sign in to comment.