From 4231675e25f61e52bced32630a0b7ff46e101f65 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 19 Feb 2020 00:03:13 +0000 Subject: [PATCH] --- ayanova/src/views/ay-data-list-view.vue | 124 ++++++++---------------- 1 file changed, 43 insertions(+), 81 deletions(-) diff --git a/ayanova/src/views/ay-data-list-view.vue b/ayanova/src/views/ay-data-list-view.vue index f32500ed..3c88d793 100644 --- a/ayanova/src/views/ay-data-list-view.vue +++ b/ayanova/src/views/ay-data-list-view.vue @@ -330,68 +330,48 @@ function initForm(vm) { (async function() { await populateFieldDefinitions(vm); await fetchLocalizedFieldNames(vm); + await setEffectiveListView(vm); + await initDataObject(vm); resolve(); ////////// })(); }); } -function test() { - return new Promise(function(resolve, reject) { - setTimeout(() => resolve(1), 1000); // (*) - }) - .then(function(result) { - // (**) - - console.log(result); // 1 - return result * 2; - }) - .then(function(result) { - // (***) - - console.log(result); // 2 - return result * 2; - }) - .then(function(result) { - console.log(result); // 4 - return result * 2; - }); -} - -// //////////////////// -// // -// function populateFieldDefinitions(vm) { -// console.log("called populatefieldDefinitions"); -// //http://localhost:7575/api/v8/DataList/ListFields?DataListKey=TestWidgetDataList -// return window.$gz.api -// .get("DataList/ListFields?DataListKey=" + vm.dataListKey) -// .then(res => { -// if (res.error != undefined) { -// throw res.error; -// } else { -// vm.fieldDefinitions = res.data; -// console.log("DONE populatefieldDefinitions"); -// } -// }); -// } - //////////////////// // function populateFieldDefinitions(vm) { console.log("called populatefieldDefinitions"); - return new Promise(function populate(resolve, reject) { - //http://localhost:7575/api/v8/DataList/ListFields?DataListKey=TestWidgetDataList - return window.$gz.api - .get("DataList/ListFields?DataListKey=" + vm.dataListKey) - .then(res => { - if (res.error != undefined) { - reject(res.error); - } else { - vm.fieldDefinitions = res.data; - console.log("DONE populatefieldDefinitions"); - resolve(); - } - }); + //http://localhost:7575/api/v8/DataList/ListFields?DataListKey=TestWidgetDataList + return window.$gz.api + .get("DataList/ListFields?DataListKey=" + vm.dataListKey) + .then(res => { + if (res.error != undefined) { + throw res.error; + } else { + vm.fieldDefinitions = res.data; + console.log("DONE populatefieldDefinitions"); + } + }); +} + + + +////////////////////////////////////////////////////////// +// +// Ensures column names are present in locale table +// +function fetchLocalizedFieldNames(vm) { + console.log("called fetchLTFN"); + var columnKeys = []; + for (var i = 1; i < vm.fieldDefinitions.length; i++) { + var cm = vm.fieldDefinitions[i]; + columnKeys.push(cm.ltKey); + } + //Now fetch all the keys and await the response before returning + return window.$gz.locale.fetch(columnKeys).then(() => { + console.log("DONE fetchLTFN"); + return; }); } @@ -401,38 +381,20 @@ function populateFieldDefinitions(vm) { // // // function fetchLocalizedFieldNames(vm) { // console.log("called fetchLTFN"); -// var columnKeys = []; -// for (var i = 1; i < vm.fieldDefinitions.length; i++) { -// var cm = vm.fieldDefinitions[i]; -// columnKeys.push(cm.ltKey); -// } -// //Now fetch all the keys and await the response before returning -// return window.$gz.locale.fetch(columnKeys).then(() => { -// console.log("DONE fetchLTFN"); -// return; +// return new Promise(function fetchLFN(resolve, reject) { +// var columnKeys = []; +// for (var i = 1; i < vm.fieldDefinitions.length; i++) { +// var cm = vm.fieldDefinitions[i]; +// columnKeys.push(cm.ltKey); +// } +// //Now fetch all the keys and await the response before returning +// window.$gz.locale.fetch(columnKeys).then(() => { +// console.log("DONE fetchLTFN"); +// resolve(); +// }); // }); // } -////////////////////////////////////////////////////////// -// -// Ensures column names are present in locale table -// -function fetchLocalizedFieldNames(vm) { - console.log("called fetchLTFN"); - return new Promise(function fetchLFN(resolve, reject) { - var columnKeys = []; - for (var i = 1; i < vm.fieldDefinitions.length; i++) { - var cm = vm.fieldDefinitions[i]; - columnKeys.push(cm.ltKey); - } - //Now fetch all the keys and await the response before returning - window.$gz.locale.fetch(columnKeys).then(() => { - console.log("DONE fetchLTFN"); - resolve(); - }); - }); -} - ///////////////////////////////// // //