This commit is contained in:
@@ -265,10 +265,11 @@ const API_BASE_URL = "widget/";
|
||||
const FORM_CUSTOM_TEMPLATE_KEY = "Widget";
|
||||
|
||||
export default {
|
||||
created() {
|
||||
async created() {
|
||||
let vm = this;
|
||||
initForm(vm)
|
||||
.then(() => {
|
||||
try {
|
||||
await initForm(vm);
|
||||
|
||||
vm.rights = window.$gz.role.getRights(window.$gz.type.Widget);
|
||||
vm.formState.readOnly = !vm.rights.change;
|
||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||
@@ -290,13 +291,11 @@ export default {
|
||||
// vm.rights.delete = false;
|
||||
generateMenu(vm);
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
window.$gz.errorHandler.handleFormError(err, vm);
|
||||
})
|
||||
.finally(function() {
|
||||
} catch (error) {
|
||||
window.$gz.errorHandler.handleFormError(error, vm);
|
||||
} finally {
|
||||
vm.formState.ready = true;
|
||||
});
|
||||
}
|
||||
},
|
||||
beforeRouteUpdate(to, from, next) {
|
||||
//This triggers a fetch of the data when the ID value changes on the route
|
||||
@@ -308,19 +307,16 @@ export default {
|
||||
// react to route changes...
|
||||
// don't forget to call next()
|
||||
},
|
||||
beforeRouteLeave(to, from, next) {
|
||||
//let vm = this;
|
||||
if (this.formState.dirty && !JUST_DELETED) {
|
||||
window.$gz.dialog.confirmLeaveUnsaved().then(dialogResult => {
|
||||
if (dialogResult == true) {
|
||||
async beforeRouteLeave(to, from, next) {
|
||||
if (!this.formState.dirty || JUST_DELETED) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
if ((await window.$gz.dialog.confirmLeaveUnsaved()) == true) {
|
||||
next();
|
||||
} else {
|
||||
next(false);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
window.$gz.eventBus.$off("menu-click", clickHandler);
|
||||
@@ -776,11 +772,10 @@ function fetchTranslatedText(vm) {
|
||||
//////////////////////
|
||||
//
|
||||
//
|
||||
function populateSelectionLists(vm) {
|
||||
async function populateSelectionLists(vm) {
|
||||
//ensure the pick lists required are pre-fetched
|
||||
return window.$gz.enums.fetchEnumList("usertype").then(() => {
|
||||
await window.$gz.enums.fetchEnumList("usertype");
|
||||
vm.selectLists.usertypes = window.$gz.enums.getSelectionList("usertype");
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user