import React, { PureComponent, ChangeEvent } from 'react'; import { FormLabel, Button, Input } from '@grafana/ui'; import { AzureDataSourceSettings } from '../types'; export interface Props { options: AzureDataSourceSettings; onUpdateOption: (key: string, val: any) => void; onUpdateSecureOption: (key: string, val: any) => void; onResetOptionKey: (key: string) => void; } export class InsightsConfig extends PureComponent { onAppInsightsAppIdChange = (event: ChangeEvent) => { this.props.onUpdateOption('appInsightsAppId', event.target.value); }; onAppInsightsApiKeyChange = (event: ChangeEvent) => { this.props.onUpdateSecureOption('appInsightsApiKey', event.target.value); }; onAppInsightsResetApiKey = () => { this.props.onResetOptionKey('appInsightsApiKey'); }; render() { const { options } = this.props; return ( <>

Application Insights Details

{options.secureJsonFields.appInsightsApiKey ? (
API Key
) : (
API Key
)}
Application ID
); } } export default InsightsConfig;