Skip to content

VSN-2043 : Integrating feature of saving a new individual prepared circuit.

yassine.elazami a demandé de fusionner VSN-2043 vers develop

Merge Request Description — Circuit Saving (Preparation & Final Modes)

Overview

This merge request introduces the circuit saving feature on the front-end side, with full support for both preparation and final saving modes. The implementation focuses on clearly separating behaviors depending on the context (preparation vs finalized circuit), while keeping the store logic, API integration, and UI behavior consistent and scalable.

The changes cover:

  • Store contract definition
  • API endpoint integration
  • Dynamic saving logic
  • UI form behavior adjustments
  • Preparation-specific handling
  • Minor fixes and UI refinements

Detailed Changes

1. Store Contract Extension

  • A new method signature has been added to the Prepared Circuit Store.
  • This method defines the contract for saving a circuit from the front end.
  • It standardizes how circuit data is sent to the backend, making future extensions easier and safer.

Impact:

  • Ensures type safety.
  • Centralizes circuit-saving logic at the store level.
  • Improves maintainability and readability of store actions.

2. API Endpoint Definition

  • A new endpoint has been introduced to support circuit saving.
  • This endpoint is designed to work for both preparation and final saving flows.
  • The endpoint aligns with backend expectations and naming conventions.

Impact:

  • Enables clean separation of responsibilities between UI and backend.
  • Makes circuit saving fully accessible through a dedicated API path.

3. Store Method Implementation

  • The previously defined store method has been fully implemented.
  • The method performs the API call to persist circuit data.
  • Request payload construction and response handling are centralized here.

Impact:

  • Reduces duplicated logic across components.
  • Makes circuit saving reusable across multiple views.
  • Improves error handling consistency.

4. Preparation Flag Introduction

  • A new field preparation has been added to the Circuit Form.
  • This flag distinguishes between:
    • Preparation mode (draft / temporary saving)
    • Final mode (definitive circuit saving)

Impact:

  • Enables the same form to be reused for different business flows.
  • Avoids duplicating UI components for preparation vs final logic.
  • Makes behavior explicit and predictable.

5. Dynamic Saving Logic

  • Saving behavior is now dynamic and driven by the preparation flag.
  • Depending on the flag:
    • Different endpoints or saving strategies can be applied.
    • Business rules adapt automatically without branching in the UI.

Impact:

  • Improves flexibility of the saving workflow.
  • Reduces conditional complexity inside components.
  • Makes future evolution of preparation logic easier.

6. Preparation View Adjustment

  • In the preparation view, the preparation flag is explicitly set to true.
  • This ensures that circuits created from this view are always handled as prepared circuits.

Impact:

  • Guarantees correctness of preparation data.
  • Prevents accidental final saving from preparation screens.

7. UI Fix — Dynamic Title Handling

  • The circuit form title is now dynamic.
  • The title adapts based on the current mode:
    • Preparation mode
    • Final (standard) mode

Impact:

  • Improves user clarity and UX.
  • Reduces confusion during circuit creation or editing.
  • Aligns UI feedback with underlying business logic.

Summary

This MR delivers a complete and flexible circuit-saving workflow by:

  • Extending the store contract
  • Integrating a dedicated backend endpoint
  • Introducing preparation-aware logic
  • Dynamically adapting UI and saving behavior

The result is a cleaner, more maintainable, and more scalable circuit management feature that clearly separates preparation and finalization concerns while reusing the same technical foundations.


Closes VSN-2043

Rapports de requête de fusion