import { produce } from 'immer'; import { useEffect } from 'react'; import { Link } from 'react-router-dom-v5-compat'; import { SIGV4ConnectionConfig } from '@grafana/aws-sdk'; import { DataSourcePluginOptionsEditorProps, SelectableValue } from '@grafana/data'; import { Box, DataSourceHttpSettings, InlineField, InlineSwitch, Select, Text } from '@grafana/ui'; import { config } from 'app/core/config'; import { AlertManagerDataSourceJsonData, AlertManagerImplementation } from './types'; export type Props = DataSourcePluginOptionsEditorProps; const IMPL_OPTIONS: Array> = [ { value: AlertManagerImplementation.mimir, label: 'Mimir', description: `https://grafana.com/oss/mimir/. An open source, horizontally scalable, highly available, multi-tenant, long-term storage for Prometheus.`, }, { value: AlertManagerImplementation.cortex, label: 'Cortex', description: `https://cortexmetrics.io/`, }, { value: AlertManagerImplementation.prometheus, label: 'Prometheus', description: 'https://prometheus.io/. Does not support editing configuration via API, so contact points and notification policies are read-only.', }, ]; export const ConfigEditor = (props: Props) => { const { options, onOptionsChange } = props; // As we default to Mimir, we need to make sure the implementation is set from the start useEffect(() => { if (!options.jsonData.implementation) { onOptionsChange( produce(options, (draft) => { draft.jsonData.implementation = AlertManagerImplementation.mimir; }) ); } }, [options, onOptionsChange]); return ( <>

Alertmanager