Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add pdc functionality #286

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>

</>
);
};
Loading