mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Synthetics] Fixed alert count in monitor details (#216761)
This PR closes #191328 Before: <img width="1512" alt="Screenshot 2025-04-02 at 10 38 42" src="https://github.com/user-attachments/assets/d4c9c744-afdf-4d1b-8bd9-9447c0945258" /> After: <img width="758" alt="Screenshot 2025-04-02 at 10 38 21" src="https://github.com/user-attachments/assets/c2692a44-db8c-461b-803c-d1834646d514" />
This commit is contained in:
parent
7b934f9034
commit
aa37d539fb
2 changed files with 10 additions and 3 deletions
|
@ -52,6 +52,11 @@ export function useFetchActiveAlerts() {
|
|||
'location.id': selectedLocation?.id,
|
||||
},
|
||||
},
|
||||
{
|
||||
term: {
|
||||
'kibana.alert.status': 'active',
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -62,6 +67,6 @@ export function useFetchActiveAlerts() {
|
|||
return {
|
||||
loading,
|
||||
data,
|
||||
numberOfAlerts: data?.hits?.total.value ?? 0,
|
||||
numberOfActiveAlerts: data?.hits?.total.value ?? 0,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,7 +9,9 @@ import { EuiBadge } from '@elastic/eui';
|
|||
import { useFetchActiveAlerts } from '../hooks/use_fetch_active_alerts';
|
||||
|
||||
export const MonitorAlertsIcon = () => {
|
||||
const { numberOfAlerts } = useFetchActiveAlerts();
|
||||
const { numberOfActiveAlerts } = useFetchActiveAlerts();
|
||||
|
||||
return numberOfAlerts > 0 ? <EuiBadge color="danger">{numberOfAlerts}</EuiBadge> : null;
|
||||
return numberOfActiveAlerts > 0 ? (
|
||||
<EuiBadge color="danger">{numberOfActiveAlerts}</EuiBadge>
|
||||
) : null;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue