From 439775b699d9fad2754b54afd122f526bb299723 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sun, 29 Mar 2020 20:40:01 +0000 Subject: [PATCH] Fixed issue with translation not done in correct time when fetch template and available fields also login form button margin fixed as bottom element was obscuring if in developer mode with vertically shorter screen mode --- ayanova/src/api/translation.js | 1 - .../src/views/adm-global-select-templates.vue | 57 ++++++++++--------- ayanova/src/views/login.vue | 2 +- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/ayanova/src/api/translation.js b/ayanova/src/api/translation.js index b1dc9921..9d3f0122 100644 --- a/ayanova/src/api/translation.js +++ b/ayanova/src/api/translation.js @@ -42,7 +42,6 @@ export default { window.$gz.store.commit("addTranslationText", item); } ); - console.log("3"); resolve(); }); }); diff --git a/ayanova/src/views/adm-global-select-templates.vue b/ayanova/src/views/adm-global-select-templates.vue index 871b9595..37a9b7ed 100644 --- a/ayanova/src/views/adm-global-select-templates.vue +++ b/ayanova/src/views/adm-global-select-templates.vue @@ -180,7 +180,7 @@ export default { } window.$gz.form.deleteAllErrorBoxErrors(vm); - console.log("1"); + // console.log("1"); //get available fields window.$gz.api .get(API_BASE_URL + "ListFields/" + vm.templateId) @@ -194,41 +194,43 @@ export default { for (var i = 0; i < res.data.length; i++) { vm.fieldKeys.push(res.data[i].tKey); } + //console.log("2"); + return window.$gz.translation.fetch(vm.fieldKeys); } }) - .then( - window.$gz.translation.fetch(vm.fieldKeys) - //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 + // .then -//THIS MIGHT BE RELEVANT, LOOK INTO IT: https://stackoverflow.com/questions/40981040/using-a-fetch-inside-another-fetch-in-javascript + // //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 - //get translations for field names + // //THIS MIGHT BE RELEVANT, LOOK INTO IT: https://stackoverflow.com/questions/40981040/using-a-fetch-inside-another-fetch-in-javascript - // 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( + // //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() { + console.log("3"); //get current edited template window.$gz.api.get(API_BASE_URL + vm.templateId).then(res => { if (res.error != undefined) { vm.formState.serverError = res.error; window.$gz.form.setErrorBoxErrors(vm); } else { - console.log("4"); vm.obj = res.data; synthesizeWorkingArray(vm); //Update the form status @@ -240,8 +242,8 @@ export default { readOnly: res.readOnly ? true : false }); } - }) - ) + }); + }) .catch(function handleGetDataFromAPIError(error) { //Update the form status window.$gz.form.setFormState({ @@ -429,6 +431,7 @@ function populateSelectionLists(vm) { //////////////////// // function synthesizeWorkingArray(vm) { + // console.log("4 Synthesize: sb final step"); vm.workingArray = []; if (vm.obj.template == null) { return; diff --git a/ayanova/src/views/login.vue b/ayanova/src/views/login.vue index d37aec7e..82ac95bf 100644 --- a/ayanova/src/views/login.vue +++ b/ayanova/src/views/login.vue @@ -1,6 +1,6 @@