UNPKG

@finos/legend-studio

Version:
35 lines 4.18 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; /** * Copyright (c) 2020-present, Goldman Sachs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { observer } from 'mobx-react-lite'; import { clsx, CheckSquareIcon, SquareIcon } from '@finos/legend-art'; import { isValidUrl } from '@finos/legend-shared'; import { useEditorStore } from '../EditorStoreProvider.js'; import { observe_TEMPORARY__AbstractEngineConfig } from '@finos/legend-graph'; export const DevTool = observer(() => { const editorStore = useEditorStore(); // Engine const engineConfig = observe_TEMPORARY__AbstractEngineConfig(editorStore.graphManagerState.graphManager.TEMPORARY__getEngineConfig()); const changeEngineClientBaseUrl = (event) => engineConfig.setBaseUrl(event.target.value === '' ? undefined : event.target.value); const toggleEngineClientRequestPayloadCompression = () => engineConfig.setUseClientRequestPayloadCompression(!engineConfig.useClientRequestPayloadCompression); const toggleDataUrlEncoding = () => engineConfig.setUseBase64ForAdhocConnectionDataUrls(!engineConfig.useBase64ForAdhocConnectionDataUrls); return (_jsx("div", { className: "console-panel", children: _jsx("div", { className: "console-panel__content", children: _jsxs("div", { className: "panel__content__form", children: [_jsxs("div", { className: "panel__content__form__section", children: [_jsx("div", { className: "panel__content__form__section__header__label", children: "Engine client request payload compression" }), _jsxs("div", { className: clsx('panel__content__form__section__toggler'), onClick: toggleEngineClientRequestPayloadCompression, children: [_jsx("button", { className: clsx('panel__content__form__section__toggler__btn', { 'panel__content__form__section__toggler__btn--toggled': engineConfig.useClientRequestPayloadCompression, }), children: engineConfig.useClientRequestPayloadCompression ? (_jsx(CheckSquareIcon, {})) : (_jsx(SquareIcon, {})) }), _jsx("div", { className: "panel__content__form__section__toggler__prompt", children: "Specifies if request payload should be compressed" })] })] }), _jsxs("div", { className: "panel__content__form__section", children: [_jsx("div", { className: "panel__content__form__section__header__label", children: "Engine client base URL" }), _jsxs("div", { className: "input-group", children: [_jsx("input", { className: "panel__content__form__section__input input-group__input input--dark", spellCheck: false, value: engineConfig.baseUrl ?? '', onChange: changeEngineClientBaseUrl }), !isValidUrl(engineConfig.baseUrl ?? '') && (_jsx("div", { className: "input-group__error-message", children: "Invalid URL" }))] })] }), _jsxs("div", { className: "panel__content__form__section", children: [_jsx("div", { className: "panel__content__form__section__header__label", children: "Engine execution runner" }), _jsxs("div", { className: clsx('panel__content__form__section__toggler'), onClick: toggleDataUrlEncoding, children: [_jsx("button", { className: clsx('panel__content__form__section__toggler__btn', { 'panel__content__form__section__toggler__btn--toggled': engineConfig.useBase64ForAdhocConnectionDataUrls, }), children: engineConfig.useBase64ForAdhocConnectionDataUrls ? (_jsx(CheckSquareIcon, {})) : (_jsx(SquareIcon, {})) }), _jsx("div", { className: "panel__content__form__section__toggler__prompt", children: "Use Base64 encoding for adhoc connection data URLs" })] })] })] }) }) })); }); //# sourceMappingURL=DevTool.js.map