diff --git a/interface/src/project/SettingsScheduler.tsx b/interface/src/project/SettingsScheduler.tsx
index fd12e321c..f9508da90 100644
--- a/interface/src/project/SettingsScheduler.tsx
+++ b/interface/src/project/SettingsScheduler.tsx
@@ -97,7 +97,7 @@ const SettingsScheduler: FC = () => {
const schedule_theme = useTheme({
Table: `
- --data-table-library_grid-template-columns: 32px 324px 72px repeat(1, minmax(100px, 1fr)) 100px 100px;
+ --data-table-library_grid-template-columns: 140px 48px 324px 72px 240px repeat(1, minmax(100px, 1fr));
`,
BaseRow: `
font-size: 14px;
@@ -106,21 +106,22 @@ const SettingsScheduler: FC = () => {
}
`,
BaseCell: `
- &:nth-of-type(1) {
- text-align: center;
- },
&:nth-of-type(2) {
text-align: center;
},
&:nth-of-type(3) {
text-align: center;
},
+ &:nth-of-type(4) {
+ text-align: center;
+ },
`,
HeaderRow: `
text-transform: uppercase;
background-color: black;
color: #90CAF9;
.th {
+ padding: 8px;
border-bottom: 1px solid #565656;
font-weight: 500;
height: 36px;
@@ -131,6 +132,7 @@ const SettingsScheduler: FC = () => {
position: relative;
cursor: pointer;
.td {
+ padding: 8px;
border-top: 1px solid #565656;
border-bottom: 1px solid #565656;
}
@@ -167,6 +169,7 @@ const SettingsScheduler: FC = () => {
setSchedule(
data.map((si) => ({
...si,
+ o_id: si.id,
o_active: si.active,
o_deleted: si.deleted,
o_flags: si.flags,
@@ -217,6 +220,7 @@ const SettingsScheduler: FC = () => {
function hasScheduleChanged(si: ScheduleItem) {
return (
+ si.id !== si.o_id ||
(si?.description || '') !== (si?.o_description || '') ||
si.active !== si.o_active ||
si.deleted !== si.o_deleted ||
@@ -302,25 +306,14 @@ const SettingsScheduler: FC = () => {
if (si.description === undefined) {
si.description = '';
}
- setScheduleItem(si);
setCreating(false);
+ setScheduleItem(si);
};
- function makeid() {
- let result = '';
- const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
- const charactersLength = characters.length;
- let counter = 0;
- while (counter < 4) {
- result += characters.charAt(Math.floor(Math.random() * charactersLength));
- counter += 1;
- }
- return result;
- }
-
const addScheduleItem = () => {
+ setCreating(true);
setScheduleItem({
- id: makeid(), // random ID of 4 strings
+ id: '',
active: false,
deleted: false,
flags: 0,
@@ -329,7 +322,6 @@ const SettingsScheduler: FC = () => {
value: '',
description: ''
});
- setCreating(true);
};
const updateScheduleItem = () => {
@@ -337,7 +329,6 @@ const SettingsScheduler: FC = () => {
const new_schedule = [...schedule.filter((si) => si.id !== scheduleItem.id), scheduleItem].sort((a, b) =>
a.time.localeCompare(b.time)
);
-
setSchedule(new_schedule);
setScheduleItem(undefined);
}
@@ -354,19 +345,20 @@ const SettingsScheduler: FC = () => {
<>
+ {LL.NAME()}
{LL.SCHEDULE()}
{LL.TIME()}
{LL.COMMAND()}
- {LL.VALUE(0)}
- {LL.DESCRIPTION()}
+ {LL.VALUE(0)}
{tableList.map((si: ScheduleItem) => (
editScheduleItem(si)}>
+ | {si.id} |
{
| {si.time} |
{si.cmd} |
{si.value} |
- {si.description} |
|
))}
@@ -423,7 +414,7 @@ const SettingsScheduler: FC = () => {
if (scheduleItem) {
try {
setFieldErrors(undefined);
- await validate(schedulerItemValidation(scheduleItem, creating), scheduleItem);
+ await validate(schedulerItemValidation(schedule, creating), scheduleItem);
updateScheduleItem();
} catch (errors: any) {
setFieldErrors(errors);
@@ -436,35 +427,44 @@ const SettingsScheduler: FC = () => {
return (