Skip to content

Mne 412 refactor template builder in mnestix browser#544

Merged
LuisSchweinberger merged 13 commits intodevfrom
MNE-412-refactor-template-builder-in-mnestix-browser
Apr 10, 2026
Merged

Mne 412 refactor template builder in mnestix browser#544
LuisSchweinberger merged 13 commits intodevfrom
MNE-412-refactor-template-builder-in-mnestix-browser

Conversation

@LuisSchweinberger
Copy link
Copy Markdown
Contributor

@LuisSchweinberger LuisSchweinberger commented Mar 3, 2026

This pull request introduces a new version (2.1.2) of the application with a significant refactor of the template editing page to improve maintainability and state management. The template editing logic is now encapsulated in a context provider, resulting in cleaner, more modular code. Additionally, there are updates to dependencies, workflow files, and end-to-end tests to support these changes and improve reliability.

Refactor: Template Editing Page State Management

Testing Improvements

  • The Cypress test for template CRUD operations (cypress/e2e/templateTest.spec.js) is improved to use a unique template name for each run, adds a loginIfNeeded helper for more robust authentication, and avoids logging out after each test to prevent misleading timeouts. The test flow is updated for better reliability and clarity.

Dependency and Tooling Updates

  • Bump application version to 2.1.2 in package.json, Docker, and Compose files. [1] [2] [3]
  • Update prisma dependency to ^7.4.2 and add several package resolutions for security and compatibility (lodash, hono, @hono/node-server). [1] [2]
  • Add a new dev:inspect script for running the dev server with Node.js inspector enabled.
  • Fix ESLint config to use the correct Cypress plugin import.

These changes collectively improve the project's code quality, maintainability, and reliability, especially around template editing and developer experience.

@LuisSchweinberger LuisSchweinberger marked this pull request as ready for review March 12, 2026 10:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the template/blueprint editor to centralize state management in a new React Context provider, simplifies the tree/field editing flow, and bumps dependencies + application version.

Changes:

  • Introduces BlueprintContext as the single source of truth for blueprint tree state, selection, change tracking, duplicate/delete operations, and Submodel conversion.
  • Refactors the /templates/[id] page and blueprint edit components (tree + fields) to consume the context and removes the prior “soft delete/restore” UI flow.
  • Updates dependencies/lockfile and bumps the app + Docker image version to 2.1.2.

Reviewed changes

Copilot reviewed 19 out of 22 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
yarn.lock Dependency lockfile updates (eslint/jest/mui/prisma/etc.).
src/lib/util/submodelHelpers/SubmodelViewObjectUtil.ts Removes isAboutToBeDeleted usage and makes rewriteNodeIds synchronous.
src/lib/types/SubmodelViewObject.ts Removes isAboutToBeDeleted from the view object type.
src/app/[locale]/templates/[id]/page.tsx Wraps the page in BlueprintProvider and migrates fetch/save/revert logic to context.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/SubmodelEditComponent.tsx Adjusts event typing and switches to onBlur commit behavior.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/property/data-specific/StringPropertyEditComponent.tsx Switches to onBlur commit behavior.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/property/data-specific/LongPropertyEditComponent.tsx Switches handler signature and (intended) onBlur commit behavior.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/mapping-info/MappingInfoEditComponent.tsx Consolidates mapping-info editing into a generic component driven by config props.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/mapping-info/filter-mapping-info.json Adds filter mapping qualifier config.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/mapping-info/collection-mapping-info-data.json Adds collection mapping qualifier config.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/index/index-data.json Removes index qualifier config file.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/filter-mapping-info/FilterMappingInfoEditComponent.tsx Removes dedicated filter mapping editor (replaced by generic component).
src/app/[locale]/templates/_components/blueprint-edit/edit-components/collection-mapping-info/CollectionMappingInfoEditComponent.tsx Removes dedicated collection mapping editor (replaced by generic component).
src/app/[locale]/templates/_components/blueprint-edit/BlueprintEditTreeItemMenu.tsx Removes restore/soft-delete menu logic.
src/app/[locale]/templates/_components/blueprint-edit/BlueprintEditTreeItem.tsx Removes deleted-state rendering/restore behavior and simplifies delete handling.
src/app/[locale]/templates/_components/blueprint-edit/BlueprintEditTree.tsx Refactors tree to read/write through BlueprintContext and removes local tree mutation logic.
src/app/[locale]/templates/_components/blueprint-edit/BlueprintEditFields.tsx Refactors fields panel to use context selection and generic mapping editors.
src/app/[locale]/templates/_components/blueprint-edit/BlueprintContext.tsx Adds new context provider implementing blueprint editing operations and API↔tree conversion helpers.
package.json Bumps version to 2.1.2, updates prisma version, adds resolutions, and modifies dev script.
eslint.config.js Changes Cypress plugin import path.
compose.yml Updates Docker image tag to 2.1.2.
.github/workflows/docker-build.yml Updates workflow image tag version to 2.1.2.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the template editor page to centralize blueprint tree state, selection, and update operations into a new BlueprintContext/BlueprintProvider, reducing prop drilling and local state in the editor UI.

