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/plugins/datasource/alertmanager/ConfigEditor.tsx

58 lines
1.8 KiB

import React from 'react';
import { DataSourcePluginOptionsEditorProps, SelectableValue } from '@grafana/data';
import { DataSourceHttpSettings, InlineFormLabel, Select } from '@grafana/ui';
import { AlertManagerDataSourceJsonData, AlertManagerImplementation } from './types';
export type Props = DataSourcePluginOptionsEditorProps<AlertManagerDataSourceJsonData>;
const IMPL_OPTIONS: SelectableValue[] = [
{
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: React.FC<Props> = ({ options, onOptionsChange }) => {
return (
<>
<h3 className="page-heading">Alertmanager</h3>
<div className="gf-form-group">
<div className="gf-form-inline">
<div className="gf-form">
<InlineFormLabel width={13}>Implementation</InlineFormLabel>
<Select
width={40}
options={IMPL_OPTIONS}
value={options.jsonData.implementation || AlertManagerImplementation.cortex}
onChange={(value) =>
onOptionsChange({
...options,
jsonData: {
...options.jsonData,
implementation: value.value as AlertManagerImplementation,
},
})
}
/>
</div>
</div>
</div>
<DataSourceHttpSettings
defaultUrl={''}
dataSourceConfig={options}
showAccessOptions={true}
onChange={onOptionsChange}
/>
</>
);
};