Skip to content

Reusable Service Patterns #979

@matKlju

Description

@matKlju

AS A Service-Module admin
I WANT to save recurring groups of service-flow nodes as reusable private patterns
SO THAT large services are easier to read, repeated logic can be reused, and canvas clutter from crossing edges is reduced

Description

Some service-flow patterns reoccur inside large services. When many outputs connect into the same group of nodes, the canvas becomes difficult to read because of crossing edges and duplicated logic.

Service creators must be able to select a built-out group of nodes and save it as a reusable Pattern / Custom element. The saved pattern is added to the service-local Elements → General elements section.

After creating the pattern, the selected nodes on the canvas are replaced by a copy of the newly created pattern block.

Patterns are private per service. They are not globally reusable across all services.

Each pattern added from the Elements modal to the canvas becomes a copy of the current saved version. If a pattern copy is edited on the canvas, it retains its own local version and does not modify the original saved pattern.

When a service is exported, its private pattern definitions must be included in the exported JSON. When imported, the service must restore both the pattern definitions and the pattern block instances on the canvas, so the imported service remains in the same workable state as it was during export.

Acceptance Criteria

Pattern creation

  • User can select multiple connected nodes on the canvas
  • User can save selected nodes as a Pattern / Custom element
  • Saved pattern is added to the service-local Elements → General elements section
  • Original selected nodes are replaced on the canvas by a copy of the new pattern block
  • Internal node logic and internal edges are preserved inside the pattern

Inputs and outputs

  • Pattern block supports one or more input handles
  • Pattern block supports one or more output handles
  • Incoming edges to the selected node group are converted into pattern input handles
  • Outgoing edges from the selected node group are converted into pattern output handles
  • Internal edges between selected nodes remain internal to the pattern
  • Pattern may have no output only when it intentionally ends the service flow

Usage in flow

  • Pattern block can be used in the middle of a service flow
  • Pattern block can be used near the start of a service flow, but does not replace the Start node
  • Pattern block can be used at the end of a service flow
  • Pattern usage reduces unnecessary crossing edges and repeated node groups

Copy and version behavior

  • Adding a pattern from the Elements modal creates a copy of the current saved version
  • Editing a copied pattern on the canvas creates/keeps a local version
  • Editing a canvas copy does not modify the original saved pattern
  • Existing pattern copies are not affected when the original pattern is changed

Scope

  • Patterns are private to the current service
  • Patterns are not available globally across all services
  • Patterns appear only in the service-local General elements section

Export / import

  • Service export includes all private pattern definitions used by the service
  • Exported JSON includes enough pattern metadata to restore the pattern after import
  • Service import restores private patterns into the service-local General elements section
  • Imported canvas restores pattern block instances where they were used
  • Imported service remains in the same workable state as it was during export

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    Status

    To Groom

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions