boomerang-io / community

The Boomerang community, roadmap, planning, and architecture repository. The central place for information on joining, contributing, and governance.
https://useboomerang.io
Apache License 2.0
11 stars 0 forks source link

Workflow - Add in a /compose endpoint to convert the object for React Flow #380

Closed tlawrie closed 1 year ago

tlawrie commented 1 year ago

Add a new /api/v2/workflow/{workflowId}/compose endpoint that would convert from the API / data model to the model needed for ReactFlow

{
    "nodes": [
        {
            "id": "start",
            "position": {
                "x": 200,
                "y": 200
            },
            "data": {
                "label": "start",
                "params": [
                    {
                        "name": "outputToProcess",
                        "value": "$(tasks.invert-colours.results.output)"
                    },
                    {
                        "name": "artefactsToProcess",
                        "value": "$(tasks.invert-colours.results.output.artefacts)"
                    }
                ]
            },
            "type": "start",
        },
        {
            "id": "2",
            "position": {
                "x": 800,
                "y": 200
            },
            "data": {
                "label": "node"
            },
            "type": "task",
        },
        {
            "id": "3",
            "position": {
                "x": 800,
                "y": 400
            },
            "data": {
                "label": "node",
            },
            "type": "decision",
        },
        {
            "id": "end",
            "position": {
                "x": 1400,
                "y": 200
            },
            "data": {
                "label": "end"
            },
            "type": "end",
        }
    ],
    "edges": [
        {
            "id": "1-2",
            "source": "1",
            "target": "2",
            "type": "task",
            "data": {
                "text": "hello"
            },
        },
        {
            "id": "3-4",
            "source": "3",
            "target": "4",
            "type": "decision",
            "data": {
                "decisionCondition": "bob",
                "executionCondition": "success",
            },
        }
    ],
}