mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-11 04:39:59 +08:00
fix(BUG): alert mapping is updated (#402)
This commit is contained in:
parent
4427f60708
commit
b47a3e0932
@ -1,5 +1,5 @@
|
||||
import React, { useState } from 'react';
|
||||
import { Group } from 'types/api/alerts/getGroups';
|
||||
import { Alerts } from 'types/api/alerts/getAll';
|
||||
|
||||
import { Value } from './Filter';
|
||||
import Filter from './Filter';
|
||||
@ -8,7 +8,7 @@ import NoFilterTable from './NoFilterTable';
|
||||
import { NoTableContainer } from './styles';
|
||||
|
||||
const TriggeredAlerts = ({ allAlerts }: TriggeredAlertsProps): JSX.Element => {
|
||||
const allInitialAlerts = allAlerts?.alerts || [];
|
||||
const allInitialAlerts = allAlerts || [];
|
||||
|
||||
const [selectedGroup, setSelectedGroup] = useState<Value[]>([]);
|
||||
const [selectedFilter, setSelectedFilter] = useState<Value[]>([]);
|
||||
@ -57,7 +57,7 @@ const TriggeredAlerts = ({ allAlerts }: TriggeredAlertsProps): JSX.Element => {
|
||||
};
|
||||
|
||||
interface TriggeredAlertsProps {
|
||||
allAlerts: Group;
|
||||
allAlerts: Alerts[];
|
||||
}
|
||||
|
||||
export default TriggeredAlerts;
|
||||
|
@ -2,6 +2,7 @@ import getGroupApi from 'api/alerts/getGroup';
|
||||
import Spinner from 'components/Spinner';
|
||||
import { State } from 'hooks/useFetch';
|
||||
import React, { useCallback, useEffect, useState } from 'react';
|
||||
import { Alerts } from 'types/api/alerts/getAll';
|
||||
import { PayloadProps } from 'types/api/alerts/getGroups';
|
||||
|
||||
import TriggerComponent from './TriggeredAlert';
|
||||
@ -64,7 +65,13 @@ const TriggeredAlerts = (): JSX.Element => {
|
||||
return <Spinner height="75vh" tip="Loading Alerts..." />;
|
||||
}
|
||||
|
||||
return <TriggerComponent allAlerts={groupState.payload[0]} />;
|
||||
const initialAlerts: Alerts[] = [];
|
||||
|
||||
const allAlerts: Alerts[] = groupState.payload.reduce((acc, curr) => {
|
||||
return [...acc, ...curr.alerts];
|
||||
}, initialAlerts);
|
||||
|
||||
return <TriggerComponent allAlerts={allAlerts} />;
|
||||
};
|
||||
|
||||
export default TriggeredAlerts;
|
||||
|
Loading…
x
Reference in New Issue
Block a user