mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
Merge pull request #1851 from proddy/dev
small change to make sure flags are set in Scheduler with a Timer
This commit is contained in:
@@ -169,13 +169,9 @@ const UploadDownload: FC = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const downloadSchedule = async () => {
|
const downloadSchedule = async () => {
|
||||||
await getSchedule()
|
await getSchedule().catch((error: Error) => {
|
||||||
.catch((error: Error) => {
|
toast.error(error.message);
|
||||||
toast.error(error.message);
|
});
|
||||||
})
|
|
||||||
.finally(() => {
|
|
||||||
toast.info(LL.DOWNLOAD_SUCCESSFUL());
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const callAPI = async (device: string, entity: string) => {
|
const callAPI = async (device: string, entity: string) => {
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ const SchedulerDialog = ({
|
|||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<DialogContent dividers>
|
<DialogContent dividers>
|
||||||
<Box display="flex" flexWrap="wrap" mb={1}>
|
<Box display="flex" flexWrap="wrap" mb={1}>
|
||||||
<Box flexGrow={1}>
|
<Box>
|
||||||
<ToggleButtonGroup
|
<ToggleButtonGroup
|
||||||
size="small"
|
size="small"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
@@ -191,7 +191,7 @@ const SchedulerDialog = ({
|
|||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
</ToggleButtonGroup>
|
</ToggleButtonGroup>
|
||||||
</Box>
|
</Box>
|
||||||
<Box flexWrap="nowrap" whiteSpace="nowrap">
|
<Box sx={{ '& button, & a, & .MuiCard-root': { ml: 1 } }}>
|
||||||
{isTimer ? (
|
{isTimer ? (
|
||||||
<Button
|
<Button
|
||||||
size="large"
|
size="large"
|
||||||
@@ -217,8 +217,6 @@ const SchedulerDialog = ({
|
|||||||
{showFlag(editItem, ScheduleFlag.SCHEDULE_TIMER)}
|
{showFlag(editItem, ScheduleFlag.SCHEDULE_TIMER)}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
{isOnChange ? (
|
{isOnChange ? (
|
||||||
<Button
|
<Button
|
||||||
size="large"
|
size="large"
|
||||||
@@ -247,8 +245,6 @@ const SchedulerDialog = ({
|
|||||||
{showFlag(editItem, ScheduleFlag.SCHEDULE_ONCHANGE)}
|
{showFlag(editItem, ScheduleFlag.SCHEDULE_ONCHANGE)}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
{isCondition ? (
|
{isCondition ? (
|
||||||
<Button
|
<Button
|
||||||
size="large"
|
size="large"
|
||||||
@@ -279,75 +275,83 @@ const SchedulerDialog = ({
|
|||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
<Grid container>
|
{editItem.flags !== 0 && (
|
||||||
<BlockFormControlLabel
|
<>
|
||||||
control={
|
<Grid container>
|
||||||
<Checkbox
|
<BlockFormControlLabel
|
||||||
checked={editItem.active}
|
control={
|
||||||
onChange={updateFormValue}
|
<Checkbox
|
||||||
name="active"
|
checked={editItem.active}
|
||||||
|
onChange={updateFormValue}
|
||||||
|
name="active"
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
label={LL.ACTIVE()}
|
||||||
/>
|
/>
|
||||||
}
|
</Grid>
|
||||||
label={LL.ACTIVE()}
|
<Grid container>
|
||||||
/>
|
{isCondition || isOnChange ? (
|
||||||
</Grid>
|
<TextField
|
||||||
<Grid container>
|
name="time"
|
||||||
{isCondition || isOnChange ? (
|
label={isCondition ? 'Condition' : 'On Change Value'}
|
||||||
<TextField
|
fullWidth
|
||||||
name="time"
|
value={
|
||||||
label={isCondition ? 'Condition' : 'On Change Value'}
|
editItem.time == '00:00' ? (editItem.time = '') : editItem.time
|
||||||
|
}
|
||||||
|
margin="normal"
|
||||||
|
onChange={updateFormValue}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
|
<TextField
|
||||||
|
name="time"
|
||||||
|
type="time"
|
||||||
|
label={isTimer ? LL.TIMER(1) : LL.TIME(1)}
|
||||||
|
value={
|
||||||
|
editItem.time == '' ? (editItem.time = '00:00') : editItem.time
|
||||||
|
}
|
||||||
|
margin="normal"
|
||||||
|
onChange={updateFormValue}
|
||||||
|
/>
|
||||||
|
{isTimer && (
|
||||||
|
<Box color="warning.main" ml={2} mt={4}>
|
||||||
|
<Typography variant="body2">
|
||||||
|
{LL.SCHEDULER_HELP_2()}
|
||||||
|
</Typography>
|
||||||
|
</Box>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Grid>
|
||||||
|
<ValidatedTextField
|
||||||
|
fieldErrors={fieldErrors}
|
||||||
|
name="cmd"
|
||||||
|
label={LL.COMMAND(0)}
|
||||||
fullWidth
|
fullWidth
|
||||||
value={editItem.time == '00:00' ? (editItem.time = '') : editItem.time}
|
value={editItem.cmd}
|
||||||
margin="normal"
|
margin="normal"
|
||||||
onChange={updateFormValue}
|
onChange={updateFormValue}
|
||||||
/>
|
/>
|
||||||
) : (
|
<TextField
|
||||||
<>
|
name="value"
|
||||||
<TextField
|
label={LL.VALUE(0)}
|
||||||
name="time"
|
multiline
|
||||||
type="time"
|
margin="normal"
|
||||||
label={isTimer ? LL.TIMER(1) : LL.TIME(1)}
|
fullWidth
|
||||||
value={
|
value={editItem.value}
|
||||||
editItem.time == '' ? (editItem.time = '00:00') : editItem.time
|
onChange={updateFormValue}
|
||||||
}
|
/>
|
||||||
margin="normal"
|
<ValidatedTextField
|
||||||
onChange={updateFormValue}
|
fieldErrors={fieldErrors}
|
||||||
/>
|
name="name"
|
||||||
{isTimer && (
|
label={LL.NAME(0)}
|
||||||
<Box color="warning.main" ml={2} mt={4}>
|
value={editItem.name}
|
||||||
<Typography variant="body2">{LL.SCHEDULER_HELP_2()}</Typography>
|
fullWidth
|
||||||
</Box>
|
margin="normal"
|
||||||
)}
|
onChange={updateFormValue}
|
||||||
</>
|
/>
|
||||||
)}
|
</>
|
||||||
</Grid>
|
)}
|
||||||
<ValidatedTextField
|
|
||||||
fieldErrors={fieldErrors}
|
|
||||||
name="cmd"
|
|
||||||
label={LL.COMMAND(0)}
|
|
||||||
fullWidth
|
|
||||||
value={editItem.cmd}
|
|
||||||
margin="normal"
|
|
||||||
onChange={updateFormValue}
|
|
||||||
/>
|
|
||||||
<TextField
|
|
||||||
name="value"
|
|
||||||
label={LL.VALUE(0)}
|
|
||||||
multiline
|
|
||||||
margin="normal"
|
|
||||||
fullWidth
|
|
||||||
value={editItem.value}
|
|
||||||
onChange={updateFormValue}
|
|
||||||
/>
|
|
||||||
<ValidatedTextField
|
|
||||||
fieldErrors={fieldErrors}
|
|
||||||
name="name"
|
|
||||||
label={LL.NAME(0)}
|
|
||||||
value={editItem.name}
|
|
||||||
fullWidth
|
|
||||||
margin="normal"
|
|
||||||
onChange={updateFormValue}
|
|
||||||
/>
|
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
{!creating && (
|
{!creating && (
|
||||||
|
|||||||
Reference in New Issue
Block a user