mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
import 'whatwg-fetch';
|
|
import { HttpResponse, http } from 'msw';
|
|
import { setupServer } from 'msw/node';
|
|
|
|
import { AccessControlAction } from 'app/types';
|
|
|
|
const alertingServer = setupServer(
|
|
// TODO: Scaffold out test behaviour/configuration for search endpoint
|
|
http.get('/api/search', () => {
|
|
return HttpResponse.json([]);
|
|
}),
|
|
// TODO: Scaffold out test behaviour/configuration for user endpoint
|
|
http.get('/api/user', () => {
|
|
return HttpResponse.json({});
|
|
}),
|
|
// TODO: Scaffold out test behaviour/configuration for alert manager endpoint
|
|
http.get('/api/v1/ngalert', () => {
|
|
return HttpResponse.json({ alertmanagersChoice: 'all', numExternalAlertmanagers: 1 });
|
|
}),
|
|
// TODO: Scaffold out test behaviour/configuration for plugins / incident endpoint
|
|
http.get('/api/plugins/grafana-incident-app/settings', () => {
|
|
return new HttpResponse(null, { status: 200 });
|
|
}),
|
|
|
|
http.get('/api/folders/:folderUid', () => {
|
|
return HttpResponse.json({
|
|
accessControl: { [AccessControlAction.AlertingRuleUpdate]: true },
|
|
});
|
|
}),
|
|
http.get('/api/prometheus/grafana/api/v1/rules', () => {
|
|
return HttpResponse.json([]);
|
|
}),
|
|
http.get('/api/ruler/grafana/api/v1/rules', () => {
|
|
return HttpResponse.json([]);
|
|
}),
|
|
http.post('/api/ruler/grafana/api/v1/rules/:namespaceUID/', async ({ request }) => {
|
|
return HttpResponse.json({
|
|
message: 'rule group updated successfully',
|
|
updated: ['foo', 'bar', 'baz'],
|
|
});
|
|
})
|
|
);
|
|
|
|
export default alertingServer;
|