Submit
Path:
~
/
/
usr
/
share
/
grafana
/
public
/
app
/
features
/
alerting
/
unified
/
mocks
/
File Content:
alertmanagerApi.ts
import 'whatwg-fetch'; import { http, HttpResponse } from 'msw'; import { SetupServer } from 'msw/node'; import { AlertmanagerChoice, AlertManagerCortexConfig, ExternalAlertmanagersResponse, } from '../../../../plugins/datasource/alertmanager/types'; import { AlertmanagersChoiceResponse } from '../api/alertmanagerApi'; import { getDatasourceAPIUid } from '../utils/datasource'; export const defaultAlertmanagerChoiceResponse: AlertmanagersChoiceResponse = { alertmanagersChoice: AlertmanagerChoice.Internal, numExternalAlertmanagers: 0, }; export function mockAlertmanagerChoiceResponse(server: SetupServer, response: AlertmanagersChoiceResponse) { server.use(http.get('/api/v1/ngalert', () => HttpResponse.json(response))); } export const emptyExternalAlertmanagersResponse: ExternalAlertmanagersResponse = { data: { droppedAlertManagers: [], activeAlertManagers: [], }, }; export function mockAlertmanagersResponse(server: SetupServer, response: ExternalAlertmanagersResponse) { server.use(http.get('/api/v1/ngalert/alertmanagers', () => HttpResponse.json(response))); } export function mockAlertmanagerConfigResponse( server: SetupServer, alertManagerSourceName: string, response: AlertManagerCortexConfig ) { server.use( http.get(`/api/alertmanager/${getDatasourceAPIUid(alertManagerSourceName)}/config/api/v1/alerts`, () => HttpResponse.json(response) ) ); }
Submit
FILE
FOLDER
INFO
Name
Size
Permission
Action
alertRuleApi.ts
587 bytes
0644
alertmanagerApi.ts
1420 bytes
0644
grafana-notifiers.ts
10548 bytes
0644
plugins.ts
531 bytes
0644
rulerApi.ts
740 bytes
0644
templatesApi.ts
547 bytes
0644
N4ST4R_ID | Naxtarrr