UNPKG

@finos/legend-application-studio

Version:
44 lines 4.45 kB
import { jsx as _jsx, Fragment as _Fragment, 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 { BaseStepper, BlankPanelContent, Dialog, Modal, ModalBody, ModalFooter, ModalFooterButton, ModalHeader, PanelFormListItems, PanelLoadingIndicator, clsx, } from '@finos/legend-art'; import { observer } from 'mobx-react-lite'; import { MIGRATE_PHASE, } from '../../../../../stores/editor/editor-state/element-editor-state/mapping/legacy/MappingTestMigrationState.js'; import { CODE_EDITOR_LANGUAGE } from '@finos/legend-code-editor'; import { CodeDiffView } from '@finos/legend-lego/code-editor'; export const MappingTestMigrationTool = observer((props) => { const { mappingEditorState, migrationState } = props; const applicationStore = mappingEditorState.editorStore.applicationStore; const isLoading = migrationState.confirmationState?.calculatingDiffs.isInProgress; const close = () => { mappingEditorState.closeMigrationTool(); }; const handleBack = () => { migrationState.handleBack(); }; const handleNext = () => { migrationState.handleNext(); }; const disabled = !migrationState.migrateableTests.length && !migrationState.unSupportedTestsToMigrate.length; return (_jsx(Dialog, { open: true, onClose: close, classes: { root: 'editor-modal__root-container', container: 'editor-modal__container', paper: 'editor-modal__content', }, children: _jsxs(Modal, { darkMode: !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled, className: clsx('editor-modal query-builder-text-mode__modal'), children: [_jsx(ModalHeader, { title: "Migrate Legacy Tests" }), _jsxs(ModalBody, { children: [_jsx(PanelLoadingIndicator, { isLoading: Boolean(isLoading) }), _jsx(BaseStepper, { steps: migrationState.steps, activeStep: migrationState.activeStep }), !disabled ? (_jsxs("div", { className: "mapping-migration-tool", children: [migrationState.currentStep === MIGRATE_PHASE.OVERVIEW && (_jsxs(_Fragment, { children: [_jsx(PanelFormListItems, { title: "Migrable Tests", prompt: "tests that can be migrated via migration tool", children: migrationState.migrateableTests.map((test) => (_jsx("div", { className: "panel__content__form__section__list__item", children: _jsx("div", { className: "panel__content__form__section__list__item__value", children: test.name }) }, test.name))) }), _jsx(PanelFormListItems, { title: "Unsupported Tests", prompt: "tests unable to be migrated", children: migrationState.unSupportedTestsToMigrate.map((test) => (_jsx("div", { className: "panel__content__form__section__list__item", children: _jsx("div", { className: "panel__content__form__section__list__item__value", children: test.name }) }, test.name))) })] })), migrationState.currentStep === MIGRATE_PHASE.CONFIRM && migrationState.confirmationState && (_jsx("div", { className: "query-builder__diff-panel__content", children: _jsx(CodeDiffView, { language: CODE_EDITOR_LANGUAGE.PURE, from: migrationState.confirmationState.before ?? '', to: migrationState.confirmationState.after ?? '' }) }))] })) : (_jsx("div", { className: "mapping-migration-tool", children: _jsx(BlankPanelContent, { children: "No Migrateable Tests" }) }))] }), _jsxs(ModalFooter, { children: [_jsx(ModalFooterButton, { className: "query-connection-workflow__actions__action-btn", disabled: migrationState.disableBack || disabled, onClick: handleBack, title: "Go to previous step...", children: "Back" }), _jsx(ModalFooterButton, { className: "query-connection-workflow__actions__action-btn query-connection-workflow__actions__action-btn--primary", disabled: migrationState.disableNext || disabled, onClick: handleNext, children: migrationState.nextText })] })] }) })); }); //# sourceMappingURL=MappingTestMigrationTool.js.map