mirror of
https://github.com/grafana/grafana.git
synced 2026-08-04 18:43:10 -05:00
Prometheus: fix auth component select for sigv4 option (#73647)
* fix sigV4 selected auth option bug * use precommit hooks
This commit is contained in:
+3
-14
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user