mirror of
https://github.com/grafana/grafana.git
synced 2026-08-26 13:27:30 -05:00
* Add mock method for getting a plugin * Update tests to find "more" button via label * Remove test for Silence action in rule details * Unify alert rule actions to pull from same place * Restore behaviour of only showing incident button when firing * Fix identifier and pause permission/logic * Remove TODO comment related to refactor * Update snapshot for useAbilities * Undo optional param * Rename alert rule menu hook to component * Refactor hook to component * Rename Rule action buttons component * Chore: update style syntax for RuleDetails * Add tests for refactored alert rule menu * Only re-fetch Grafana managed alerts after pausing/resuming * Remove console log and check for extensions * Improve share rule generation of GMA rules * Rename component * Update action * Refactor plugins and fix tests * lint --------- Co-authored-by: Konrad Lalik <konrad.lalik@grafana.com> Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
13 lines
614 B
TypeScript
13 lines
614 B
TypeScript
import { http, HttpResponse } from 'msw';
|
|
|
|
import { PluginMeta } from '@grafana/data';
|
|
import { plugins } from 'app/features/alerting/unified/testSetup/plugins';
|
|
|
|
export const pluginsHandler = (pluginsArray: PluginMeta[] = plugins) =>
|
|
http.get<{ pluginId: string }>(`/api/plugins/:pluginId/settings`, ({ params: { pluginId } }) => {
|
|
const matchingPlugin = pluginsArray.find((plugin) => plugin.id === pluginId);
|
|
return matchingPlugin
|
|
? HttpResponse.json<PluginMeta>(matchingPlugin)
|
|
: HttpResponse.json({ message: 'Plugin not found, no installed plugin with that id' }, { status: 404 });
|
|
});
|