D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
share
/
grafana
/
public
/
app
/
features
/
alerting
/
unified
/
hooks
/
Filename :
useManagedAlertStateHistory.ts
back
Copy
import { useEffect } from 'react'; import { useDispatch } from 'app/types'; import { StateHistoryItem } from 'app/types/unified-alerting'; import { fetchGrafanaAnnotationsAction } from '../state/actions'; import { AsyncRequestState } from '../utils/redux'; import { useUnifiedAlertingSelector } from './useUnifiedAlertingSelector'; export function useManagedAlertStateHistory(alertId: string) { const dispatch = useDispatch(); const history = useUnifiedAlertingSelector<AsyncRequestState<StateHistoryItem[]>>( (state) => state.managedAlertStateHistory ); useEffect(() => { dispatch(fetchGrafanaAnnotationsAction(alertId)); }, [dispatch, alertId]); return history; }