Skip to content

[serverless-workflow-diagram-editor] for a foreach state the foreach node is not coloured #3324

@fantonangeli

Description

@fantonangeli

For the WF here the ForEachState node in the diagram is not coloured. (See the screenshot)
With @fjtirado we discovered that we should coloured the nodes using the metadata, which can be fetched with the query below:

    nodes {
      id
      nodeId
      name
      enter
      exit
      type
      definitionId
      __typename
    }
    nodeDefinitions {
      id
      name
      type
      uniqueId
      metadata {
        UniqueId
        state
        branch
        action
      }
    }

To obtain a response like this:

"nodes": [
         {
            "id": "61ff08b5-9adc-4d5f-a291-74127478f4c4",
            "nodeId": "3",
            "name": "ForEach",
            "enter": "2025-10-24T09:46:40.907Z",
            "exit": "2025-10-24T09:46:40.925Z",
            "type": "ForEachNode",
            "definitionId": "3",
            "__typename": "NodeInstance"
          },
]
...
"nodeDefinitions": [
          {
            "id": "3",
            "name": "ForEach",
            "type": "ForEachNode",
            "uniqueId": "3",
            "metadata": {
              "UniqueId": "3",
              "state": "ForEachState",
              "branch": null,
              "action": null
            }
          },
]

The current colouring logic can be found here

Image

The new node coloring logic should work as follows:

  1. For StartNode/EndNode types: Always color using node.name
  2. For other node types:
    - Find the corresponding nodeDefinition by matching node.definitionId with nodeDefinition.id
    - If nodeDefinition.metadata.state exists (not null), color using metadata.state value
    - If nodeDefinition.metadata.state is null or nodeDefinition not found, skip the node (don't color it)

Metadata

Metadata

Assignees

Type

Projects

Status

📋 Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions