Skip to content

Commit

Permalink
add pdc functionality?
Browse files Browse the repository at this point in the history
  • Loading branch information
adlotsof committed Dec 8, 2024
1 parent c802de1 commit 8d957e5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export interface DataSourceOptions extends DataSourceJsonData {
username?: string;
edition?: Edition;
backend?: Backend;
enableSecureSocksProxy?: boolean;
}

/**
Expand Down
25 changes: 24 additions & 1 deletion src/ui/ConfigEditor.tsx
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -27,6 +29,7 @@ const cmkBackends: Array<SelectableValue<Backend>> = [
];

export const ConfigEditor = (props: Props) => {

const onUrlChange = useCallback(
(event: ChangeEvent<HTMLInputElement>): void => {
const { onOptionsChange, options } = props;
Expand Down Expand Up @@ -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 || {};
Expand All @@ -125,6 +143,10 @@ export const ConfigEditor = (props: Props) => {
data-test-id="checkmk-url"
/>
</div>
{config.secureSocksDSProxyEnabled && (
<SecureSocksProxySettings options={options} onOptionsChange={onProxyChange} />
)}

{process.env.BUILD_EDITION !== 'CLOUD' ? (
<>
<InlineField label="Edition" labelWidth={12}>
Expand Down Expand Up @@ -192,6 +214,7 @@ export const ConfigEditor = (props: Props) => {
/>
</div>
</FieldSet>

</>
);
};

0 comments on commit 8d957e5

Please sign in to comment.