diff --git a/src/types.ts b/src/types.ts index cde8093..ed76c31 100644 --- a/src/types.ts +++ b/src/types.ts @@ -67,6 +67,7 @@ export interface DataSourceOptions extends DataSourceJsonData { username?: string; edition?: Edition; backend?: Backend; + enableSecureSocksProxy?: boolean; } /** diff --git a/src/ui/ConfigEditor.tsx b/src/ui/ConfigEditor.tsx index fa6cd0c..e7fc55b 100644 --- a/src/ui/ConfigEditor.tsx +++ b/src/ui/ConfigEditor.tsx @@ -1,5 +1,7 @@ import { DataSourcePluginOptionsEditorProps, SelectableValue } from '@grafana/data'; -import { Alert, FieldSet, InlineField, LegacyForms, Select } from '@grafana/ui'; +import { Alert, FieldSet, InlineField, LegacyForms, Select, SecureSocksProxySettings } from '@grafana/ui'; +import { config } from '@grafana/runtime'; + import * as process from 'process'; import React, { ChangeEvent, useCallback } from 'react'; @@ -27,6 +29,7 @@ const cmkBackends: Array> = [ ]; export const ConfigEditor = (props: Props) => { + const onUrlChange = useCallback( (event: ChangeEvent): void => { const { onOptionsChange, options } = props; @@ -106,6 +109,21 @@ export const ConfigEditor = (props: Props) => { }); }, [props]); + const onProxyChange = useCallback((): void => { + const { onOptionsChange,options } = props; + const enableSecureSocksProxy = options.jsonData.enableSecureSocksProxy; + onOptionsChange({ + ...options, + jsonData: { + ...options.jsonData, + enableSecureSocksProxy, + }, + }); + }, + [props] + ); + + const { options } = props; const { jsonData, secureJsonFields } = options; const secureJsonData = options.secureJsonData || {}; @@ -125,6 +143,10 @@ export const ConfigEditor = (props: Props) => { data-test-id="checkmk-url" /> + {config.secureSocksDSProxyEnabled && ( + + )} + {process.env.BUILD_EDITION !== 'CLOUD' ? ( <> @@ -192,6 +214,7 @@ export const ConfigEditor = (props: Props) => { /> + ); };