From 9af85a9a64efbc59e0e0cf37eb881e6c165ffdae Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 20 Feb 2020 16:08:32 +0000 Subject: [PATCH] --- ayanova/src/api/locale.js | 8 +-- ayanova/src/views/ay-data-list-view.vue | 89 +++++++++++++++++-------- 2 files changed, 63 insertions(+), 34 deletions(-) diff --git a/ayanova/src/api/locale.js b/ayanova/src/api/locale.js index bea5e578..14e0a30d 100644 --- a/ayanova/src/api/locale.js +++ b/ayanova/src/api/locale.js @@ -158,13 +158,7 @@ export default { "AM", "PM", "DataListView", - "FilterUnsaved", - "Include", - "AnyUser", - "Sort", - "Filter", - "GridFilterDialogAndRadioText", - "GridFilterDialogOrRadioText" + "FilterUnsaved" ], //////////////////////////////////////////////////////// diff --git a/ayanova/src/views/ay-data-list-view.vue b/ayanova/src/views/ay-data-list-view.vue index a17703a7..ded717e7 100644 --- a/ayanova/src/views/ay-data-list-view.vue +++ b/ayanova/src/views/ay-data-list-view.vue @@ -150,8 +150,13 @@
- DATETIME BUILDER OPERATOR:DATEPICKER/TOKENPICKER - (depending on operator):ADD BUTTON + fa-plus +
@@ -631,10 +636,10 @@ function generateMenu(vm) { // // function initForm(vm) { - //return test(); return new Promise(function(resolve, reject) { (async function() { try { + await fetchUILocalizedText(vm); await populateFieldDefinitions(vm); await fetchLocalizedFieldNames(vm); await setEffectiveListView(vm); @@ -643,15 +648,63 @@ function initForm(vm) { reject(err); } resolve(); - ////////// })(); }); } +////////////////////////////////////////////////////////// +// +// Ensures UI localized text is available +// +function fetchUILocalizedText(vm) { + var ltKeysRequired = [ + "Include", + "AnyUser", + "Sort", + "Filter", + "GridFilterDialogAndRadioText", + "GridFilterDialogOrRadioText", + "GridRowFilterDropDownBlanksItem", + "GridRowFilterDropDownNonBlanksItem", + "GridRowFilterDropDownEquals", + "GridRowFilterDropDownGreaterThan", + "GridRowFilterDropDownGreaterThanOrEqualTo", + "GridRowFilterDropDownLessThan", + "GridRowFilterDropDownLessThanOrEqualTo", + "GridRowFilterDropDownNotEquals", + "GridRowFilterDropDownDoesNotContain", + "GridRowFilterDropDownContains", + "GridRowFilterDropDownStartsWith", + "GridRowFilterDropDownEndsWith", + "SelectItem", + "DateRangeYesterday", + "DateRangeToday", + "DateRangeTomorrow", + "DateRangeLastWeek", + "DateRangeThisWeek", + "DateRangeNextWeek", + "DateRangeLastMonth", + "DateRangeThisMonth", + "DateRangeNextMonth", + "DateRange14DayWindow", + "DateRangePast", + "DateRangeFuture", + "DateRangeLastYear", + "DateRangeThisYear", + "DateRangeInTheLastThreeMonths", + "DateRangeInTheLastSixMonths", + "DateRangePastYear", + "DateRangePast90Days", + "DateRangePast30Days", + "DateRangePast24Hours" + ]; + + return window.$gz.locale.fetch(ltKeysRequired); +} + //////////////////// // 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) @@ -660,7 +713,6 @@ function populateFieldDefinitions(vm) { throw res.error; } else { vm.fieldDefinitions = res.data; - //console.log("DONE populatefieldDefinitions"); } }); } @@ -670,7 +722,6 @@ function populateFieldDefinitions(vm) { // 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]; @@ -678,8 +729,6 @@ function fetchLocalizedFieldNames(vm) { } //Now fetch all the keys and await the response before returning return window.$gz.locale.fetch(columnKeys).then(() => { - //console.log("DONE fetchLTFN"); - return; }); } @@ -688,8 +737,6 @@ function fetchLocalizedFieldNames(vm) { // // function setEffectiveListView(vm) { - //console.log("called setEffectiveListView"); - /* effectiveListView - Second get the ListView that is currently in use so can setup the page view @@ -709,7 +756,6 @@ objPublic, objName if (formSettings.saved.dataTable.editedListView != null) { vm.effectiveListView = formSettings.saved.dataTable.editedListView; vm.objName = vm.lt("FilterUnsaved"); - //console.log("DONE setEffectiveListView (resolved with saved, lvid=-1)"); return Promise.resolve(); } } else if (vm.listViewId == 0) { @@ -723,21 +769,10 @@ objPublic, objName } else { vm.effectiveListView = JSON.parse(res.data); vm.objName = vm.lt("FilterUnsaved"); - //console.log("DONE setEffectiveListView (fetched default, lvid=0)"); } }); } else { //listview has an id value - //fetch, cache and set - // if ( - // formSettings.temp.dataTable && - // formSettings.temp.dataTable.cachedListView != null - // ) { - // vm.effectiveListView = formSettings.temp.dataTable.cachedListView; - // //console.log("DONE setEffectiveListView (resolved with cached,lvid>0)"); - // return Promise.resolve(); - // } else { - //fetch it and cache it return window.$gz.api.get("DataListView/" + vm.listViewId).then(res => { if (res.error != undefined) { throw res.error; @@ -745,7 +780,6 @@ objPublic, objName vm.effectiveListView = JSON.parse(res.data.listView); vm.objPublic = res.data.public; vm.objName = res.data.name; - //console.log("DONE setEffectiveListView (fetched listView, lvid>0)"); } }); } @@ -780,7 +814,8 @@ function initDataObject(vm) { uiFieldDataType: fld.uiFieldDataType, isCustomField: fld.isCustomField, sort: lvItem.sort || null, - filter: lvItem.filter || { any: false, items: [] } + filter: lvItem.filter || { any: false, items: [] }, + tempOperator: null }; ret.push(o); } @@ -806,13 +841,13 @@ function initDataObject(vm) { uiFieldDataType: fld.uiFieldDataType, isCustomField: fld.isCustomField, sort: null, - filter: { any: false, items: [] } + filter: { any: false, items: [] }, + tempOperator: null }; ret.push(o); } } vm.obj = ret; - //console.log("DONE InitDataObject"); if (window.$gz.errorHandler.devMode) { if (vm.obj.length != vm.fieldDefinitions.length - 1) {