mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Plugins: add UI for secure socks proxy feature toggle (#60750)
This commit is contained in:
parent
9633b5c69c
commit
39b8d3a182
@ -1,7 +1,12 @@
|
||||
import React from 'react';
|
||||
|
||||
import { DataSourcePluginOptionsEditorProps, DataSourceSettings } from '@grafana/data';
|
||||
import { AlertingSettings, DataSourceHttpSettings } from '@grafana/ui';
|
||||
import {
|
||||
DataSourcePluginOptionsEditorProps,
|
||||
DataSourceSettings,
|
||||
onUpdateDatasourceJsonDataOptionChecked,
|
||||
} from '@grafana/data';
|
||||
import { config } from '@grafana/runtime';
|
||||
import { AlertingSettings, DataSourceHttpSettings, InlineField, InlineSwitch } from '@grafana/ui';
|
||||
|
||||
import { LokiOptions } from '../types';
|
||||
|
||||
@ -27,6 +32,7 @@ const setDerivedFields = makeJsonUpdater('derivedFields');
|
||||
|
||||
export const ConfigEditor = (props: Props) => {
|
||||
const { options, onOptionsChange } = props;
|
||||
const socksProxy = config.featureToggles.secureSocksDatasourceProxy;
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -37,6 +43,25 @@ export const ConfigEditor = (props: Props) => {
|
||||
onChange={onOptionsChange}
|
||||
/>
|
||||
|
||||
{socksProxy && (
|
||||
<>
|
||||
<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} />
|
||||
|
||||
<div className="gf-form-group">
|
||||
|
@ -56,6 +56,7 @@ export interface LokiOptions extends DataSourceJsonData {
|
||||
derivedFields?: DerivedFieldConfig[];
|
||||
alertmanager?: string;
|
||||
keepCookies?: string[];
|
||||
enableSecureSocksProxy?: boolean;
|
||||
}
|
||||
|
||||
export interface LokiStats {
|
||||
|
@ -1,8 +1,12 @@
|
||||
import React, { useRef } from 'react';
|
||||
|
||||
import { SIGV4ConnectionConfig } from '@grafana/aws-sdk';
|
||||
import { DataSourcePluginOptionsEditorProps, DataSourceSettings } from '@grafana/data';
|
||||
import { AlertingSettings, DataSourceHttpSettings, Alert } from '@grafana/ui';
|
||||
import {
|
||||
DataSourcePluginOptionsEditorProps,
|
||||
DataSourceSettings,
|
||||
onUpdateDatasourceJsonDataOptionChecked,
|
||||
} from '@grafana/data';
|
||||
import { AlertingSettings, DataSourceHttpSettings, Alert, InlineField, InlineSwitch } from '@grafana/ui';
|
||||
import { config } from 'app/core/config';
|
||||
|
||||
import { PromOptions } from '../types';
|
||||
@ -25,6 +29,8 @@ export const ConfigEditor = (props: Props) => {
|
||||
azureSettingsUI: AzureAuthSettings,
|
||||
};
|
||||
|
||||
const socksProxy = config.featureToggles.secureSocksDatasourceProxy;
|
||||
|
||||
return (
|
||||
<>
|
||||
{options.access === 'direct' && (
|
||||
@ -43,6 +49,25 @@ export const ConfigEditor = (props: Props) => {
|
||||
renderSigV4Editor={<SIGV4ConnectionConfig {...props}></SIGV4ConnectionConfig>}
|
||||
/>
|
||||
|
||||
{socksProxy && (
|
||||
<>
|
||||
<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} />
|
||||
|
||||
<PromSettings options={options} onOptionsChange={onOptionsChange} />
|
||||
|
@ -34,6 +34,7 @@ export interface PromOptions extends DataSourceJsonData {
|
||||
exemplarTraceIdDestinations?: ExemplarTraceIdDestination[];
|
||||
prometheusType?: PromApplication;
|
||||
prometheusVersion?: string;
|
||||
enableSecureSocksProxy?: boolean;
|
||||
}
|
||||
|
||||
export type ExemplarTraceIdDestination = {
|
||||
|
Loading…
Reference in New Issue
Block a user