This commit is contained in:
2020-02-20 16:08:32 +00:00
parent 63b0afc62e
commit 9af85a9a64
2 changed files with 63 additions and 34 deletions

View File

@@ -158,13 +158,7 @@ export default {
"AM", "AM",
"PM", "PM",
"DataListView", "DataListView",
"FilterUnsaved", "FilterUnsaved"
"Include",
"AnyUser",
"Sort",
"Filter",
"GridFilterDialogAndRadioText",
"GridFilterDialogOrRadioText"
], ],
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////

View File

@@ -150,8 +150,13 @@
<!-- BUILDER FOR EACH TYPE Tag, decimal,currency, bool, integer, string, datetime --> <!-- BUILDER FOR EACH TYPE Tag, decimal,currency, bool, integer, string, datetime -->
<!-- DATETIME BUILDER --> <!-- DATETIME BUILDER -->
<div v-if="item.uiFieldDataType === 1"> <div v-if="item.uiFieldDataType === 1">
DATETIME BUILDER OPERATOR:DATEPICKER/TOKENPICKER <v-btn text><v-icon>fa-plus</v-icon></v-btn>
(depending on operator):ADD BUTTON <v-select
v-model="item.tempOperator"
:items="pickLists.dateFilterOperators"
item-text="name"
item-value="id"
></v-select>
</div> </div>
<!-- STRING(text-4, emailaddress-11, http-12) BUILDER --> <!-- STRING(text-4, emailaddress-11, http-12) BUILDER -->
@@ -631,10 +636,10 @@ function generateMenu(vm) {
// //
// //
function initForm(vm) { function initForm(vm) {
//return test();
return new Promise(function(resolve, reject) { return new Promise(function(resolve, reject) {
(async function() { (async function() {
try { try {
await fetchUILocalizedText(vm);
await populateFieldDefinitions(vm); await populateFieldDefinitions(vm);
await fetchLocalizedFieldNames(vm); await fetchLocalizedFieldNames(vm);
await setEffectiveListView(vm); await setEffectiveListView(vm);
@@ -643,15 +648,63 @@ function initForm(vm) {
reject(err); reject(err);
} }
resolve(); 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) { function populateFieldDefinitions(vm) {
//console.log("called populatefieldDefinitions");
//http://localhost:7575/api/v8/DataList/ListFields?DataListKey=TestWidgetDataList //http://localhost:7575/api/v8/DataList/ListFields?DataListKey=TestWidgetDataList
return window.$gz.api return window.$gz.api
.get("DataList/ListFields?DataListKey=" + vm.dataListKey) .get("DataList/ListFields?DataListKey=" + vm.dataListKey)
@@ -660,7 +713,6 @@ function populateFieldDefinitions(vm) {
throw res.error; throw res.error;
} else { } else {
vm.fieldDefinitions = res.data; vm.fieldDefinitions = res.data;
//console.log("DONE populatefieldDefinitions");
} }
}); });
} }
@@ -670,7 +722,6 @@ function populateFieldDefinitions(vm) {
// Ensures column names are present in locale table // Ensures column names are present in locale table
// //
function fetchLocalizedFieldNames(vm) { function fetchLocalizedFieldNames(vm) {
//console.log("called fetchLTFN");
var columnKeys = []; var columnKeys = [];
for (var i = 1; i < vm.fieldDefinitions.length; i++) { for (var i = 1; i < vm.fieldDefinitions.length; i++) {
var cm = vm.fieldDefinitions[i]; var cm = vm.fieldDefinitions[i];
@@ -678,8 +729,6 @@ function fetchLocalizedFieldNames(vm) {
} }
//Now fetch all the keys and await the response before returning //Now fetch all the keys and await the response before returning
return window.$gz.locale.fetch(columnKeys).then(() => { return window.$gz.locale.fetch(columnKeys).then(() => {
//console.log("DONE fetchLTFN");
return; return;
}); });
} }
@@ -688,8 +737,6 @@ function fetchLocalizedFieldNames(vm) {
// //
// //
function setEffectiveListView(vm) { function setEffectiveListView(vm) {
//console.log("called setEffectiveListView");
/* /*
effectiveListView effectiveListView
- Second get the ListView that is currently in use so can setup the page view - 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) { if (formSettings.saved.dataTable.editedListView != null) {
vm.effectiveListView = formSettings.saved.dataTable.editedListView; vm.effectiveListView = formSettings.saved.dataTable.editedListView;
vm.objName = vm.lt("FilterUnsaved"); vm.objName = vm.lt("FilterUnsaved");
//console.log("DONE setEffectiveListView (resolved with saved, lvid=-1)");
return Promise.resolve(); return Promise.resolve();
} }
} else if (vm.listViewId == 0) { } else if (vm.listViewId == 0) {
@@ -723,21 +769,10 @@ objPublic, objName
} else { } else {
vm.effectiveListView = JSON.parse(res.data); vm.effectiveListView = JSON.parse(res.data);
vm.objName = vm.lt("FilterUnsaved"); vm.objName = vm.lt("FilterUnsaved");
//console.log("DONE setEffectiveListView (fetched default, lvid=0)");
} }
}); });
} else { } else {
//listview has an id value //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 => { return window.$gz.api.get("DataListView/" + vm.listViewId).then(res => {
if (res.error != undefined) { if (res.error != undefined) {
throw res.error; throw res.error;
@@ -745,7 +780,6 @@ objPublic, objName
vm.effectiveListView = JSON.parse(res.data.listView); vm.effectiveListView = JSON.parse(res.data.listView);
vm.objPublic = res.data.public; vm.objPublic = res.data.public;
vm.objName = res.data.name; vm.objName = res.data.name;
//console.log("DONE setEffectiveListView (fetched listView, lvid>0)");
} }
}); });
} }
@@ -780,7 +814,8 @@ function initDataObject(vm) {
uiFieldDataType: fld.uiFieldDataType, uiFieldDataType: fld.uiFieldDataType,
isCustomField: fld.isCustomField, isCustomField: fld.isCustomField,
sort: lvItem.sort || null, sort: lvItem.sort || null,
filter: lvItem.filter || { any: false, items: [] } filter: lvItem.filter || { any: false, items: [] },
tempOperator: null
}; };
ret.push(o); ret.push(o);
} }
@@ -806,13 +841,13 @@ function initDataObject(vm) {
uiFieldDataType: fld.uiFieldDataType, uiFieldDataType: fld.uiFieldDataType,
isCustomField: fld.isCustomField, isCustomField: fld.isCustomField,
sort: null, sort: null,
filter: { any: false, items: [] } filter: { any: false, items: [] },
tempOperator: null
}; };
ret.push(o); ret.push(o);
} }
} }
vm.obj = ret; vm.obj = ret;
//console.log("DONE InitDataObject");
if (window.$gz.errorHandler.devMode) { if (window.$gz.errorHandler.devMode) {
if (vm.obj.length != vm.fieldDefinitions.length - 1) { if (vm.obj.length != vm.fieldDefinitions.length - 1) {