Skip to content

Commit

Permalink
fixed logic to extend all alerts (#1033)
Browse files Browse the repository at this point in the history
Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com>
(cherry picked from commit e2841fa)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Jul 2, 2024
1 parent bca2c2c commit e7dc89f
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions public/store/AlertsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ export class AlertsStore {
}

if (getAlertsRes.ok) {
onPartialAlertsFetched?.(getAlertsRes.response.alerts)
allAlerts = allAlerts.concat(getAlertsRes.response.alerts);
alertsCount = getAlertsRes.response.alerts.length;
const alerts = this.extendAlerts(getAlertsRes.response.alerts, detectorId, detectorName);
onPartialAlertsFetched?.(alerts);
allAlerts = allAlerts.concat(alerts);
alertsCount = alerts.length;
} else {
alertsCount = 0;
errorNotificationToast(this.notifications, 'retrieve', 'alerts', getAlertsRes.error);
Expand All @@ -59,7 +60,11 @@ export class AlertsStore {
alertsCount === maxAlertsReturned
);

allAlerts = allAlerts.map((alert) => {
return allAlerts;
}

private extendAlerts(allAlerts: any[], detectorId: string, detectorName: string) {
return allAlerts.map((alert) => {
if (!alert.detector_id) {
alert.detector_id = detectorId;
}
Expand All @@ -69,7 +74,5 @@ export class AlertsStore {
detectorName: detectorName,
};
});

return allAlerts;
}
}

0 comments on commit e7dc89f

Please sign in to comment.