Prometheus: fix auth component select for sigv4 option (#73647)

* fix sigV4 selected auth option bug

* use precommit hooks
pull/73959/head
Brendan O'Handley 2 years ago committed by GitHub
parent 8dbd70b91b
commit 4e2710670e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      public/app/plugins/datasource/prometheus/configuration/DataSourceHttpSettingsOverhaul.tsx

@ -1,4 +1,4 @@
import React, { useCallback, useState } from 'react';
import React, { useState } from 'react';
import { DataSourceSettings } from '@grafana/data';
import { Auth, ConnectionSettings, convertLegacyAuthProps } from '@grafana/experimental';
@ -55,16 +55,6 @@ export const DataSourcehttpSettingsOverhaul = (props: Props) => {
customMethods.push(sigV4Option);
}
const onSettingsChange = useCallback(
(change: Partial<DataSourceSettings<PromOptions, {}>>) => {
onOptionsChange({
...options,
...change,
});
},
[options, onOptionsChange]
);
const azureAuthEnabled: boolean =
(azureAuthSettings?.azureAuthSupported && azureAuthSettings.getAzureAuthEnabled(options)) || false;
@ -150,9 +140,8 @@ export const DataSourcehttpSettingsOverhaul = (props: Props) => {
// sigV4Id
if (sigV4AuthToggleEnabled) {
setSigV4Selected(method === sigV4Id);
onSettingsChange({
jsonData: { ...options.jsonData, sigV4Auth: method === sigV4Id },
});
// mutate jsonData here to store the selected option because of auth component issue with onOptionsChange being overridden
options.jsonData.sigV4Auth = method === sigV4Id;
}
// Azure

Loading…
Cancel
Save