cleaned up comments and testing logs
This commit is contained in:
@@ -172,7 +172,6 @@ export default {
|
|||||||
this.getDataFromApi();
|
this.getDataFromApi();
|
||||||
},
|
},
|
||||||
getDataFromApi() {
|
getDataFromApi() {
|
||||||
//COP*IED FROM WIDGET TO BE MODIFIED
|
|
||||||
var vm = this;
|
var vm = this;
|
||||||
vm.formState.loading = true;
|
vm.formState.loading = true;
|
||||||
if (!vm.templateId || vm.templateId == 0) {
|
if (!vm.templateId || vm.templateId == 0) {
|
||||||
@@ -180,7 +179,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
||||||
// console.log("1");
|
|
||||||
//get available fields
|
//get available fields
|
||||||
window.$gz.api
|
window.$gz.api
|
||||||
.get(API_BASE_URL + "ListFields/" + vm.templateId)
|
.get(API_BASE_URL + "ListFields/" + vm.templateId)
|
||||||
@@ -194,37 +193,11 @@ export default {
|
|||||||
for (var i = 0; i < res.data.length; i++) {
|
for (var i = 0; i < res.data.length; i++) {
|
||||||
vm.fieldKeys.push(res.data[i].tKey);
|
vm.fieldKeys.push(res.data[i].tKey);
|
||||||
}
|
}
|
||||||
//console.log("2");
|
|
||||||
return window.$gz.translation.fetch(vm.fieldKeys);
|
return window.$gz.translation.fetch(vm.fieldKeys);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// .then
|
|
||||||
|
|
||||||
// //TODO: this is fucked and I don't know why, maybe because it's calling a new thing, not processing the existing thing?
|
|
||||||
// //way easier to just return the template with the ltkeys already processed at the server instead of this fuckery,
|
|
||||||
// //but it would be good to know what the fuck is happening,maybe it needs await and stuff like in ay-data-list-view initform example since they are all new calls
|
|
||||||
// //rather than in then which is I think there to chain the first call basically
|
|
||||||
|
|
||||||
// //THIS MIGHT BE RELEVANT, LOOK INTO IT: https://stackoverflow.com/questions/40981040/using-a-fetch-inside-another-fetch-in-javascript
|
|
||||||
|
|
||||||
// //get translations for field names
|
|
||||||
|
|
||||||
// // console.log("fetchTranslatedFieldNames");
|
|
||||||
// // if (!fields) {
|
|
||||||
// // return;
|
|
||||||
// // }
|
|
||||||
// // var fieldKeys = [];
|
|
||||||
// // for (var i = 0; i < fields.length; i++) {
|
|
||||||
// // fieldKeys.push(fields[i].tKey);
|
|
||||||
// // }
|
|
||||||
// // //Now fetch all the keys and await the response before returning
|
|
||||||
// // await window.$gz.translation.fetch(fieldKeys).then(() => {
|
|
||||||
// // console.log("fetchTranslatedFieldNames:done");
|
|
||||||
// // return;
|
|
||||||
// // });
|
|
||||||
// ()
|
|
||||||
.then(function() {
|
.then(function() {
|
||||||
console.log("3");
|
//weirdly, this wasn't working properly until I put it in a function, it was just executing immediately before translations were resolved from fetch above
|
||||||
//get current edited template
|
//get current edited template
|
||||||
window.$gz.api.get(API_BASE_URL + vm.templateId).then(res => {
|
window.$gz.api.get(API_BASE_URL + vm.templateId).then(res => {
|
||||||
if (res.error != undefined) {
|
if (res.error != undefined) {
|
||||||
@@ -431,7 +404,6 @@ function populateSelectionLists(vm) {
|
|||||||
////////////////////
|
////////////////////
|
||||||
//
|
//
|
||||||
function synthesizeWorkingArray(vm) {
|
function synthesizeWorkingArray(vm) {
|
||||||
// console.log("4 Synthesize: sb final step");
|
|
||||||
vm.workingArray = [];
|
vm.workingArray = [];
|
||||||
if (vm.obj.template == null) {
|
if (vm.obj.template == null) {
|
||||||
return;
|
return;
|
||||||
@@ -458,7 +430,6 @@ function synthesizeWorkingArray(vm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Now iterate all the available fields and insert the ones that were not in the current template
|
//Now iterate all the available fields and insert the ones that were not in the current template
|
||||||
|
|
||||||
for (var i = 0; i < vm.availableFields.length; i++) {
|
for (var i = 0; i < vm.availableFields.length; i++) {
|
||||||
var afItem = vm.availableFields[i];
|
var afItem = vm.availableFields[i];
|
||||||
//skip the active column
|
//skip the active column
|
||||||
@@ -479,24 +450,4 @@ function synthesizeWorkingArray(vm) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////
|
|
||||||
// //
|
|
||||||
// // Ensures field names are present in translation table
|
|
||||||
// //
|
|
||||||
// async function fetchTranslatedFieldNames(fields) {
|
|
||||||
// console.log("fetchTranslatedFieldNames:top");
|
|
||||||
// if (!fields) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// var fieldKeys = [];
|
|
||||||
// for (var i = 0; i < fields.length; i++) {
|
|
||||||
// fieldKeys.push(fields[i].tKey);
|
|
||||||
// }
|
|
||||||
// //Now fetch all the keys and await the response before returning
|
|
||||||
// await window.$gz.translation.fetch(fieldKeys).then(() => {
|
|
||||||
// console.log("fetchTranslatedFieldNames:done");
|
|
||||||
// return;
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user