From cdfc6baea414adf01e0234081520e3a3996648ff Mon Sep 17 00:00:00 2001 From: Tom Ratcliffe Date: Fri, 26 Apr 2024 09:26:54 +0100 Subject: [PATCH] Remove unused `fetchAlerts` method --- .../alerting/unified/api/alertmanager.ts | 39 +------------------ 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/public/app/features/alerting/unified/api/alertmanager.ts b/public/app/features/alerting/unified/api/alertmanager.ts index 3d5bee320a4..97fd5bfe321 100644 --- a/public/app/features/alerting/unified/api/alertmanager.ts +++ b/public/app/features/alerting/unified/api/alertmanager.ts @@ -1,15 +1,13 @@ import { lastValueFrom } from 'rxjs'; -import { isObject, urlUtil } from '@grafana/data'; +import { isObject } from '@grafana/data'; import { getBackendSrv, isFetchError } from '@grafana/runtime'; import { - AlertmanagerAlert, AlertManagerCortexConfig, AlertmanagerGroup, AlertmanagerStatus, ExternalAlertmanagerConfig, ExternalAlertmanagersResponse, - Matcher, Receiver, TestReceiversAlert, TestReceiversPayload, @@ -77,37 +75,6 @@ export async function deleteAlertManagerConfig(alertManagerSourceName: string): ); } -export async function fetchAlerts( - alertmanagerSourceName: string, - matchers?: Matcher[], - silenced = true, - active = true, - inhibited = true -): Promise { - const filters = - urlUtil.toUrlParams({ silenced, active, inhibited }) + - matchers - ?.map( - (matcher) => - `filter=${encodeURIComponent( - `${escapeQuotes(matcher.name)}=${matcher.isRegex ? '~' : ''}"${escapeQuotes(matcher.value)}"` - )}` - ) - .join('&') || ''; - - const result = await lastValueFrom( - getBackendSrv().fetch({ - url: - `/api/alertmanager/${getDatasourceAPIUid(alertmanagerSourceName)}/api/v2/alerts` + - (filters ? '?' + filters : ''), - showErrorAlert: false, - showSuccessAlert: false, - }) - ); - - return result.data; -} - export async function fetchAlertGroups(alertmanagerSourceName: string): Promise { const result = await lastValueFrom( getBackendSrv().fetch({ @@ -234,7 +201,3 @@ export async function fetchExternalAlertmanagerConfig(): Promise