|
|
|
@ -1,7 +1,7 @@ |
|
|
|
|
import React, { useState } from 'react'; |
|
|
|
|
|
|
|
|
|
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 { AzureAuthSettings } from '@grafana/ui/src/components/DataSourceSettings/types'; |
|
|
|
|
|
|
|
|
@ -127,21 +127,12 @@ export const DataSourcehttpSettingsOverhaul = (props: Props) => { |
|
|
|
|
/> |
|
|
|
|
<hr className={`${styles.hrTopSpace} ${styles.hrBottomSpace}`} /> |
|
|
|
|
<Auth |
|
|
|
|
// Reshaped legacy props
|
|
|
|
|
{...newAuthProps} |
|
|
|
|
// Your custom auth methods
|
|
|
|
|
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) => { |
|
|
|
|
// handle selecting of custom methods
|
|
|
|
|
// sigV4Id
|
|
|
|
|
if (sigV4AuthToggleEnabled) { |
|
|
|
|
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
|
|
|
|
@ -150,7 +141,16 @@ export const DataSourcehttpSettingsOverhaul = (props: Props) => { |
|
|
|
|
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`,
|
|
|
|
|
// otherwise pass the id from converted legacy data
|
|
|
|
|