Skip to content

Commit

Permalink
aotf: fix mutations in workflow toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders committed Apr 29, 2022
1 parent dc1b26b commit 8c80475
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
25 changes: 14 additions & 11 deletions src/components/cylc/workflow/Toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -260,31 +260,34 @@ export default {
},
methods: {
onClickPlay () {
const ret = this.$workflowService.mutate(
this.$workflowService.mutate(
'play',
this.currentWorkflow.id
)
if (ret[0] === mutationStatus.SUCCEEDED) {
this.expecting.play = !this.isRunning
}
).then(ret => {
if (ret[0] === mutationStatus.SUCCEEDED) {
this.expecting.play = !this.isRunning
}
})
},
onClickReleaseHold () {
const ret = this.$workflowService.mutate(
this.isPaused ? 'resume' : 'pause',
this.currentWorkflow.id
).then(ret => {
if (ret[0] === mutationStatus.SUCCEEDED) {
this.expecting.paused = !this.isPaused
}
)
if (ret[0] === mutationStatus.SUCCEEDED) {
this.expecting.paused = !this.isPaused
}
},
async onClickStop () {
const ret = this.$workflowService.mutate(
'stop',
this.currentWorkflow.id
).then(ret => {
if (ret[0] === mutationStatus.SUCCEEDED) {
this.expecting.stop = WorkflowState.STOPPING
}
)
if (ret[0] === mutationStatus.SUCCEEDED) {
this.expecting.stop = WorkflowState.STOPPING
}
},
toggleExtended () {
this.extended = !this.extended
Expand Down
9 changes: 5 additions & 4 deletions src/services/workflow.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class WorkflowService {
* @param {String} id
* @returns {Promise}
*/
mutate (mutationName, id) {
const mutation = this.getMutation(mutationName)
async mutate (mutationName, id) {
const mutation = await this.getMutation(mutationName)
return mutate(
mutation,
getMutationArgsFromTokens(
Expand Down Expand Up @@ -122,8 +122,9 @@ class WorkflowService {
*
* @param {String} mutationName
*/
getMutation (mutationName) {
return this.mutations.find(mutation => mutation.name === mutationName)
async getMutation (mutationName) {
const { mutations, types } = await this.mutationsAndTypes
return mutations.find(mutation => mutation.name === mutationName)
}

// --- GraphQL query subscriptions
Expand Down

0 comments on commit 8c80475

Please sign in to comment.