Skip to content

Commit da98f97

Browse files
committed
Add start date-time picker to alert configuration
Introduces a date-time picker for specifying the desired start time of an alert. The start time is parsed from the alert data if available and included in form state and submission payload.
1 parent 417f179 commit da98f97

File tree

1 file changed

+18
-0
lines changed
  • src/pages/tenant/administration/alert-configuration

1 file changed

+18
-0
lines changed

src/pages/tenant/administration/alert-configuration/alert.jsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,21 @@ const AlertWizard = () => {
132132
};
133133
}
134134

135+
// Parse the original desired start date-time from DesiredStartTime field if it exists
136+
let startDateTimeForForm = null;
137+
if (alert.RawAlert.DesiredStartTime && alert.RawAlert.DesiredStartTime !== "0") {
138+
const desiredStartEpoch = parseInt(alert.RawAlert.DesiredStartTime);
139+
startDateTimeForForm = desiredStartEpoch;
140+
}
141+
135142
// Create the reset object with all the form values
136143
const resetObject = {
137144
tenantFilter: tenantFilterForForm,
138145
excludedTenants: excludedTenantsFormatted,
139146
command: { value: usedCommand, label: usedCommand.label },
140147
recurrence: recurrenceOption,
141148
postExecution: postExecutionValue,
149+
startDateTime: startDateTimeForForm,
142150
};
143151

144152
// Parse Parameters field if it exists and is a string
@@ -332,6 +340,7 @@ const AlertWizard = () => {
332340
Command: { value: `Get-CIPPAlert${values.command.value.name}` },
333341
Parameters: getInputParams(),
334342
ScheduledTime: Math.floor(new Date().getTime() / 1000) + 60,
343+
DesiredStartTime: values.startDateTime ? values.startDateTime.toString() : null,
335344
Recurrence: values.recurrence,
336345
PostExecution: values.postExecution,
337346
};
@@ -700,6 +709,15 @@ const AlertWizard = () => {
700709
options={recurrenceOptions} // Use the state-managed recurrenceOptions here
701710
/>
702711
</Grid>
712+
<Grid size={12}>
713+
<CippFormComponent
714+
type="datePicker"
715+
name="startDateTime"
716+
formControl={formControl}
717+
label="When should the first alert run?"
718+
dateTimeType="datetime"
719+
/>
720+
</Grid>
703721
<Grid size={12}>
704722
{commandValue?.value?.requiresInput && (
705723
<CippFormComponent

0 commit comments

Comments
 (0)