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",
"PM",
"DataListView",
"FilterUnsaved",
"Include",
"AnyUser",
"Sort",
"Filter",
"GridFilterDialogAndRadioText",
"GridFilterDialogOrRadioText"
"FilterUnsaved"
],
////////////////////////////////////////////////////////

View File

@@ -150,8 +150,13 @@
<!-- BUILDER FOR EACH TYPE Tag, decimal,currency, bool, integer, string, datetime -->
<!-- DATETIME BUILDER -->
<div v-if="item.uiFieldDataType === 1">
DATETIME BUILDER OPERATOR:DATEPICKER/TOKENPICKER
(depending on operator):ADD BUTTON
<v-btn text><v-icon>fa-plus</v-icon></v-btn>
<v-select
v-model="item.tempOperator"
:items="pickLists.dateFilterOperators"
item-text="name"
item-value="id"
></v-select>
</div>
<!-- STRING(text-4, emailaddress-11, http-12) BUILDER -->
@@ -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) {