mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
Co-authored-by: Jean-Philippe Quéméner <JohnnyQQQQ@users.noreply.github.com> Co-authored-by: gotjosh <josue.abreu@gmail.com> Co-authored-by: brendamuir <100768211+brendamuir@users.noreply.github.com>
23 lines
1011 B
TypeScript
23 lines
1011 B
TypeScript
import React from 'react';
|
|
|
|
import { AlertingPageWrapper } from './components/AlertingPageWrapper';
|
|
import AlertmanagerConfig from './components/admin/AlertmanagerConfig';
|
|
import { ExternalAlertmanagers } from './components/admin/ExternalAlertmanagers';
|
|
import { useAlertManagerSourceName } from './hooks/useAlertManagerSourceName';
|
|
import { useAlertManagersByPermission } from './hooks/useAlertManagerSources';
|
|
import { GRAFANA_RULES_SOURCE_NAME } from './utils/datasource';
|
|
|
|
export default function Admin(): JSX.Element {
|
|
const alertManagers = useAlertManagersByPermission('notification');
|
|
const [alertManagerSourceName] = useAlertManagerSourceName(alertManagers);
|
|
|
|
const isGrafanaAmSelected = alertManagerSourceName === GRAFANA_RULES_SOURCE_NAME;
|
|
|
|
return (
|
|
<AlertingPageWrapper pageId="alerting-admin">
|
|
<AlertmanagerConfig test-id="admin-alertmanagerconfig" />
|
|
{isGrafanaAmSelected && <ExternalAlertmanagers test-id="admin-externalalertmanagers" />}
|
|
</AlertingPageWrapper>
|
|
);
|
|
}
|