Skip to content

Running mutation on 2 workflows displays error #1851

Closed
@MetRonnie

Description

@MetRonnie

In a mutation form, adding multiple workflows to run the mutation on results in an error snackbar.

image

This is because the response we get from the UIServer is in an odd format:

{
  "data": {
    "trigger": {
      "result": [
        {
          "trigger": {
            "result": [
              {
                "id": "~user/thing/run1",
                "response": [
                  true,
                  "d78b43de-7172-4135-afe6-346edbb02cec"
                ]
              }
            ],
            "__typename": "Trigger"
          }
        },
        {
          "trigger": {
            "result": [
              {
                "id": "~user/thing/run2",
                "response": [
                  true,
                  "dba6b04d-a618-4b40-89ca-21f96721f214"
                ]
              }
            ],
            "__typename": "Trigger"
          }
        }
      ],
      "__typename": "Trigger"
    }
  }
}

(I think cylc/cylc-uiserver#290 deals with this, but will need to revisit it)

And this is not what the API-on-the-fly code expects

cylc-ui/src/utils/aotf.js

Lines 954 to 962 in 3d64d28

const { result } = response.data[mutation.name]
if (Array.isArray(result) && result.length === 2) {
// regular [commandSucceeded, message] format
if (result[0] === true) {
// success
return _mutateSuccess(result[1])
}
// failure (Cylc error, e.g. could not find workflow <x>)
return _mutateError(mutation.name, result[1], response)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions