This commit is contained in:
2020-06-20 14:21:59 +00:00
parent 639916fbfa
commit 79a476cb49
8 changed files with 23 additions and 29 deletions

View File

@@ -58,7 +58,7 @@ export default {
// eslint-disable-next-line
let res = await window.$gz.api.get("enum-list/list/" + enumKey);
//We never expect there to be no data here
if (!res.data) {
if (!res.hasOwnProperty("data")) {
throw res;
}
return res.data;

View File

@@ -429,7 +429,7 @@ export default {
});
},
listViewChanged: function() {
listViewChanged: async function() {
let vm = this;
//If listview had changed it can only have changed *away* from the unsaved filter item if it's present so just remove the unsaved filter item if it exists
@@ -442,37 +442,29 @@ export default {
// return n.id == -1;
// });
//first prevent the following changes from triggering a fetch
vm.loading = true;
//always go back to page one on a change of data list view
vm.dataTablePagingOptions.page = 1;
for (let i = vm.selectLists.listViews.length - 1; i >= 0; i--) {
if (vm.selectLists.listViews[i].id === -1) {
vm.selectLists.listViews.splice(i, 1);
}
}
let ShouldGetData = vm.dataTablePagingOptions.page == 1;
if (vm.listViewId == 0) {
//default view, no saved, no cached
vm.listView = undefined;
saveFormSettings(vm);
if (ShouldGetData) {
vm.getDataFromApi();
} else {
vm.dataTablePagingOptions.page = 1;
}
//
} else if (vm.listViewId > 0) {
(async function() {
await fetchListView(vm);
saveFormSettings(vm);
if (ShouldGetData) {
vm.getDataFromApi();
} else {
vm.dataTablePagingOptions.page = 1;
}
})();
await fetchListView(vm);
saveFormSettings(vm);
}
//fetch data because listview has changed
vm.loading = false;
vm.getDataFromApi();
},
gridCellButtonClick(key, i) {
//translate key to actual object type from header data

View File

@@ -258,7 +258,7 @@ export default {
vm.fetching = false;
//We never expect there to be no data here
if (!res.data) {
if (!res.hasOwnProperty("data")) {
throw res;
}
vm.searchResults = res.data;

View File

@@ -82,7 +82,7 @@ export default {
let res = await window.$gz.api.get("tag-list/list?query=" + val); //roles
//We never expect there to be no data here
if (!res.data) {
if (!res.hasOwnProperty("data")) {
throw res;
}
//adding this to the property will automatically have it cached by the autocomplete component

View File

@@ -559,14 +559,14 @@ async function initForm(vm) {
await fetchTranslatedText(vm);
let res = await window.$gz.api.get("license");
//We never expect there to be no data here
if (!res.data) {
if (!res.hasOwnProperty("data")) {
throw res;
}
vm.currentLicenseInfo = res.data.license;
res = await window.$gz.api.get("license/database-empty");
//We never expect there to be no data here
if (!res.data) {
if (!res.hasOwnProperty("data")) {
throw res;
}
vm.dbIsEmpty = res.data;

View File

@@ -291,7 +291,7 @@ async function fetchTranslatedText(vm) {
async function getServerInfo(vm) {
let res = await window.$gz.api.get("server-info");
//We never expect there to be no data here
if (!res.data) {
if (!res.hasOwnProperty("data")) {
throw res;
} else {
vm.serverInfo = res.data;

View File

@@ -164,7 +164,7 @@ export default {
//Does the database need to be erased?
let res = await window.$gz.api.get("license/database-empty");
//We never expect there to be no data here
if (!res.data) {
if (!res.hasOwnProperty("data")) {
throw res;
}
if (res.data != true) {