Changes:

  • Introduces BlueprintContext to manage blueprint tree state, selection, duplication/deletion, and conversion back to Submodel for saving.
  • Refactors template editor page and blueprint edit components (BlueprintEditTree, BlueprintEditFields, menus/items) to consume context instead of passing/maintaining local state.
  • Updates tooling/scripts and configs (version bumps, dev script, ESLint Cypress plugin import) and adjusts Cypress E2E coverage.

Reviewed changes

Copilot reviewed 20 out of 23 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/lib/util/submodelHelpers/SubmodelViewObjectUtil.ts Removes soft-delete flag usage and makes rewriteNodeIds synchronous.
src/lib/types/SubmodelViewObject.ts Removes isAboutToBeDeleted from the view object type.
src/app/[locale]/templates/[id]/page.tsx Wraps the page in BlueprintProvider and replaces local blueprint state/logic with context methods.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/SubmodelEditComponent.tsx Updates display name input handler types and switches to onBlur.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/property/data-specific/StringPropertyEditComponent.tsx Broadens event typing to include HTMLTextAreaElement.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/property/data-specific/LongPropertyEditComponent.tsx Broadens event typing to include HTMLTextAreaElement and adds React import.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/mapping-info/MappingInfoEditComponent.tsx Generalizes mapping-info editing into a single configurable component.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/mapping-info/filter-mapping-info.json Adds filter mapping-info qualifier configuration.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/mapping-info/collection-mapping-info-data.json Adds collection mapping-info qualifier configuration.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/index/index-data.json Removes legacy index config JSON.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/filter-mapping-info/FilterMappingInfoEditComponent.tsx Removes specialized filter mapping-info component (replaced by generic one).
src/app/[locale]/templates/_components/blueprint-edit/edit-components/collection-mapping-info/CollectionMappingInfoEditComponent.tsx Removes specialized collection mapping-info component (replaced by generic one).
src/app/[locale]/templates/_components/blueprint-edit/BlueprintEditTreeItemMenu.tsx Simplifies tree item menu actions; removes restore-related wiring.
src/app/[locale]/templates/_components/blueprint-edit/BlueprintEditTreeItem.tsx Removes soft-delete UI state and restore handling from tree items.
src/app/[locale]/templates/_components/blueprint-edit/BlueprintEditTree.tsx Refactors tree rendering to use context state/actions instead of prop callbacks.
src/app/[locale]/templates/_components/blueprint-edit/BlueprintEditFields.tsx Refactors edit fields to use context-selected element and generic mapping-info editor.
src/app/[locale]/templates/_components/blueprint-edit/BlueprintContext.tsx Adds the new centralized blueprint state provider, actions, and (de)serialization helpers.
package.json Bumps version/deps, changes dev script to always enable Node inspector, adds resolutions.
eslint.config.js Changes Cypress ESLint plugin import path.
cypress/e2e/templateTest.spec.js Adjusts login flow and reduces CRUD test to create+delete only.
compose.yml Bumps Docker image tag to 2.1.2.
.github/workflows/docker-build.yml Bumps image tag version to 2.1.2.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the template editing page to centralize blueprint/template editing state and operations into a new BlueprintContext provider, simplifying the page/component wiring and improving maintainability. It also updates related edit components, E2E tests, and bumps the app version/deps/tooling config to support the refactor.

