This commit is contained in:
@@ -34,6 +34,7 @@ export default {
|
|||||||
formKey: formKey,
|
formKey: formKey,
|
||||||
value: addDataKeyNames(JSON.parse(res.data.template))
|
value: addDataKeyNames(JSON.parse(res.data.template))
|
||||||
});
|
});
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -279,6 +279,11 @@ export default {
|
|||||||
.then(that.status)
|
.then(that.status)
|
||||||
.then(that.json)
|
.then(that.json)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
|
//KEEP this for diagnostics and testing to put a delay on fetches to check if my promise-fu is on point
|
||||||
|
// setTimeout(() => {
|
||||||
|
// console.log("gzapi::get->Calling resolve now for " + route);
|
||||||
|
// resolve(response); // (**)
|
||||||
|
// }, 2000);
|
||||||
resolve(response);
|
resolve(response);
|
||||||
})
|
})
|
||||||
.catch(function handleGetError(error) {
|
.catch(function handleGetError(error) {
|
||||||
|
|||||||
@@ -110,14 +110,14 @@ export default {
|
|||||||
beforeCreate() {
|
beforeCreate() {
|
||||||
var vm = this;
|
var vm = this;
|
||||||
|
|
||||||
initForm(this)
|
var vv = initForm(this);
|
||||||
.then(() => {
|
|
||||||
vm.formState.ready = true;
|
vv.then(() => {
|
||||||
})
|
vm.formState.ready = true;
|
||||||
.catch(err => {
|
}).catch(err => {
|
||||||
vm.formState.ready = true;
|
vm.formState.ready = true;
|
||||||
window.$gz.errorHandler.handleFormError(err);
|
window.$gz.errorHandler.handleFormError(err);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
beforeRouteLeave(to, from, next) {
|
beforeRouteLeave(to, from, next) {
|
||||||
//var vm = this;
|
//var vm = this;
|
||||||
@@ -297,8 +297,20 @@ function generateMenu(vm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initForm(vm) {
|
function initForm(vm) {
|
||||||
return ensureTemplateIsInStore(vm).then(initDataObject(vm));
|
// var p1 = ensureTemplateIsInStore(vm);
|
||||||
//return initDataObject(vm).then(ensureTemplateIsInStore(vm));
|
// var p2 = p1.then(initDataObject(vm));
|
||||||
|
// return p2;
|
||||||
|
return ensureTemplateIsInStore(vm).then(() => {
|
||||||
|
return initDataObject(vm);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////
|
||||||
|
//
|
||||||
|
function ensureTemplateIsInStore(vm) {
|
||||||
|
return window.$gz.formCustomTemplate.get(
|
||||||
|
vm.$route.params.formCustomTemplateKey
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////
|
////////////////////
|
||||||
@@ -322,6 +334,7 @@ function initDataObject(vm) {
|
|||||||
//get the formAvailableField record into an object to save typing
|
//get the formAvailableField record into an object to save typing
|
||||||
var faf = res.data[i];
|
var faf = res.data[i];
|
||||||
//get the customTemplate record for this field if it exists
|
//get the customTemplate record for this field if it exists
|
||||||
|
|
||||||
var templateItem = (templateItem = window.$gz.formCustomTemplate.getFieldTemplateValue(
|
var templateItem = (templateItem = window.$gz.formCustomTemplate.getFieldTemplateValue(
|
||||||
vm.formCustomTemplateKey,
|
vm.formCustomTemplateKey,
|
||||||
faf.key
|
faf.key
|
||||||
@@ -347,7 +360,7 @@ function initDataObject(vm) {
|
|||||||
visible: templateItem.hide !== true,
|
visible: templateItem.hide !== true,
|
||||||
type: templateItem.type
|
type: templateItem.type
|
||||||
};
|
};
|
||||||
//debugger;
|
|
||||||
vm.obj.push(objItem);
|
vm.obj.push(objItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,14 +368,6 @@ function initDataObject(vm) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////
|
|
||||||
//
|
|
||||||
function ensureTemplateIsInStore(vm) {
|
|
||||||
return window.$gz.formCustomTemplate.get(
|
|
||||||
vm.$route.params.formCustomTemplateKey
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
OLD (not used, drop)
|
OLD (not used, drop)
|
||||||
"ObjectCustomFieldCustomGrid": "Custom Fields",
|
"ObjectCustomFieldCustomGrid": "Custom Fields",
|
||||||
|
|||||||
Reference in New Issue
Block a user