Commit 0fa20cb2 by Shavonn Brown Committed by GitHub

Azure Monitor: Fix Application Insights API key field to allow input (#21738)

* Fix update api key input

* update snapshot
parent 85dad73e
......@@ -296,7 +296,12 @@ export class ConfigEditor extends PureComponent<Props, State> {
onLoadWorkspaces={this.getWorkspaces}
/>
<InsightsConfig options={options} onUpdateOption={this.updateOption} onResetOptionKey={this.resetKey} />
<InsightsConfig
options={options}
onUpdateOption={this.updateOption}
onUpdateSecureOption={this.updateSecureOption}
onResetOptionKey={this.resetKey}
/>
</>
);
}
......
......@@ -35,6 +35,7 @@ const setup = (propOverrides?: object) => {
readOnly: false,
},
onUpdateOption: jest.fn(),
onUpdateSecureOption: jest.fn(),
onResetOptionKey: jest.fn(),
};
......
......@@ -4,16 +4,17 @@ import { AzureDataSourceSettings } from '../types';
export interface Props {
options: AzureDataSourceSettings;
onUpdateOption: (key: string, val: any, secure: boolean) => void;
onUpdateOption: (key: string, val: any) => void;
onUpdateSecureOption: (key: string, val: any) => void;
onResetOptionKey: (key: string) => void;
}
export class InsightsConfig extends PureComponent<Props> {
onAppInsightsAppIdChange = (event: ChangeEvent<HTMLInputElement>) => {
this.props.onUpdateOption('appInsightsAppId', event.target.value, false);
this.props.onUpdateOption('appInsightsAppId', event.target.value);
};
onAppInsightsApiKeyChange = (event: ChangeEvent<HTMLInputElement>) => {
this.props.onUpdateOption('appInsightsApiKey', event.target.value, true);
this.props.onUpdateSecureOption('appInsightsApiKey', event.target.value);
};
onAppInsightsResetApiKey = () => {
......
......@@ -80,6 +80,7 @@ exports[`Render should render component 1`] = `
<InsightsConfig
onResetOptionKey={[Function]}
onUpdateOption={[Function]}
onUpdateSecureOption={[Function]}
options={
Object {
"access": "proxy",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment