Attract multi edit: Disable save button during save

This commit is contained in:
2019-03-13 15:25:32 +01:00
parent bae39ce01d
commit 434cdb35a0
4 changed files with 6 additions and 1 deletions

View File

@@ -71,6 +71,7 @@ const TEMPLATE =`
>
<button class="btn btn-outline-success btn-block" id="item-save" type="submit"
@click="save"
:disabled="isSaving"
>
<i class="pi-check"/>Save Asset
</button>

View File

@@ -72,6 +72,7 @@ const TEMPLATE =`
>
<button class="btn btn-outline-success btn-block" id="item-save" type="submit"
@click="save"
:disabled="isSaving"
>
<i class="pi-check"/>Save Shot
</button>

View File

@@ -142,6 +142,7 @@ const TEMPLATE =`
>
<button class="btn btn-outline-success btn-block" id="item-save" type="submit"
@click="save"
:disabled="isSaving"
>
<i class="pi-check"/>
Save Task

View File

@@ -24,6 +24,7 @@ let EditorBase = Vue.component('attract-editor-Base', {
data() {
return {
multiEditEngine: this.createEditorEngine(ALL_BASE_PROPERTIES),
isSaving: false,
}
},
watch: {
@@ -112,13 +113,14 @@ let EditorBase = Vue.component('attract-editor-Base', {
save() {
let toBeSaved = this.multiEditEngine.createUpdatedItems();
let promises = toBeSaved.map(pillar.api.thenUpdateNode);
this.isSaving = true;
this.unitOfWork(
Promise.all(promises)
.then(() => {
this.$emit('saved-items');
})
.catch((err) => {toastr.error(pillar.utils.messageFromError(err), 'Save Failed')})
.finally(() => this.isSaving = false)
);
},
},