mirror of
https://github.com/grafana/grafana.git
synced 2025-02-09 23:16:16 -06:00
Prometheus: Fix config bug for sigv4 auth (#76390)
fix config bug for selecting sigv4
This commit is contained in:
parent
9d8be05cce
commit
67e3e576d0
@ -1,7 +1,7 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
|
|
||||||
import { DataSourceSettings } from '@grafana/data';
|
import { DataSourceSettings } from '@grafana/data';
|
||||||
import { Auth, ConnectionSettings, convertLegacyAuthProps } from '@grafana/experimental';
|
import { Auth, ConnectionSettings, convertLegacyAuthProps, AuthMethod } from '@grafana/experimental';
|
||||||
import { SecureSocksProxySettings, useTheme2 } from '@grafana/ui';
|
import { SecureSocksProxySettings, useTheme2 } from '@grafana/ui';
|
||||||
import { AzureAuthSettings } from '@grafana/ui/src/components/DataSourceSettings/types';
|
import { AzureAuthSettings } from '@grafana/ui/src/components/DataSourceSettings/types';
|
||||||
|
|
||||||
@ -127,21 +127,12 @@ export const DataSourcehttpSettingsOverhaul = (props: Props) => {
|
|||||||
/>
|
/>
|
||||||
<hr className={`${styles.hrTopSpace} ${styles.hrBottomSpace}`} />
|
<hr className={`${styles.hrTopSpace} ${styles.hrBottomSpace}`} />
|
||||||
<Auth
|
<Auth
|
||||||
// Reshaped legacy props
|
|
||||||
{...newAuthProps}
|
{...newAuthProps}
|
||||||
// Your custom auth methods
|
|
||||||
customMethods={customMethods}
|
customMethods={customMethods}
|
||||||
// Still need to call `onAuthMethodSelect` function from
|
|
||||||
// `newAuthProps` to store the legacy data correctly.
|
|
||||||
// Also make sure to store the data about your component
|
|
||||||
// being selected/unselected.
|
|
||||||
onAuthMethodSelect={(method) => {
|
onAuthMethodSelect={(method) => {
|
||||||
// handle selecting of custom methods
|
|
||||||
// sigV4Id
|
// sigV4Id
|
||||||
if (sigV4AuthToggleEnabled) {
|
if (sigV4AuthToggleEnabled) {
|
||||||
setSigV4Selected(method === sigV4Id);
|
setSigV4Selected(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
|
// Azure
|
||||||
@ -150,7 +141,16 @@ export const DataSourcehttpSettingsOverhaul = (props: Props) => {
|
|||||||
azureAuthSettings.setAzureAuthEnabled(options, method === azureAuthId);
|
azureAuthSettings.setAzureAuthEnabled(options, method === azureAuthId);
|
||||||
}
|
}
|
||||||
|
|
||||||
newAuthProps.onAuthMethodSelect(method);
|
onOptionsChange({
|
||||||
|
...options,
|
||||||
|
basicAuth: method === AuthMethod.BasicAuth,
|
||||||
|
withCredentials: method === AuthMethod.CrossSiteCredentials,
|
||||||
|
jsonData: {
|
||||||
|
...options.jsonData,
|
||||||
|
sigV4Auth: method === sigV4Id,
|
||||||
|
oauthPassThru: method === AuthMethod.OAuthForward,
|
||||||
|
},
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
// If your method is selected pass its id to `selectedMethod`,
|
// If your method is selected pass its id to `selectedMethod`,
|
||||||
// otherwise pass the id from converted legacy data
|
// otherwise pass the id from converted legacy data
|
||||||
|
@ -46,6 +46,7 @@ export interface PromOptions extends DataSourceJsonData {
|
|||||||
incrementalQueryOverlapWindow?: string;
|
incrementalQueryOverlapWindow?: string;
|
||||||
disableRecordingRules?: boolean;
|
disableRecordingRules?: boolean;
|
||||||
sigV4Auth?: boolean;
|
sigV4Auth?: boolean;
|
||||||
|
oauthPassThru?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ExemplarTraceIdDestination = {
|
export type ExemplarTraceIdDestination = {
|
||||||
|
Loading…
Reference in New Issue
Block a user