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

* Fix update api key input

* update snapshot
This commit is contained in:
Shavonn Brown 2020-01-28 23:47:35 -05:00 committed by GitHub
parent 85dad73e9d
commit 0fa20cb231
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 4 deletions

View File

@ -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}
/>
</>
);
}

View File

@ -35,6 +35,7 @@ const setup = (propOverrides?: object) => {
readOnly: false,
},
onUpdateOption: jest.fn(),
onUpdateSecureOption: jest.fn(),
onResetOptionKey: jest.fn(),
};

View File

@ -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 = () => {

View File

@ -80,6 +80,7 @@ exports[`Render should render component 1`] = `
<InsightsConfig
onResetOptionKey={[Function]}
onUpdateOption={[Function]}
onUpdateSecureOption={[Function]}
options={
Object {
"access": "proxy",