The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/features/alerting/unified/components/contact-points/NewContactPoint.tsx

33 lines
893 B

import React from 'react';
import { RouteChildrenProps } from 'react-router-dom';
import { Alert } from '@grafana/ui';
import { useAlertmanagerConfig } from '../../hooks/useAlertmanagerConfig';
import { useAlertmanager } from '../../state/AlertmanagerContext';
import { NewReceiverView } from '../receivers/NewReceiverView';
const NewContactPoint = (_props: RouteChildrenProps) => {
const { selectedAlertmanager } = useAlertmanager();
const { data, isLoading, error } = useAlertmanagerConfig(selectedAlertmanager);
if (isLoading && !data) {
return 'loading...';
}
if (error) {
return (
<Alert severity="error" title="Failed to fetch contact point">
{String(error)}
</Alert>
);
}
if (!data) {
return null;
}
return <NewReceiverView config={data} alertManagerSourceName={selectedAlertmanager!} />;
};
export default NewContactPoint;