import React from 'react'; import { SIGV4ConnectionConfig } from '@grafana/aws-sdk'; import { DataSourcePluginOptionsEditorProps, DataSourceSettings } from '@grafana/data'; import { AlertingSettings, DataSourceHttpSettings, Alert } from '@grafana/ui'; import { config } from 'app/core/config'; import { getAllAlertmanagerDataSources } from 'app/features/alerting/unified/utils/alertmanager'; import { PromOptions } from '../types'; import { AzureAuthSettings } from './AzureAuthSettings'; import { hasCredentials, setDefaultCredentials, resetCredentials } from './AzureCredentialsConfig'; import { PromSettings } from './PromSettings'; export type Props = DataSourcePluginOptionsEditorProps; export const ConfigEditor = (props: Props) => { const { options, onOptionsChange } = props; const alertmanagers = getAllAlertmanagerDataSources(); const azureAuthSettings = { azureAuthSupported: !!config.featureToggles.prometheus_azure_auth, getAzureAuthEnabled: (config: DataSourceSettings): boolean => hasCredentials(config), setAzureAuthEnabled: (config: DataSourceSettings, enabled: boolean) => enabled ? setDefaultCredentials(config) : resetCredentials(config), azureSettingsUI: AzureAuthSettings, }; return ( <> {options.access === 'direct' && ( Browser access mode in the Prometheus datasource is deprecated and will be removed in a future release. )} } /> alertmanagerDataSources={alertmanagers} options={options} onOptionsChange={onOptionsChange} /> ); };