UNPKG

@finos/legend-application-studio

Version:
32 lines 3.35 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 { LockIcon, FireIcon, StickArrowCircleRightIcon, Panel, PanelContent, } from '@finos/legend-art'; import { useEditorStore } from '../EditorStoreProvider.js'; import { ArtifactGenerationViewerState, getEditorLanguageForFormat, getTextContent, } from '../../../stores/editor/editor-state/ArtifactGenerationViewerState.js'; import { CodeEditor } from '@finos/legend-lego/code-editor'; export const ArtifactGenerationViewer = observer(() => { const editorStore = useEditorStore(); const generatedArtifactState = editorStore.tabManagerState.getCurrentEditorState(ArtifactGenerationViewerState); const generatedArtifact = generatedArtifactState.artifact; const generator = generatedArtifact.parentId ? editorStore.graphManagerState.graph.getNullableElement(generatedArtifact.parentId) : undefined; const visitGenerator = (fg) => editorStore.graphEditorMode.openElement(fg); return (_jsx("div", { className: "file-generation-viewer", children: _jsxs(Panel, { children: [_jsx("div", { className: "panel__header", children: _jsxs("div", { className: "panel__header__title", children: [_jsx("div", { className: "uml-element-editor__header__lock", children: _jsx(LockIcon, {}) }), _jsx("div", { className: "panel__header__title__label", children: "generated-artifact" }), _jsx("div", { className: "panel__header__title__content", children: generatedArtifact.name })] }) }), _jsxs("div", { className: "panel file-generation-viewer__content", children: [_jsxs("div", { className: "panel__header", children: [_jsx("div", { className: "panel__header__title", children: _jsx("div", { className: "panel__header__title__label", children: generator?.name }) }), _jsx("div", { className: "panel__header__actions", children: generator && (_jsxs("button", { className: "uml-element-editor__header__generation-origin", onClick: () => visitGenerator(generator), tabIndex: -1, title: `Visit generation parent '${generator.path}'`, children: [_jsx("div", { className: "uml-element-editor__header__generation-origin__label", children: _jsx(FireIcon, {}) }), _jsx("div", { className: "uml-element-editor__header__generation-origin__parent-name", children: generator.name }), _jsx("div", { className: "uml-element-editor__header__generation-origin__visit-btn", children: _jsx(StickArrowCircleRightIcon, {}) })] })) })] }), _jsx(PanelContent, { children: _jsx(CodeEditor, { inputValue: getTextContent(generatedArtifact.content, generatedArtifact.format), isReadOnly: true, language: getEditorLanguageForFormat(generatedArtifact.format) }) })] })] }) })); }); //# sourceMappingURL=ArtifactGenerationViewer.js.map