Skip to content

Commit

Permalink
Clear gap filters after unmounting component (#211588)
Browse files Browse the repository at this point in the history
## When we move out monitoring tab we reset filters to show only rule
with gaps




https://github.com/user-attachments/assets/d86b248e-62e1-41c7-9873-8140a8d86b81

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
nkhristinin and elasticmachine authored Feb 21, 2025
1 parent 9c2c0cd commit 24d948d
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React, { useState } from 'react';
import React, { useState, useEffect } from 'react';

import {
EuiButton,
Expand Down Expand Up @@ -39,6 +39,16 @@ export const RulesWithGapsOverviewPanel = () => {
});
const [isPopoverOpen, setPopover] = useState(false);

useEffect(() => {
return () => {
// reset filter options when unmounting
setFilterOptions({
gapSearchRange: defaultRangeValue,
showRulesWithGaps: false,
});
};
}, [setFilterOptions]);

const rangeValueToLabel = {
[GapRangeValue.LAST_24_H]: i18n.RULE_GAPS_OVERVIEW_PANEL_LAST_24_HOURS_LABEL,
[GapRangeValue.LAST_3_D]: i18n.RULE_GAPS_OVERVIEW_PANEL_LAST_3_DAYS_LABEL,
Expand Down

0 comments on commit 24d948d

Please sign in to comment.