Skip to content

Commit

Permalink
Link stack rule details page refresh button to alerts table
Browse files Browse the repository at this point in the history
  • Loading branch information
umbopepato committed Oct 10, 2024
1 parent dbc0e6f commit 126bb9f
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import React, { lazy, useCallback } from 'react';
import React, { lazy, useCallback, useMemo } from 'react';
import { i18n } from '@kbn/i18n';
import { EuiSpacer, EuiFlexGroup, EuiFlexItem, EuiTabbedContent } from '@elastic/eui';
import { AlertStatusValues, ALERTING_FEATURE_ID } from '@kbn/alerting-plugin/common';
Expand Down Expand Up @@ -71,6 +71,9 @@ export function RuleComponent({
}: RuleComponentProps) {
const { ruleTypeRegistry, actionTypeRegistry, alertsTableConfigurationRegistry } =
useKibana().services;
// The lastReloadRequestTime should be updated when the refreshToken changes
// eslint-disable-next-line react-hooks/exhaustive-deps
const lastReloadRequestTime = useMemo(() => +new Date(), [refreshToken]);

const alerts = Object.entries(ruleSummary.alerts)
.map(([alertId, alert]) => alertToListItem(durationEpoch, alertId, alert))
Expand Down Expand Up @@ -110,6 +113,7 @@ export function RuleComponent({
}
query={{ bool: { filter: { term: { [ALERT_RULE_UUID]: rule.id } } } }}
showAlertStatusWithFlapping
lastReloadRequestTime={lastReloadRequestTime}
/>
);
}
Expand All @@ -124,6 +128,7 @@ export function RuleComponent({
}, [
alerts,
alertsTableConfigurationRegistry,
lastReloadRequestTime,
onMuteAction,
readOnly,
rule.consumer,
Expand Down

0 comments on commit 126bb9f

Please sign in to comment.