2020-03-04 09:11:11 -05:00
|
|
|
import React, { PureComponent } from 'react';
|
2020-04-21 11:42:21 +02:00
|
|
|
import { InlineFormLabel, Button, LegacyForms } from '@grafana/ui';
|
2020-04-02 16:18:06 +02:00
|
|
|
const { Input } = LegacyForms;
|
2020-03-04 09:11:11 -05:00
|
|
|
import { AzureDataSourceSettings, AzureDataSourceJsonData, AzureDataSourceSecureJsonData } from '../types';
|
2019-08-19 17:35:44 -04:00
|
|
|
|
|
|
|
|
export interface Props {
|
2019-12-04 14:35:53 -05:00
|
|
|
options: AzureDataSourceSettings;
|
2020-03-04 09:11:11 -05:00
|
|
|
onUpdateJsonDataOption: (
|
|
|
|
|
key: keyof AzureDataSourceJsonData
|
|
|
|
|
) => (event: React.SyntheticEvent<HTMLInputElement | HTMLSelectElement>) => void;
|
|
|
|
|
onUpdateSecureJsonDataOption: (
|
|
|
|
|
key: keyof AzureDataSourceSecureJsonData
|
|
|
|
|
) => (event: React.SyntheticEvent<HTMLInputElement | HTMLSelectElement>) => void;
|
2019-12-04 14:35:53 -05:00
|
|
|
onResetOptionKey: (key: string) => void;
|
2019-08-19 17:35:44 -04:00
|
|
|
}
|
2019-12-04 14:35:53 -05:00
|
|
|
export class InsightsConfig extends PureComponent<Props> {
|
2019-08-19 17:35:44 -04:00
|
|
|
onAppInsightsResetApiKey = () => {
|
2019-12-04 14:35:53 -05:00
|
|
|
this.props.onResetOptionKey('appInsightsApiKey');
|
2019-08-19 17:35:44 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
render() {
|
2020-03-04 09:11:11 -05:00
|
|
|
const { options, onUpdateJsonDataOption, onUpdateSecureJsonDataOption } = this.props;
|
2019-08-19 17:35:44 -04:00
|
|
|
return (
|
|
|
|
|
<>
|
2021-01-14 12:33:41 +00:00
|
|
|
<h3 className="page-heading">Azure Application Insights Details</h3>
|
2019-08-19 17:35:44 -04:00
|
|
|
<div className="gf-form-group">
|
2019-12-04 14:35:53 -05:00
|
|
|
{options.secureJsonFields.appInsightsApiKey ? (
|
2019-08-19 17:35:44 -04:00
|
|
|
<div className="gf-form-inline">
|
|
|
|
|
<div className="gf-form">
|
2020-04-21 11:42:21 +02:00
|
|
|
<InlineFormLabel className="width-12">API Key</InlineFormLabel>
|
2019-08-19 17:35:44 -04:00
|
|
|
<Input className="width-25" placeholder="configured" disabled={true} />
|
|
|
|
|
</div>
|
|
|
|
|
<div className="gf-form">
|
|
|
|
|
<div className="max-width-30 gf-form-inline">
|
|
|
|
|
<Button variant="secondary" type="button" onClick={this.onAppInsightsResetApiKey}>
|
|
|
|
|
reset
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
|
|
|
|
<div className="gf-form-inline">
|
|
|
|
|
<div className="gf-form">
|
2020-04-21 11:42:21 +02:00
|
|
|
<InlineFormLabel className="width-12">API Key</InlineFormLabel>
|
2019-08-19 17:35:44 -04:00
|
|
|
<div className="width-15">
|
|
|
|
|
<Input
|
|
|
|
|
className="width-30"
|
|
|
|
|
placeholder="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
|
2020-07-08 11:05:20 +02:00
|
|
|
value={options.secureJsonData!.appInsightsApiKey || ''}
|
2020-03-04 09:11:11 -05:00
|
|
|
onChange={onUpdateSecureJsonDataOption('appInsightsApiKey')}
|
2019-08-19 17:35:44 -04:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
<div className="gf-form-inline">
|
|
|
|
|
<div className="gf-form">
|
2020-04-21 11:42:21 +02:00
|
|
|
<InlineFormLabel className="width-12">Application ID</InlineFormLabel>
|
2019-08-19 17:35:44 -04:00
|
|
|
<div className="width-15">
|
|
|
|
|
<Input
|
|
|
|
|
className="width-30"
|
2019-12-04 14:35:53 -05:00
|
|
|
value={options.jsonData.appInsightsAppId || ''}
|
2020-03-04 09:11:11 -05:00
|
|
|
onChange={onUpdateJsonDataOption('appInsightsAppId')}
|
2019-08-19 17:35:44 -04:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default InsightsConfig;
|