Skip to content

Commit

Permalink
[Security Solution ] Fixes Timeline Unsaved changes badge color as …
Browse files Browse the repository at this point in the history
  • Loading branch information
logeekal authored Jan 21, 2025
1 parent db6a1b0 commit 089a91c
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,23 @@ export const TimelineSaveStatus = React.memo<TimelineSaveStatusProps>(({ timelin
changed = false,
status,
updated,
show,
} = useDeepEqualSelector((state) =>
pick(['changed', 'status', 'updated'], getTimeline(state, timelineId) ?? timelineDefaults)
pick(
['changed', 'status', 'updated', 'show'],
getTimeline(state, timelineId) ?? timelineDefaults
)
);

const isDraft = status === TimelineStatusEnum.draft;

const badgeColor = useMemo(() => (show ? 'warning' : 'default'), [show]);

let statusContent: React.ReactNode;
if (isDraft || !updated) {
statusContent = <EuiBadge color="warning">{UNSAVED}</EuiBadge>;
statusContent = <EuiBadge color={badgeColor}>{UNSAVED}</EuiBadge>;
} else if (changed) {
statusContent = <EuiBadge color="warning">{UNSAVED_CHANGES}</EuiBadge>;
statusContent = <EuiBadge color={badgeColor}>{UNSAVED_CHANGES}</EuiBadge>;
}

if (!statusContent) return null;
Expand Down

0 comments on commit 089a91c

Please sign in to comment.