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

aotf: fix mutations in workflow toolbar #999

Merged
merged 1 commit into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 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.$workflowService.mutate(
this.isPaused ? 'resume' : 'pause',
this.currentWorkflow.id
)
if (ret[0] === mutationStatus.SUCCEEDED) {
this.expecting.paused = !this.isPaused
}
).then(ret => {
if (ret[0] === mutationStatus.SUCCEEDED) {
this.expecting.paused = !this.isPaused
}
})
},
async onClickStop () {
const ret = this.$workflowService.mutate(
this.$workflowService.mutate(
'stop',
this.currentWorkflow.id
)
if (ret[0] === mutationStatus.SUCCEEDED) {
this.expecting.stop = WorkflowState.STOPPING
}
).then(ret => {
if (ret[0] === mutationStatus.SUCCEEDED) {
this.expecting.stop = WorkflowState.STOPPING
}
})
},
toggleExtended () {
this.extended = !this.extended
Expand Down
15 changes: 8 additions & 7 deletions src/services/workflow.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class WorkflowService {
this.subscriptions = {}

// mutations defaults
this.associations = null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This was never used since the commit that introduced it - e7a3fbe#diff-5bf28b4f8de7d141f3dbfe760f5d05effbfc83e4debf8859ebee820fc81bfa7bR209)

this.primaryMutations = primaryMutations

this.mutationsAndTypes = this.loadMutations()
Expand All @@ -85,11 +84,11 @@ class WorkflowService {
*
* @param {String} mutationName
* @param {String} id
* @returns {Promise}
* @returns {Promise<Array>}
*/
mutate (mutationName, id) {
const mutation = this.getMutation(mutationName)
return mutate(
async mutate (mutationName, id) {
const mutation = await this.getMutation(mutationName)
return await mutate(
mutation,
getMutationArgsFromTokens(
mutation,
Expand Down Expand Up @@ -121,9 +120,11 @@ class WorkflowService {
* Return a mutation by name.
*
* @param {String} mutationName
* @returns {Promise<Object>}
*/
getMutation (mutationName) {
return this.mutations.find(mutation => mutation.name === mutationName)
async getMutation (mutationName) {
const { mutations } = await this.mutationsAndTypes
return mutations.find(mutation => mutation.name === mutationName)
}

// --- GraphQL query subscriptions
Expand Down