mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Plugins: add UI for more supported datasources with secure socks proxy feature toggle (#61962)
This commit is contained in:
parent
0c8a2bbfd5
commit
0a1f31814a
@ -0,0 +1,45 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
import { DataSourceJsonData, DataSourcePluginOptionsEditorProps } from '@grafana/data';
|
||||||
|
|
||||||
|
import { InlineSwitch } from '../../components/Switch/Switch';
|
||||||
|
import { InlineField } from '../Forms/InlineField';
|
||||||
|
|
||||||
|
export interface Props<T extends DataSourceJsonData>
|
||||||
|
extends Pick<DataSourcePluginOptionsEditorProps<T>, 'options' | 'onOptionsChange'> {}
|
||||||
|
|
||||||
|
export interface SecureSocksProxyConfig extends DataSourceJsonData {
|
||||||
|
enableSecureSocksProxy?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function SecureSocksProxySettings<T extends SecureSocksProxyConfig>({
|
||||||
|
options,
|
||||||
|
onOptionsChange,
|
||||||
|
}: Props<T>): JSX.Element {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h3 className="page-heading">Secure Socks Proxy</h3>
|
||||||
|
<div className="gf-form-group">
|
||||||
|
<div className="gf-form-inline">
|
||||||
|
<div className="gf-form">
|
||||||
|
<InlineField
|
||||||
|
labelWidth={26}
|
||||||
|
label="Enabled"
|
||||||
|
tooltip="Connect to this datasource via the secure socks proxy."
|
||||||
|
>
|
||||||
|
<InlineSwitch
|
||||||
|
value={options.jsonData.enableSecureSocksProxy ?? false}
|
||||||
|
onChange={(event) =>
|
||||||
|
onOptionsChange({
|
||||||
|
...options,
|
||||||
|
jsonData: { ...options.jsonData, enableSecureSocksProxy: event!.currentTarget.checked },
|
||||||
|
})
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</InlineField>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
@ -185,6 +185,7 @@ export {
|
|||||||
export { ErrorWithStack } from './ErrorBoundary/ErrorWithStack';
|
export { ErrorWithStack } from './ErrorBoundary/ErrorWithStack';
|
||||||
export { DataSourceHttpSettings } from './DataSourceSettings/DataSourceHttpSettings';
|
export { DataSourceHttpSettings } from './DataSourceSettings/DataSourceHttpSettings';
|
||||||
export { AlertingSettings } from './DataSourceSettings/AlertingSettings';
|
export { AlertingSettings } from './DataSourceSettings/AlertingSettings';
|
||||||
|
export { SecureSocksProxySettings } from './DataSourceSettings/SecureSocksProxySettings';
|
||||||
export { TLSAuthSettings } from './DataSourceSettings/TLSAuthSettings';
|
export { TLSAuthSettings } from './DataSourceSettings/TLSAuthSettings';
|
||||||
export { CertificationKey } from './DataSourceSettings/CertificationKey';
|
export { CertificationKey } from './DataSourceSettings/CertificationKey';
|
||||||
export { Spinner } from './Spinner/Spinner';
|
export { Spinner } from './Spinner/Spinner';
|
||||||
|
@ -2,7 +2,7 @@ import React, { useEffect, useRef } from 'react';
|
|||||||
|
|
||||||
import { SIGV4ConnectionConfig } from '@grafana/aws-sdk';
|
import { SIGV4ConnectionConfig } from '@grafana/aws-sdk';
|
||||||
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
|
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
|
||||||
import { Alert, DataSourceHttpSettings } from '@grafana/ui';
|
import { Alert, DataSourceHttpSettings, SecureSocksProxySettings } from '@grafana/ui';
|
||||||
import { config } from 'app/core/config';
|
import { config } from 'app/core/config';
|
||||||
|
|
||||||
import { ElasticsearchOptions } from '../types';
|
import { ElasticsearchOptions } from '../types';
|
||||||
@ -57,6 +57,10 @@ export const ConfigEditor = (props: Props) => {
|
|||||||
renderSigV4Editor={<SIGV4ConnectionConfig {...props}></SIGV4ConnectionConfig>}
|
renderSigV4Editor={<SIGV4ConnectionConfig {...props}></SIGV4ConnectionConfig>}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{config.featureToggles.secureSocksDatasourceProxy && (
|
||||||
|
<SecureSocksProxySettings options={options} onOptionsChange={onOptionsChange} />
|
||||||
|
)}
|
||||||
|
|
||||||
<ElasticDetails value={options} onChange={onOptionsChange} />
|
<ElasticDetails value={options} onChange={onOptionsChange} />
|
||||||
|
|
||||||
<LogsConfig
|
<LogsConfig
|
||||||
|
@ -6,7 +6,15 @@ import {
|
|||||||
onUpdateDatasourceJsonDataOptionSelect,
|
onUpdateDatasourceJsonDataOptionSelect,
|
||||||
onUpdateDatasourceJsonDataOptionChecked,
|
onUpdateDatasourceJsonDataOptionChecked,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { Alert, DataSourceHttpSettings, InlineFormLabel, LegacyForms, Select } from '@grafana/ui';
|
import {
|
||||||
|
Alert,
|
||||||
|
DataSourceHttpSettings,
|
||||||
|
InlineFormLabel,
|
||||||
|
LegacyForms,
|
||||||
|
Select,
|
||||||
|
SecureSocksProxySettings,
|
||||||
|
} from '@grafana/ui';
|
||||||
|
import { config } from 'app/core/config';
|
||||||
import store from 'app/core/store';
|
import store from 'app/core/store';
|
||||||
|
|
||||||
import { GraphiteOptions, GraphiteType } from '../types';
|
import { GraphiteOptions, GraphiteType } from '../types';
|
||||||
@ -75,6 +83,9 @@ export class ConfigEditor extends PureComponent<Props, State> {
|
|||||||
dataSourceConfig={options}
|
dataSourceConfig={options}
|
||||||
onChange={onOptionsChange}
|
onChange={onOptionsChange}
|
||||||
/>
|
/>
|
||||||
|
{config.featureToggles.secureSocksDatasourceProxy && (
|
||||||
|
<SecureSocksProxySettings options={options} onOptionsChange={onOptionsChange} />
|
||||||
|
)}
|
||||||
<h3 className="page-heading">Graphite details</h3>
|
<h3 className="page-heading">Graphite details</h3>
|
||||||
<div className="gf-form-group">
|
<div className="gf-form-group">
|
||||||
<div className="gf-form-inline">
|
<div className="gf-form-inline">
|
||||||
|
@ -11,7 +11,17 @@ import {
|
|||||||
onUpdateDatasourceSecureJsonDataOption,
|
onUpdateDatasourceSecureJsonDataOption,
|
||||||
updateDatasourcePluginJsonDataOption,
|
updateDatasourcePluginJsonDataOption,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { Alert, DataSourceHttpSettings, InfoBox, InlineField, InlineFormLabel, LegacyForms, Select } from '@grafana/ui';
|
import {
|
||||||
|
Alert,
|
||||||
|
DataSourceHttpSettings,
|
||||||
|
InfoBox,
|
||||||
|
InlineField,
|
||||||
|
InlineFormLabel,
|
||||||
|
LegacyForms,
|
||||||
|
Select,
|
||||||
|
SecureSocksProxySettings,
|
||||||
|
} from '@grafana/ui';
|
||||||
|
import { config } from 'app/core/config';
|
||||||
|
|
||||||
const { Input, SecretFormField } = LegacyForms;
|
const { Input, SecretFormField } = LegacyForms;
|
||||||
import { BROWSER_MODE_DISABLED_MESSAGE } from '../constants';
|
import { BROWSER_MODE_DISABLED_MESSAGE } from '../constants';
|
||||||
@ -316,6 +326,10 @@ export class ConfigEditor extends PureComponent<Props, State> {
|
|||||||
onChange={onOptionsChange}
|
onChange={onOptionsChange}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{config.featureToggles.secureSocksDatasourceProxy && (
|
||||||
|
<SecureSocksProxySettings options={options} onOptionsChange={onOptionsChange} />
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="gf-form-group">
|
<div className="gf-form-group">
|
||||||
<div>
|
<div>
|
||||||
<h3 className="page-heading">InfluxDB Details</h3>
|
<h3 className="page-heading">InfluxDB Details</h3>
|
||||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
|
|
||||||
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
|
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
import { DataSourceHttpSettings } from '@grafana/ui';
|
import { DataSourceHttpSettings, SecureSocksProxySettings } from '@grafana/ui';
|
||||||
import { SpanBarSettings } from '@jaegertracing/jaeger-ui-components';
|
import { SpanBarSettings } from '@jaegertracing/jaeger-ui-components';
|
||||||
import { NodeGraphSettings } from 'app/core/components/NodeGraphSettings';
|
import { NodeGraphSettings } from 'app/core/components/NodeGraphSettings';
|
||||||
import { TraceToLogsSettings } from 'app/core/components/TraceToLogs/TraceToLogsSettings';
|
import { TraceToLogsSettings } from 'app/core/components/TraceToLogs/TraceToLogsSettings';
|
||||||
@ -20,6 +20,10 @@ export const ConfigEditor = ({ options, onOptionsChange }: Props) => {
|
|||||||
onChange={onOptionsChange}
|
onChange={onOptionsChange}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{config.featureToggles.secureSocksDatasourceProxy && (
|
||||||
|
<SecureSocksProxySettings options={options} onOptionsChange={onOptionsChange} />
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="gf-form-group">
|
<div className="gf-form-group">
|
||||||
<TraceToLogsSettings options={options} onOptionsChange={onOptionsChange} />
|
<TraceToLogsSettings options={options} onOptionsChange={onOptionsChange} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import {
|
import { DataSourcePluginOptionsEditorProps, DataSourceSettings } from '@grafana/data';
|
||||||
DataSourcePluginOptionsEditorProps,
|
|
||||||
DataSourceSettings,
|
|
||||||
onUpdateDatasourceJsonDataOptionChecked,
|
|
||||||
} from '@grafana/data';
|
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
import { AlertingSettings, DataSourceHttpSettings, InlineField, InlineSwitch } from '@grafana/ui';
|
import { AlertingSettings, DataSourceHttpSettings, SecureSocksProxySettings } from '@grafana/ui';
|
||||||
|
|
||||||
import { LokiOptions } from '../types';
|
import { LokiOptions } from '../types';
|
||||||
|
|
||||||
@ -32,7 +28,6 @@ const setDerivedFields = makeJsonUpdater('derivedFields');
|
|||||||
|
|
||||||
export const ConfigEditor = (props: Props) => {
|
export const ConfigEditor = (props: Props) => {
|
||||||
const { options, onOptionsChange } = props;
|
const { options, onOptionsChange } = props;
|
||||||
const socksProxy = config.featureToggles.secureSocksDatasourceProxy;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -43,23 +38,8 @@ export const ConfigEditor = (props: Props) => {
|
|||||||
onChange={onOptionsChange}
|
onChange={onOptionsChange}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{socksProxy && (
|
{config.featureToggles.secureSocksDatasourceProxy && (
|
||||||
<>
|
<SecureSocksProxySettings options={options} onOptionsChange={onOptionsChange} />
|
||||||
<h3 className="page-heading">Secure Socks Proxy</h3>
|
|
||||||
<div className="gf-form-group">
|
|
||||||
<div className="gf-form-inline"></div>
|
|
||||||
<InlineField
|
|
||||||
labelWidth={28}
|
|
||||||
label="Enabled"
|
|
||||||
tooltip="Connect to this datasource via the secure socks proxy."
|
|
||||||
>
|
|
||||||
<InlineSwitch
|
|
||||||
value={options.jsonData.enableSecureSocksProxy ?? false}
|
|
||||||
onChange={onUpdateDatasourceJsonDataOptionChecked(props, 'enableSecureSocksProxy')}
|
|
||||||
/>
|
|
||||||
</InlineField>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<AlertingSettings<LokiOptions> options={options} onOptionsChange={onOptionsChange} />
|
<AlertingSettings<LokiOptions> options={options} onOptionsChange={onOptionsChange} />
|
||||||
|
@ -56,7 +56,6 @@ export interface LokiOptions extends DataSourceJsonData {
|
|||||||
derivedFields?: DerivedFieldConfig[];
|
derivedFields?: DerivedFieldConfig[];
|
||||||
alertmanager?: string;
|
alertmanager?: string;
|
||||||
keepCookies?: string[];
|
keepCookies?: string[];
|
||||||
enableSecureSocksProxy?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LokiStats {
|
export interface LokiStats {
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
|
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
|
||||||
import { DataSourceHttpSettings } from '@grafana/ui';
|
import { config } from '@grafana/runtime';
|
||||||
|
import { DataSourceHttpSettings, SecureSocksProxySettings } from '@grafana/ui';
|
||||||
|
|
||||||
import { OpenTsdbOptions } from '../types';
|
import { OpenTsdbOptions } from '../types';
|
||||||
|
|
||||||
@ -17,6 +18,9 @@ export const ConfigEditor = (props: DataSourcePluginOptionsEditorProps<OpenTsdbO
|
|||||||
dataSourceConfig={options}
|
dataSourceConfig={options}
|
||||||
onChange={onOptionsChange}
|
onChange={onOptionsChange}
|
||||||
/>
|
/>
|
||||||
|
{config.featureToggles.secureSocksDatasourceProxy && (
|
||||||
|
<SecureSocksProxySettings options={options} onOptionsChange={onOptionsChange} />
|
||||||
|
)}
|
||||||
<OpenTsdbDetails value={options} onChange={onOptionsChange} />
|
<OpenTsdbDetails value={options} onChange={onOptionsChange} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
import React, { useRef } from 'react';
|
import React, { useRef } from 'react';
|
||||||
|
|
||||||
import { SIGV4ConnectionConfig } from '@grafana/aws-sdk';
|
import { SIGV4ConnectionConfig } from '@grafana/aws-sdk';
|
||||||
import {
|
import { DataSourcePluginOptionsEditorProps, DataSourceSettings } from '@grafana/data';
|
||||||
DataSourcePluginOptionsEditorProps,
|
import { AlertingSettings, DataSourceHttpSettings, Alert, SecureSocksProxySettings } from '@grafana/ui';
|
||||||
DataSourceSettings,
|
|
||||||
onUpdateDatasourceJsonDataOptionChecked,
|
|
||||||
} from '@grafana/data';
|
|
||||||
import { AlertingSettings, DataSourceHttpSettings, Alert, InlineField, InlineSwitch } from '@grafana/ui';
|
|
||||||
import { config } from 'app/core/config';
|
import { config } from 'app/core/config';
|
||||||
|
|
||||||
import { PromOptions } from '../types';
|
import { PromOptions } from '../types';
|
||||||
@ -29,8 +25,6 @@ export const ConfigEditor = (props: Props) => {
|
|||||||
azureSettingsUI: AzureAuthSettings,
|
azureSettingsUI: AzureAuthSettings,
|
||||||
};
|
};
|
||||||
|
|
||||||
const socksProxy = config.featureToggles.secureSocksDatasourceProxy;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{options.access === 'direct' && (
|
{options.access === 'direct' && (
|
||||||
@ -49,23 +43,8 @@ export const ConfigEditor = (props: Props) => {
|
|||||||
renderSigV4Editor={<SIGV4ConnectionConfig {...props}></SIGV4ConnectionConfig>}
|
renderSigV4Editor={<SIGV4ConnectionConfig {...props}></SIGV4ConnectionConfig>}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{socksProxy && (
|
{config.featureToggles.secureSocksDatasourceProxy && (
|
||||||
<>
|
<SecureSocksProxySettings options={options} onOptionsChange={onOptionsChange} />
|
||||||
<h3 className="page-heading">Secure Socks Proxy</h3>
|
|
||||||
<div className="gf-form-group">
|
|
||||||
<div className="gf-form-inline"></div>
|
|
||||||
<InlineField
|
|
||||||
labelWidth={28}
|
|
||||||
label="Enabled"
|
|
||||||
tooltip="Connect to this datasource via the secure socks proxy."
|
|
||||||
>
|
|
||||||
<InlineSwitch
|
|
||||||
value={options.jsonData.enableSecureSocksProxy ?? false}
|
|
||||||
onChange={onUpdateDatasourceJsonDataOptionChecked(props, 'enableSecureSocksProxy')}
|
|
||||||
/>
|
|
||||||
</InlineField>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<AlertingSettings<PromOptions> options={options} onOptionsChange={onOptionsChange} />
|
<AlertingSettings<PromOptions> options={options} onOptionsChange={onOptionsChange} />
|
||||||
|
@ -34,7 +34,6 @@ export interface PromOptions extends DataSourceJsonData {
|
|||||||
exemplarTraceIdDestinations?: ExemplarTraceIdDestination[];
|
exemplarTraceIdDestinations?: ExemplarTraceIdDestination[];
|
||||||
prometheusType?: PromApplication;
|
prometheusType?: PromApplication;
|
||||||
prometheusVersion?: string;
|
prometheusVersion?: string;
|
||||||
enableSecureSocksProxy?: boolean;
|
|
||||||
defaultEditor?: QueryEditorMode;
|
defaultEditor?: QueryEditorMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
|
|
||||||
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
|
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
import { DataSourceHttpSettings } from '@grafana/ui';
|
import { DataSourceHttpSettings, SecureSocksProxySettings } from '@grafana/ui';
|
||||||
import { SpanBarSettings } from '@jaegertracing/jaeger-ui-components';
|
import { SpanBarSettings } from '@jaegertracing/jaeger-ui-components';
|
||||||
import { NodeGraphSettings } from 'app/core/components/NodeGraphSettings';
|
import { NodeGraphSettings } from 'app/core/components/NodeGraphSettings';
|
||||||
import { TraceToLogsSettings } from 'app/core/components/TraceToLogs/TraceToLogsSettings';
|
import { TraceToLogsSettings } from 'app/core/components/TraceToLogs/TraceToLogsSettings';
|
||||||
@ -25,6 +25,10 @@ export const ConfigEditor = ({ options, onOptionsChange }: Props) => {
|
|||||||
onChange={onOptionsChange}
|
onChange={onOptionsChange}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{config.featureToggles.secureSocksDatasourceProxy && (
|
||||||
|
<SecureSocksProxySettings options={options} onOptionsChange={onOptionsChange} />
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="gf-form-group">
|
<div className="gf-form-group">
|
||||||
<TraceToLogsSettings options={options} onOptionsChange={onOptionsChange} />
|
<TraceToLogsSettings options={options} onOptionsChange={onOptionsChange} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
|
|
||||||
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
|
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
import { DataSourceHttpSettings } from '@grafana/ui';
|
import { DataSourceHttpSettings, SecureSocksProxySettings } from '@grafana/ui';
|
||||||
import { SpanBarSettings } from '@jaegertracing/jaeger-ui-components';
|
import { SpanBarSettings } from '@jaegertracing/jaeger-ui-components';
|
||||||
import { NodeGraphSettings } from 'app/core/components/NodeGraphSettings';
|
import { NodeGraphSettings } from 'app/core/components/NodeGraphSettings';
|
||||||
import { TraceToLogsSettings } from 'app/core/components/TraceToLogs/TraceToLogsSettings';
|
import { TraceToLogsSettings } from 'app/core/components/TraceToLogs/TraceToLogsSettings';
|
||||||
@ -20,6 +20,10 @@ export const ConfigEditor = ({ options, onOptionsChange }: Props) => {
|
|||||||
onChange={onOptionsChange}
|
onChange={onOptionsChange}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
{config.featureToggles.secureSocksDatasourceProxy && (
|
||||||
|
<SecureSocksProxySettings options={options} onOptionsChange={onOptionsChange} />
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="gf-form-group">
|
<div className="gf-form-group">
|
||||||
<TraceToLogsSettings options={options} onOptionsChange={onOptionsChange} />
|
<TraceToLogsSettings options={options} onOptionsChange={onOptionsChange} />
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user