updates to scheduler web

This commit is contained in:
proddy
2024-07-28 10:56:33 +02:00
parent 4b136fb7ee
commit 0fbba50b2f
6 changed files with 29 additions and 28 deletions

View File

@@ -64,7 +64,7 @@ const CustomEntitiesDialog = ({
} }
}, [open, selectedItem]); }, [open, selectedItem]);
const handleClose = (event: object, reason: 'backdropClick' | 'escapeKeyDown') => { const handleClose = (_event, reason: 'backdropClick' | 'escapeKeyDown') => {
if (reason !== 'backdropClick') { if (reason !== 'backdropClick') {
onClose(); onClose();
} }

View File

@@ -54,7 +54,7 @@ const CustomizationDialog = ({
} }
}, [open, selectedItem]); }, [open, selectedItem]);
const handleClose = (event: object, reason: 'backdropClick' | 'escapeKeyDown') => { const handleClose = (_event, reason: 'backdropClick' | 'escapeKeyDown') => {
if (reason !== 'backdropClick') { if (reason !== 'backdropClick') {
onClose(); onClose();
} }

View File

@@ -219,27 +219,33 @@ const Scheduler: FC = () => {
<Box> <Box>
<Typography <Typography
sx={{ fontSize: 11 }} sx={{ fontSize: 11 }}
color={ color={(si.flags & flag) === flag ? 'primary' : 'grey'}
si.flags >= ScheduleFlag.SCHEDULE_TIMER && si.flags !== flag
? 'gray'
: (si.flags & flag) === flag
? 'primary'
: 'grey'
}
> >
{flag === ScheduleFlag.SCHEDULE_TIMER {dow[Math.log(flag) / Math.log(2)]}
? LL.TIMER(0)
: flag === ScheduleFlag.SCHEDULE_ONCHANGE
? 'On Change'
: flag === ScheduleFlag.SCHEDULE_CONDITION
? 'Condition'
: dow[Math.log(flag) / Math.log(2)]}
</Typography> </Typography>
</Box> </Box>
<Divider orientation="vertical" flexItem /> <Divider orientation="vertical" flexItem />
</> </>
); );
const scheduleType = (si: ScheduleItem) => (
<Box>
<Typography sx={{ fontSize: 11 }} color="primary">
{si.flags === ScheduleFlag.SCHEDULE_IMMEDIATE ? (
<>Immediate</>
) : si.flags === ScheduleFlag.SCHEDULE_TIMER ? (
<>Timer</>
) : si.flags === ScheduleFlag.SCHEDULE_CONDITION ? (
<>Condition</>
) : si.flags === ScheduleFlag.SCHEDULE_ONCHANGE ? (
<>On Change</>
) : (
<></>
)}
</Typography>
</Box>
);
useLayoutTitle(LL.SCHEDULER()); useLayoutTitle(LL.SCHEDULER());
return ( return (
@@ -283,9 +289,9 @@ const Scheduler: FC = () => {
<Cell stiff> <Cell stiff>
<Stack spacing={0.5} direction="row"> <Stack spacing={0.5} direction="row">
<Divider orientation="vertical" flexItem /> <Divider orientation="vertical" flexItem />
{si.flags === ScheduleFlag.SCHEDULE_IMMEDIATE ? ( {si.flags > 127 ? (
<></> scheduleType(si)
) : si.flags < ScheduleFlag.SCHEDULE_TIMER ? ( ) : (
<> <>
{dayBox(si, ScheduleFlag.SCHEDULE_MON)} {dayBox(si, ScheduleFlag.SCHEDULE_MON)}
{dayBox(si, ScheduleFlag.SCHEDULE_TUE)} {dayBox(si, ScheduleFlag.SCHEDULE_TUE)}
@@ -295,12 +301,6 @@ const Scheduler: FC = () => {
{dayBox(si, ScheduleFlag.SCHEDULE_SAT)} {dayBox(si, ScheduleFlag.SCHEDULE_SAT)}
{dayBox(si, ScheduleFlag.SCHEDULE_SUN)} {dayBox(si, ScheduleFlag.SCHEDULE_SUN)}
</> </>
) : (
<>
{dayBox(si, ScheduleFlag.SCHEDULE_TIMER)}
{dayBox(si, ScheduleFlag.SCHEDULE_ONCHANGE)}
{dayBox(si, ScheduleFlag.SCHEDULE_CONDITION)}
</>
)} )}
</Stack> </Stack>
</Cell> </Cell>

View File

@@ -144,7 +144,7 @@ const SchedulerDialog = ({
</Typography> </Typography>
); );
const handleClose = (event: object, reason: 'backdropClick' | 'escapeKeyDown') => { const handleClose = (_event, reason: 'backdropClick' | 'escapeKeyDown') => {
if (reason !== 'backdropClick') { if (reason !== 'backdropClick') {
onClose(); onClose();
} }
@@ -164,6 +164,7 @@ const SchedulerDialog = ({
exclusive exclusive
disabled={!creating} disabled={!creating}
onChange={(_event, flag: ScheduleFlag) => { onChange={(_event, flag: ScheduleFlag) => {
setFieldErrors(undefined); // clear any validation errors
setScheduleType(flag); setScheduleType(flag);
// wipe the time field when changing the schedule type // wipe the time field when changing the schedule type
setEditItem({ ...editItem, time: '' }); setEditItem({ ...editItem, time: '' });

View File

@@ -57,7 +57,7 @@ const SensorsAnalogDialog = ({
} }
}, [open, selectedItem]); }, [open, selectedItem]);
const handleClose = (event: object, reason: 'backdropClick' | 'escapeKeyDown') => { const handleClose = (_event, reason: 'backdropClick' | 'escapeKeyDown') => {
if (reason !== 'backdropClick') { if (reason !== 'backdropClick') {
onClose(); onClose();
} }

View File

@@ -52,7 +52,7 @@ const SensorsTemperatureDialog = ({
} }
}, [open, selectedItem]); }, [open, selectedItem]);
const handleClose = (event: object, reason: 'backdropClick' | 'escapeKeyDown') => { const handleClose = (_event, reason: 'backdropClick' | 'escapeKeyDown') => {
if (reason !== 'backdropClick') { if (reason !== 'backdropClick') {
onClose(); onClose();
} }