From 880a0bf989d56f5f94e56583d2dda053a62f279a Mon Sep 17 00:00:00 2001 From: Oliver Sanders Date: Fri, 29 Apr 2022 12:03:36 +0100 Subject: [PATCH] . --- src/components/cylc/workflow/Toolbar.vue | 25 +++++++++++++----------- src/services/workflow.service.js | 9 +++++---- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/components/cylc/workflow/Toolbar.vue b/src/components/cylc/workflow/Toolbar.vue index 3c1590bd68..419130503f 100644 --- a/src/components/cylc/workflow/Toolbar.vue +++ b/src/components/cylc/workflow/Toolbar.vue @@ -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 diff --git a/src/services/workflow.service.js b/src/services/workflow.service.js index eecf5de9d6..7111c041b5 100644 --- a/src/services/workflow.service.js +++ b/src/services/workflow.service.js @@ -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( @@ -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