import React, { FunctionComponent, useMemo } from 'react'; import { AzureCredentialsForm } from './AzureCredentialsForm'; import { Button, Alert } from '@grafana/ui'; import { AzureDataSourceSettings } from '../types'; import { getCredentials } from '../credentials'; export interface Props { options: AzureDataSourceSettings; updateOptions: (optionsFunc: (options: AzureDataSourceSettings) => AzureDataSourceSettings) => void; } export const AnalyticsConfig: FunctionComponent = (props: Props) => { const { updateOptions } = props; const primaryCredentials = useMemo(() => getCredentials(props.options), [props.options]); // Only show a section for setting LogAnalytics credentials if // they were set from before with different values and the // authType is supported const logCredentialsEnabled = primaryCredentials.authType === 'clientsecret' && props.options.jsonData.azureLogAnalyticsSameAs === false; const onClearAzLogsCreds = () => { updateOptions((options) => { return { ...options, jsonData: { ...options.jsonData, azureLogAnalyticsSameAs: true, }, }; }); }; return logCredentialsEnabled ? ( <>

Azure Monitor Logs

<> Using different credentials for Azure Monitor Logs is no longer supported. Authentication information above will be used instead. Please create a new data source with the credentials below. ) : null; }; export default AnalyticsConfig;