import { css } from '@emotion/css'; import React, { FC } from 'react'; import { GrafanaTheme2 } from '@grafana/data'; import { Button, useStyles2 } from '@grafana/ui'; import { Authorize } from '../../components/Authorize'; import { AmRouteReceiver, FormAmRoute } from '../../types/amroutes'; import { getNotificationsPermissions } from '../../utils/access-control'; import { isVanillaPrometheusAlertManagerDataSource } from '../../utils/datasource'; import { AmRootRouteForm } from './AmRootRouteForm'; import { AmRootRouteRead } from './AmRootRouteRead'; export interface AmRootRouteProps { isEditMode: boolean; onEnterEditMode: () => void; onExitEditMode: () => void; onSave: (data: Partial) => void; receivers: AmRouteReceiver[]; routes: FormAmRoute; alertManagerSourceName: string; } export const AmRootRoute: FC = ({ isEditMode, onSave, onEnterEditMode, onExitEditMode, receivers, routes, alertManagerSourceName, }) => { const styles = useStyles2(getStyles); const permissions = getNotificationsPermissions(alertManagerSourceName); const isReadOnly = isVanillaPrometheusAlertManagerDataSource(alertManagerSourceName); return (
Root policy - default for all alerts
{!isEditMode && !isReadOnly && ( )}

All alerts will go to the default contact point, unless you set additional matchers in the specific routing area.

{isEditMode ? ( ) : ( )}
); }; const getStyles = (theme: GrafanaTheme2) => { return { container: css` background-color: ${theme.colors.background.secondary}; color: ${theme.colors.text.secondary}; padding: ${theme.spacing(2)}; `, titleContainer: css` color: ${theme.colors.text.primary}; display: flex; flex-flow: row nowrap; `, title: css` flex: 100%; `, }; };