UNPKG

@grafana/ui

Version:
107 lines (102 loc) 4.06 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var jsxRuntime = require('react/jsx-runtime'); var css = require('@emotion/css'); var i18n = require('@grafana/i18n'); var ThemeContext = require('../../themes/ThemeContext.cjs'); var InlineField = require('../Forms/InlineField.cjs'); var Stack = require('../Layout/Stack/Stack.cjs'); var Switch = require('../Switch/Switch.cjs'); "use strict"; const LABEL_WIDTH = 26; const HttpProxySettings = ({ dataSourceConfig, onChange, showForwardOAuthIdentityOption = true }) => { const gridLayout = ThemeContext.useStyles2(getGridLayout); return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: gridLayout, children: [ /* @__PURE__ */ jsxRuntime.jsxs(Stack.Stack, { direction: "row", gap: 0.5, children: [ /* @__PURE__ */ jsxRuntime.jsx( InlineField.InlineField, { label: i18n.t("grafana-ui.data-source-http-proxy-settings.ts-client-auth-label", "TLS Client Auth"), labelWidth: LABEL_WIDTH, disabled: dataSourceConfig.readOnly, children: /* @__PURE__ */ jsxRuntime.jsx( Switch.InlineSwitch, { id: "http-settings-tls-client-auth", value: dataSourceConfig.jsonData.tlsAuth || false, onChange: (event) => onChange({ ...dataSourceConfig.jsonData, tlsAuth: event.currentTarget.checked }) } ) } ), /* @__PURE__ */ jsxRuntime.jsx( InlineField.InlineField, { label: i18n.t("grafana-ui.data-source-http-proxy-settings.with-ca-cert-label", "With CA Cert"), tooltip: i18n.t( "grafana-ui.data-source-http-proxy-settings.with-ca-cert-tooltip", "Needed for verifying self-signed TLS Certs" ), labelWidth: LABEL_WIDTH, disabled: dataSourceConfig.readOnly, children: /* @__PURE__ */ jsxRuntime.jsx( Switch.InlineSwitch, { id: "http-settings-ca-cert", value: dataSourceConfig.jsonData.tlsAuthWithCACert || false, onChange: (event) => onChange({ ...dataSourceConfig.jsonData, tlsAuthWithCACert: event.currentTarget.checked }) } ) } ) ] }), /* @__PURE__ */ jsxRuntime.jsx( InlineField.InlineField, { label: i18n.t("grafana-ui.data-source-http-proxy-settings.skip-tls-verify-label", "Skip TLS Verify"), labelWidth: LABEL_WIDTH, disabled: dataSourceConfig.readOnly, children: /* @__PURE__ */ jsxRuntime.jsx( Switch.InlineSwitch, { id: "http-settings-skip-tls-verify", value: dataSourceConfig.jsonData.tlsSkipVerify || false, onChange: (event) => onChange({ ...dataSourceConfig.jsonData, tlsSkipVerify: event.currentTarget.checked }) } ) } ), showForwardOAuthIdentityOption && /* @__PURE__ */ jsxRuntime.jsx( InlineField.InlineField, { label: i18n.t("grafana-ui.data-source-http-proxy-settings.oauth-identity-label", "Forward OAuth Identity"), tooltip: i18n.t( "grafana-ui.data-source-http-proxy-settings.oauth-identity-tooltip", "Forward the user's upstream OAuth identity to the data source (Their access token gets passed along)." ), labelWidth: LABEL_WIDTH, disabled: dataSourceConfig.readOnly, children: /* @__PURE__ */ jsxRuntime.jsx( Switch.InlineSwitch, { id: "http-settings-forward-oauth", value: dataSourceConfig.jsonData.oauthPassThru || false, onChange: (event) => onChange({ ...dataSourceConfig.jsonData, oauthPassThru: event.currentTarget.checked }) } ) } ) ] }); }; const getGridLayout = (theme) => css.css({ display: "grid", gridTemplateColumns: "auto", gap: 0 // Inline field has a margin }); exports.HttpProxySettings = HttpProxySettings; //# sourceMappingURL=HttpProxySettings.cjs.map