Changes:

  • Introduce BlueprintProvider/useBlueprintContext as the single source of truth for blueprint tree state, selection, duplicate/delete, and save conversion.
  • Simplify template editor page, tree, and edit-field components to consume context (and consolidate MappingInfo editing into a generic component + JSON configs).
  • Update Cypress template CRUD flow for improved reliability; bump version to 2.1.2 and adjust tooling config (ESLint/Cypress plugin import, resolutions, docker tags).

Reviewed changes

Copilot reviewed 20 out of 23 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/lib/util/submodelHelpers/SubmodelViewObjectUtil.ts Removes deletion flag from view objects; makes rewriteNodeIds synchronous.
src/lib/types/SubmodelViewObject.ts Removes isAboutToBeDeleted from the view-object type.
src/app/[locale]/templates/[id]/page.tsx Wraps editor in BlueprintProvider and shifts most editing state/logic into context.
src/app/[locale]/templates/_components/blueprint-edit/BlueprintContext.tsx New context provider implementing blueprint state, selection, duplicate/delete, and Submodel conversion.
src/app/[locale]/templates/_components/blueprint-edit/BlueprintEditTree.tsx Converts tree component to be context-driven (no longer receives tree/handlers via props).
src/app/[locale]/templates/_components/blueprint-edit/BlueprintEditFields.tsx Converts edit fields to be context-driven; replaces specialized mapping components with a generic one.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/mapping-info/MappingInfoEditComponent.tsx Refactors into a generic, configurable mapping-info editor.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/mapping-info/*.json Adds mapping-info configs (collection/filter) to drive the generic component.
src/app/[locale]/templates/_components/blueprint-edit/edit-components/*PropertyEditComponent.tsx Switches several field updates to commit on blur.
src/app/[locale]/templates/_components/blueprint-edit/BlueprintEditTreeItem*.tsx Removes “marked for deletion/restore” UI paths to align with hard delete behavior.
cypress/e2e/templateTest.spec.js Makes template CRUD test more robust (unique name + login helper + no logout).
package.json Bumps version to 2.1.2, updates prisma, adds dev:inspect, adds resolutions.
eslint.config.js Updates Cypress ESLint plugin import.
compose.yml Updates image tag to 2.1.2.
.github/workflows/docker-build.yml Updates workflow image tag version to 2.1.2.
Comments suppressed due to low confidence (1)

src/app/[locale]/templates/_components/blueprint-edit/edit-components/property/data-specific/LongPropertyEditComponent.tsx:37

  • LongPropertyEditComponent is a controlled TextField (value={data}), but the state update is now wired to onBlur. This prevents the user from typing because the input’s value will not update on keystrokes. Keep the controlled input’s state updates on onChange (you can still debounce/commit to parent onBlur if desired).
    return (
        <TextField
            label={t('labels.value')}
            value={data}
            onBlur={onValueChange}
            fullWidth
            error={!isValidInput}
            helperText={!isValidInput && t('validation.errors.invalidLong')}
        />

@LuisSchweinberger LuisSchweinberger merged commit a276769 into dev Apr 10, 2026
18 checks passed
@LuisSchweinberger LuisSchweinberger deleted the MNE-412-refactor-template-builder-in-mnestix-browser branch April 10, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants