BigW Consortium Gitlab

Commit 6becf288 by Phil Hughes

use formState to update loading of save button

[ci skip]
parent 3ce6658d
...@@ -114,6 +114,7 @@ export default { ...@@ -114,6 +114,7 @@ export default {
description: this.state.descriptionText, description: this.state.descriptionText,
lockedWarningVisible: false, lockedWarningVisible: false,
move_to_project_id: 0, move_to_project_id: 0,
updateLoading: false,
}); });
} }
}, },
...@@ -125,7 +126,7 @@ export default { ...@@ -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 confirm('Are you sure you want to move this issue to another project?') : true; // eslint-disable-line no-alert
if (!canPostUpdate) { if (!canPostUpdate) {
eventHub.$emit('enable.submit.btn'); this.store.formState.updateLoading = false;
return; return;
} }
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
data() { data() {
return { return {
deleteLoading: false, deleteLoading: false,
updateLoading: false,
}; };
}, },
computed: { computed: {
...@@ -24,11 +23,8 @@ ...@@ -24,11 +23,8 @@
}, },
}, },
methods: { methods: {
enableSubmit() {
this.updateLoading = false;
},
updateIssuable() { updateIssuable() {
this.updateLoading = true; this.formState.updateLoading = true;
eventHub.$emit('update.issuable'); eventHub.$emit('update.issuable');
}, },
closeForm() { closeForm() {
...@@ -43,12 +39,6 @@ ...@@ -43,12 +39,6 @@
} }
}, },
}, },
created() {
eventHub.$on('enable.submit.btn', this.enableSubmit);
},
beforeDestroy() {
eventHub.$off('enable.submit.btn', this.enableSubmit);
},
}; };
</script> </script>
...@@ -56,15 +46,15 @@ ...@@ -56,15 +46,15 @@
<div class="prepend-top-default append-bottom-default clearfix"> <div class="prepend-top-default append-bottom-default clearfix">
<button <button
class="btn btn-save pull-left" class="btn btn-save pull-left"
:class="{ disabled: updateLoading || !isSubmitEnabled }" :class="{ disabled: formState.updateLoading || !isSubmitEnabled }"
type="submit" type="submit"
:disabled="updateLoading || !isSubmitEnabled" :disabled="formState.updateLoading || !isSubmitEnabled"
@click.prevent="updateIssuable"> @click.prevent="updateIssuable">
Save changes Save changes
<i <i
class="fa fa-spinner fa-spin" class="fa fa-spinner fa-spin"
aria-hidden="true" aria-hidden="true"
v-if="updateLoading"> v-if="formState.updateLoading">
</i> </i>
</button> </button>
<button <button
......
...@@ -19,6 +19,7 @@ export default class Store { ...@@ -19,6 +19,7 @@ export default class Store {
description: '', description: '',
lockedWarningVisible: false, lockedWarningVisible: false,
move_to_project_id: 0, move_to_project_id: 0,
updateLoading: false,
}; };
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment