Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solution] Able to add Same Start Time and End Time in Schedule for Snooze Notifications of Rule #158565

Merged
merged 3 commits into from
Jun 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ const RuleSnoozeSchedulerPanel: React.FunctionComponent<PanelOpts> = ({
);
const selectEndDT = useCallback(
(date) => {
setEndDT(date);
setEndDT(date.add(1, 'minutes'));
setSelectingEndTime(true);
setSelectingEndDate(false);
},
Expand All @@ -210,8 +210,7 @@ const RuleSnoozeSchedulerPanel: React.FunctionComponent<PanelOpts> = ({
const onSelectFromInline = useCallback(
(date) => {
const dateAsMoment = moment(date);
const newDateAfterStart =
!startDT || dateAsMoment.isAfter(startDT) || dateAsMoment.isSame(startDT);
const newDateAfterStart = !startDT || dateAsMoment.isSameOrAfter(startDT);
const isEndDateTimeChange =
dateAsMoment.isSame(endDT, 'day') && !dateAsMoment.isSame(endDT, 'minute');
const isStartDateTimeChange =
Expand Down Expand Up @@ -309,7 +308,7 @@ const RuleSnoozeSchedulerPanel: React.FunctionComponent<PanelOpts> = ({
selected={endDT}
onChange={setEndDT}
minDate={startDT ?? minDate}
isInvalid={startDT?.isAfter(endDT)}
isInvalid={startDT?.isSameOrAfter(endDT)}
/>
}
/>
Expand Down Expand Up @@ -376,7 +375,7 @@ const RuleSnoozeSchedulerPanel: React.FunctionComponent<PanelOpts> = ({
<EuiButton
fill
fullWidth
disabled={!startDT || !endDT || startDT.isAfter(endDT) || startDT.isBefore(minDate)}
disabled={!startDT || !endDT || startDT.isSameOrAfter(endDT) || startDT.isBefore(minDate)}
onClick={onClickSaveSchedule}
isLoading={isLoading}
data-test-subj="scheduler-saveSchedule"
Expand Down