UNPKG

@finos/legend-extension-dsl-data-space

Version:
58 lines 5.95 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 { CustomSelectorInput, PURE_MappingIcon, PURE_RuntimeIcon, PlayIcon, } from '@finos/legend-art'; import {} from '@finos/legend-graph'; import {} from '../stores/DataSpaceViewerState.js'; import { useApplicationStore } from '@finos/legend-application'; const buildExecutionContextOption = (value) => ({ label: value.name, value: value, }); const buildRuntimeOption = (value) => ({ label: value.name, value: value, }); export const DataSpaceExecutionContextViewer = observer((props) => { const { dataSpaceViewerState } = props; const applicationStore = useApplicationStore(); const analysisResult = dataSpaceViewerState.dataSpaceAnalysisResult; const executionContexts = Array.from(dataSpaceViewerState.dataSpaceAnalysisResult.executionContextsIndex.values()); // execution const executionContextOptions = executionContexts.map(buildExecutionContextOption); const selectedExecutionContextOption = buildExecutionContextOption(dataSpaceViewerState.currentExecutionContext); const onExecutionContextOptionChange = (option) => { if (option.value !== dataSpaceViewerState.currentExecutionContext) { dataSpaceViewerState.setCurrentExecutionContext(option.value); } }; const formatExecutionContextOptionLabel = (option) => (_jsxs("div", { className: "data-space__viewer__execution-context__entry__content__dropdown__option", children: [_jsx("div", { className: "data-space__viewer__execution-context__entry__content__dropdown__option__label", children: option.label }), option.value === analysisResult.defaultExecutionContext && (_jsx("div", { className: "data-space__viewer__execution-context__entry__content__dropdown__option__tag", children: "default" }))] })); // runtime const runtimeOptions = dataSpaceViewerState.currentExecutionContext.compatibleRuntimes.map(buildRuntimeOption); const selectedRuntimeOption = buildRuntimeOption(dataSpaceViewerState.currentRuntime); const onRuntimeOptionChange = (option) => { if (option.value !== dataSpaceViewerState.currentRuntime) { dataSpaceViewerState.setCurrentRuntime(option.value); } }; const formatRuntimeOptionLabel = (option) => (_jsxs("div", { className: "data-space__viewer__execution-context__entry__content__dropdown__option", children: [_jsx("div", { className: "data-space__viewer__execution-context__entry__content__dropdown__option__label", children: option.label }), option.value === dataSpaceViewerState.currentExecutionContext.defaultRuntime && (_jsx("div", { className: "data-space__viewer__execution-context__entry__content__dropdown__option__tag", children: "default" }))] })); return (_jsxs("div", { className: "data-space__viewer__panel", children: [_jsx("div", { className: "data-space__viewer__panel__header", children: _jsx("div", { className: "data-space__viewer__panel__header__label", children: "Execution Context" }) }), _jsx("div", { className: "data-space__viewer__panel__content", children: _jsxs("div", { className: "data-space__viewer__execution-context", children: [_jsxs("div", { className: "data-space__viewer__execution-context__entry", children: [_jsx("div", { className: "data-space__viewer__execution-context__entry__icon", children: _jsx(PlayIcon, { className: "data-space__viewer__execution-context__context-icon" }) }), _jsx("div", { className: "data-space__viewer__execution-context__entry__content data-space__viewer__execution-context__entry__content__dropdown__container", children: _jsx(CustomSelectorInput, { className: "data-space__viewer__execution-context__entry__content__dropdown", options: executionContextOptions, onChange: onExecutionContextOptionChange, value: selectedExecutionContextOption, darkMode: !applicationStore.layoutService .TEMPORARY__isLightColorThemeEnabled, formatOptionLabel: formatExecutionContextOptionLabel }) })] }), _jsxs("div", { className: "data-space__viewer__execution-context__entry data-space__viewer__execution-context__mapping", children: [_jsx("div", { className: "data-space__viewer__execution-context__entry__icon", children: _jsx(PURE_MappingIcon, {}) }), _jsx("div", { className: "data-space__viewer__execution-context__entry__content data-space__viewer__execution-context__entry__content__text", children: dataSpaceViewerState.currentExecutionContext.mapping.path })] }), _jsxs("div", { className: "data-space__viewer__execution-context__entry", children: [_jsx("div", { className: "data-space__viewer__execution-context__entry__icon", children: _jsx(PURE_RuntimeIcon, {}) }), _jsx("div", { className: "data-space__viewer__execution-context__entry__content data-space__viewer__execution-context__entry__content__dropdown__container", children: _jsx(CustomSelectorInput, { className: "data-space__viewer__execution-context__entry__content__dropdown", options: runtimeOptions, onChange: onRuntimeOptionChange, value: selectedRuntimeOption, darkMode: !applicationStore.layoutService .TEMPORARY__isLightColorThemeEnabled, formatOptionLabel: formatRuntimeOptionLabel }) })] })] }) })] })); }); //# sourceMappingURL=DataSpaceExecutionContextViewer.js.map