Make remotetimeout editable #1774, dev-16

This commit is contained in:
MichaelDvP
2024-06-20 19:46:09 +02:00
parent 240137d3a2
commit 1b09a301ba
20 changed files with 113 additions and 10 deletions

View File

@@ -507,6 +507,45 @@ const ApplicationSettings: FC = () => {
label={LL.HEATINGOFF()}
disabled={saving}
/>
<Grid
container
spacing={1}
direction="row"
justifyContent="flex-start"
alignItems="flex-start"
>
<Grid item xs={12} sm={6} md={4}>
<BlockFormControlLabel
control={
<Checkbox
checked={data.remote_timeout_en}
onChange={updateFormValue}
name="remote_timeout_en"
/>
}
label={LL.REMOTE_TIMEOUT_EN()}
/>
</Grid>
{data.remote_timeout_en && (
<Grid item xs={12} sm={6} md={4}>
<ValidatedTextField
fieldErrors={fieldErrors}
name="remote_timeout"
label={LL.REMOTE_TIMEOUT()}
InputProps={{
endAdornment: (
<InputAdornment position="end">{LL.HOURS()}</InputAdornment>
)
}}
fullWidth
variant="outlined"
value={numberValue(data.remote_timeout)}
type="number"
onChange={updateFormValue}
/>
</Grid>
)}
</Grid>
<Grid
container
spacing={0}
@@ -551,8 +590,7 @@ const ApplicationSettings: FC = () => {
<ValidatedTextField
fieldErrors={fieldErrors}
name="shower_min_duration"
// TODO translate
label="Dp this"
label={LL.MIN_DURATION()}
InputProps={{
endAdornment: (
<InputAdornment position="end">{LL.SECONDS()}</InputAdornment>

View File

@@ -8,6 +8,8 @@ export interface Settings {
syslog_host: string;
syslog_port: number;
boiler_heatingoff: boolean;
remote_timeout_en: boolean;
remote_timeout: number;
shower_timer: boolean;
shower_alert: boolean;
shower_alert_coldshot: number;

View File

@@ -261,6 +261,16 @@ export const createSettingsValidator = (settings: Settings) =>
message: 'Time must be between 1 and 10 seconds'
}
]
}),
...(settings.remote_timeout_en && {
remote_timeout: [
{
type: 'number',
min: 1,
max: 240,
message: 'Timeout must be between 1 and 240 hours'
}
]
})
});