grafana/public/app/features/alerting/unified/hooks/useAlertManagerSources.ts
Konrad Lalik 65d7d466d7
Alerting: Improved RBAC for Alert managers (#48344)
* Initial support for grafana or cloud only alert managers

* Handle missing alert manager

* Refactor code, fix tests

* Fix redirect url

* Bring back the test

* Improve missing alert manager warning, add useAlertManagerSourceName tests

* Fix lint errors

* Rename alert manager hook

* Refactor alert manager label creation

* Improve warnings' messages

* Fix linter

* Fix warning condition in RuleEditor
2022-05-05 13:34:58 +02:00

8 lines
293 B
TypeScript

import { useMemo } from 'react';
import { getAlertManagerDataSourcesByPermission } from '../utils/datasource';
export function useAlertManagersByPermission(accessType: 'instance' | 'notification') {
return useMemo(() => getAlertManagerDataSourcesByPermission(accessType), [accessType]);
}