From 6becf288190b6883f71ae4b980db3239cd63f831 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 26 May 2017 09:29:06 +0100 Subject: use formState to update loading of save button [ci skip] --- app/assets/javascripts/issue_show/components/app.vue | 3 ++- .../javascripts/issue_show/components/edit_actions.vue | 18 ++++-------------- app/assets/javascripts/issue_show/stores/index.js | 1 + 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/app/assets/javascripts/issue_show/components/app.vue b/app/assets/javascripts/issue_show/components/app.vue index 9753dc49cf5..ed367c780c6 100644 --- a/app/assets/javascripts/issue_show/components/app.vue +++ b/app/assets/javascripts/issue_show/components/app.vue @@ -114,6 +114,7 @@ export default { description: this.state.descriptionText, lockedWarningVisible: false, move_to_project_id: 0, + updateLoading: false, }); } }, @@ -125,7 +126,7 @@ export default { confirm('Are you sure you want to move this issue to another project?') : true; // eslint-disable-line no-alert if (!canPostUpdate) { - eventHub.$emit('enable.submit.btn'); + this.store.formState.updateLoading = false; return; } diff --git a/app/assets/javascripts/issue_show/components/edit_actions.vue b/app/assets/javascripts/issue_show/components/edit_actions.vue index df93d18774f..0750d21c15d 100644 --- a/app/assets/javascripts/issue_show/components/edit_actions.vue +++ b/app/assets/javascripts/issue_show/components/edit_actions.vue @@ -15,7 +15,6 @@ data() { return { deleteLoading: false, - updateLoading: false, }; }, computed: { @@ -24,11 +23,8 @@ }, }, methods: { - enableSubmit() { - this.updateLoading = false; - }, updateIssuable() { - this.updateLoading = true; + this.formState.updateLoading = true; eventHub.$emit('update.issuable'); }, closeForm() { @@ -43,12 +39,6 @@ } }, }, - created() { - eventHub.$on('enable.submit.btn', this.enableSubmit); - }, - beforeDestroy() { - eventHub.$off('enable.submit.btn', this.enableSubmit); - }, }; @@ -56,15 +46,15 @@