Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running mutation on 2 workflows displays error #1851

Open
MetRonnie opened this issue Jul 3, 2024 · 0 comments
Open

Running mutation on 2 workflows displays error #1851

MetRonnie opened this issue Jul 3, 2024 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@MetRonnie
Copy link
Member

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)

@MetRonnie MetRonnie added the bug Something isn't working label Jul 3, 2024
@MetRonnie MetRonnie added this to the 2.x milestone Jul 3, 2024
@MetRonnie MetRonnie self-assigned this Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant