This commit is contained in:
@@ -521,7 +521,20 @@ export default {
|
|||||||
handleError("DELETE", error, route);
|
handleError("DELETE", error, route);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
///////////////////////////////////
|
||||||
|
// PUT DATA TO API SERVER
|
||||||
|
// (used for puts that can't have a concurrency token like above)
|
||||||
|
async put(route, data) {
|
||||||
|
try {
|
||||||
|
let that = this;
|
||||||
|
let r = await fetch(that.APIUrl(route), that.fetchPutOptions(data));
|
||||||
|
that.statusEx(r);
|
||||||
|
r = await that.extractBodyEx(r);
|
||||||
|
return r;
|
||||||
|
} catch (error) {
|
||||||
|
handleError("UPSERT", error, route);
|
||||||
|
}
|
||||||
|
},
|
||||||
///////////////////////////////////
|
///////////////////////////////////
|
||||||
// POST FILE ATTACHMENTS
|
// POST FILE ATTACHMENTS
|
||||||
// @param {ayaId:objectid, ayaType:objectType, files:[array of files]}
|
// @param {ayaId:objectid, ayaType:objectType, files:[array of files]}
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ export default {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.effectiveView.splice(index, 1);
|
this.effectiveView.splice(index, 1);
|
||||||
|
this.saveView();
|
||||||
},
|
},
|
||||||
dashRefresh: function(item) {
|
dashRefresh: function(item) {
|
||||||
console.log(
|
console.log(
|
||||||
@@ -146,7 +147,7 @@ export default {
|
|||||||
addItem: function(item) {
|
addItem: function(item) {
|
||||||
this.showSelector = false;
|
this.showSelector = false;
|
||||||
this.effectiveView.push(item);
|
this.effectiveView.push(item);
|
||||||
//save effective view as saved View
|
this.saveView();
|
||||||
},
|
},
|
||||||
availableItems: function() {
|
availableItems: function() {
|
||||||
let allItems = DashRegistry.availableItems();
|
let allItems = DashRegistry.availableItems();
|
||||||
@@ -200,6 +201,46 @@ export default {
|
|||||||
loading: false
|
loading: false
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
async saveView() {
|
||||||
|
let vm = this;
|
||||||
|
if (vm.canSave == false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
window.$gz.form.setFormState({
|
||||||
|
vm: vm,
|
||||||
|
loading: true
|
||||||
|
});
|
||||||
|
|
||||||
|
//clear any errors vm might be around from previous submit
|
||||||
|
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||||
|
|
||||||
|
let res = await window.$gz.api.put(
|
||||||
|
"dashboard-view",
|
||||||
|
JSON.stringify(vm.effectiveView)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (res.error) {
|
||||||
|
vm.formState.serverError = res.error;
|
||||||
|
window.$gz.form.setErrorBoxErrors(vm);
|
||||||
|
} else {
|
||||||
|
//Update the form status
|
||||||
|
window.$gz.form.setFormState({
|
||||||
|
vm: vm,
|
||||||
|
dirty: false,
|
||||||
|
valid: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} catch (ex) {
|
||||||
|
window.$gz.errorHandler.handleFormError(ex, vm);
|
||||||
|
} finally {
|
||||||
|
window.$gz.form.setFormState({
|
||||||
|
vm: vm,
|
||||||
|
loading: false
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
Reference in New Issue
Block a user