This commit is contained in:
2020-06-19 23:08:47 +00:00
parent 160d84d954
commit 606f91092f
2 changed files with 41 additions and 48 deletions

View File

@@ -548,16 +548,14 @@ export default {
}
}
},
created() {
async created() {
//get pick lists
let vm = this;
initForm(vm).then(() => {
//rehydrate last form settings
//loadFormSettings(vm);
vm.loading = false;
vm.getDataFromApi();
});
await initForm(vm);
//rehydrate last form settings
//loadFormSettings(vm);
vm.loading = false;
vm.getDataFromApi();
}
};
@@ -724,10 +722,8 @@ async function fetchTranslatedHeaderNames(columnData) {
let cm = columnData[i];
headerKeys.push(cm.cm);
}
//Now fetch all the keys and await the response before returning
await window.$gz.translation.cacheTranslations(headerKeys).then(() => {
return;
});
//Now fetch all the keys
await window.$gz.translation.cacheTranslations(headerKeys);
}
//////////////////////////////////////////////////////////
@@ -766,35 +762,33 @@ function initForm(vm) {
////////////////////
//
function populateSelectionLists(vm) {
async function populateSelectionLists(vm) {
//http://localhost:7575/api/v8/data-list-view/viewlist?ListKey=TestWidgetDataList
return window.$gz.api
.get("data-list-view/viewlist?ListKey=" + vm.dataListKey)
.then(res => {
if (res.error) {
window.$gz.errorHandler.handleFormError(res.error, vm);
} else {
vm.selectLists.listViews = res.data;
window.$gz.form.addNoSelectionItem(vm.selectLists.listViews);
}
});
let res = await window.$gz.api.get(
"data-list-view/viewlist?ListKey=" + vm.dataListKey
);
if (res.error) {
window.$gz.errorHandler.handleFormError(res.error, vm);
} else {
vm.selectLists.listViews = res.data;
window.$gz.form.addNoSelectionItem(vm.selectLists.listViews);
}
}
//////////////////////////////////////////////////////////
//
// Fetch and cache list view
//
function fetchListView(vm) {
async function fetchListView(vm) {
if (!vm.listViewId) {
return;
}
return window.$gz.api.get("data-list-view/" + vm.listViewId).then(res => {
if (res.error) {
window.$gz.errorHandler.handleFormError(res.error, vm);
} else {
vm.listView = res.data.listView;
}
});
let res = await window.$gz.api.get("data-list-view/" + vm.listViewId);
if (res.error) {
window.$gz.errorHandler.handleFormError(res.error, vm);
} else {
vm.listView = res.data.listView;
}
}
////////////////////

View File

@@ -240,7 +240,7 @@ export default {
// }
// }
},
getList: function(urlParams) {
getList: async function(urlParams) {
let vm = this;
if (vm.fetching) {
return;
@@ -253,22 +253,21 @@ export default {
urlParams += "&inactive=true";
}
}
window.$gz.api
.get("pick-list/List" + urlParams)
.then(res => {
vm.fetching = false;
//We never expect there to be no data here
if (!res.data) {
throw res;
}
vm.searchResults = res.data;
window.$gz.form.addNoSelectionItem(vm.searchResults);
vm.replaceLastSelection();
})
.catch(err => {
window.$gz.errorHandler.handleFormError(err);
vm.fetching = false;
});
try {
let res = await window.$gz.api.get("pick-list/List" + urlParams);
vm.fetching = false;
//We never expect there to be no data here
if (!res.data) {
throw res;
}
vm.searchResults = res.data;
window.$gz.form.addNoSelectionItem(vm.searchResults);
vm.replaceLastSelection();
} catch (err) {
window.$gz.errorHandler.handleFormError(err);
vm.fetching = false;
}
},
doSearch: _.debounce(function(searchFor) {
//NOTE debounce with a watcher is a bit different, currently it has to be done exactly this way, nothing else will work properly