diff --git a/src/ConfigEditor/Auth/auth-method/AuthMethodSettings.tsx b/src/ConfigEditor/Auth/auth-method/AuthMethodSettings.tsx index 29d1893..edb1af0 100644 --- a/src/ConfigEditor/Auth/auth-method/AuthMethodSettings.tsx +++ b/src/ConfigEditor/Auth/auth-method/AuthMethodSettings.tsx @@ -1,10 +1,10 @@ import React, { ReactElement, useMemo, useState } from 'react'; import { css } from '@emotion/css'; -import { useTheme2, Select } from '@grafana/ui'; +import { useTheme2, Select, Field } from '@grafana/ui'; import { SelectableValue } from '@grafana/data'; import { BasicAuth, Props as BasicAuthProps } from './BasicAuth'; import { ConfigSubSection } from '../../ConfigSection'; -import { AuthMethod, CustomMethod, CustomMethodId , AuthMethodSelectOption } from '../types'; +import { AuthMethod, CustomMethod, CustomMethodId, AuthMethodSelectOption } from '../types'; const defaultOptions: Record> = { [AuthMethod.BasicAuth]: { @@ -83,7 +83,7 @@ export const AuthMethodSettings = ({ preparedDefaultOptions[k] = { ...defaultOptions[k], ...defaultOptionsOverrides?.[k], - } + }; } const allOptions: Record> = { @@ -119,11 +119,11 @@ export const AuthMethodSettings = ({ AuthFieldsComponent = customMethods?.find((m) => m.id === selected)?.component ?? null; } - const title = hasSelect ? 'Authentication methods' : preparedOptions[0].label ?? ''; + const title = hasSelect ? 'Authentication methods' : (preparedOptions[0].label ?? ''); const description = hasSelect ? 'Choose an authentication method to access the data source' - : preparedOptions[0].description ?? ''; + : (preparedOptions[0].description ?? ''); const styles = { authMethods: css({ @@ -142,15 +142,18 @@ export const AuthMethodSettings = ({
{hasSelect && ( - { + setAuthMethodChanged(true); + onAuthMethodSelect(option.value!); + }} + disabled={readOnly} + /> + )} {AuthFieldsComponent &&
{AuthFieldsComponent}
}