This commit is contained in:
2020-02-25 23:32:05 +00:00
parent 5482ef30cd
commit 9dda20a7c2
7 changed files with 6 additions and 77 deletions

View File

@@ -31,6 +31,7 @@ function dealWithError(msg, vm) {
msg;
// eslint-disable-next-line no-console
console.log(errMsg);
console.trace();
debugger;
window.$gz.eventBus.$emit("notify-error", "Dev error see log / console");
}

View File

@@ -27,6 +27,7 @@ function devShowUnknownError(error) {
console.log("gzapi::devShowUnknownError, error is:");
// eslint-disable-next-line
console.log(error);
console.trace();
debugger;
window.$gz.eventBus.$emit(
@@ -284,19 +285,12 @@ export default {
// GET DATA FROM API SERVER
//
get(route) {
//console.log("gzapi::get(" + route + ")");
var that = this;
return new Promise(function getDataFromServer(resolve, reject) {
fetch(that.APIUrl(route), that.fetchGetOptions())
.then(that.status)
.then(that.json)
.then(response => {
//KEEP this for diagnostics and testing to put a delay on fetches to check if my promise-fu is on point
// setTimeout(() => {
// console.log("gzapi::get->Calling resolve now for " + route);
// resolve(response); // (**)
// }, 2000);
resolve(response);
})
.catch(function handleGetError(error) {

View File

@@ -106,7 +106,7 @@ function getErrorsForField(vm, ref) {
//client field names are generally lower case except for custom fields
//so we need to normalize them all to lower case to match
//they will always differ by more than case so this is fine
// console.log("getErrorsForField finding matches, comparing serverErrorField:["+o.target.toLowerCase() + "] to form field ref:["+ref.toLowerCase()+"]");
return o.target.toLowerCase() == ref.toLowerCase();
});
}
@@ -574,9 +574,6 @@ export default {
// This is required so that server errors can be cleared when input is changed
//
onChange(vm, ref) {
//xeslint-disable-next-line
//WidgetCustom2
//console.log("GZFORM::onChange triggered for field " + ref);
if (triggeringChange || vm.formState.loading) {
return;
}
@@ -659,11 +656,6 @@ export default {
saved: window.$gz.store.state.formSettings[formKey]
};
console.log(
"gzForm::getFormSettings list view id is:" +
window.$gz.store.state.formSettings["test-widgets"].dataTable.listViewId
);
return formSettings;
},
////////////////////////////////////
@@ -672,7 +664,6 @@ export default {
// requires object with one or both keys {temp:{...tempformsettings...},saved:{...persistedformsettings...}}
//
setFormSettings(formKey, formSettings) {
// console.log("gzform::setFormSettings for formkey:" + formKey);
if (window.$gz.errorHandler.devMode()) {
if (!formSettings.saved && !formSettings.temp) {
throw "gzform:setFormSettings - saved AND temp keys are both missing from form data!";
@@ -689,11 +680,6 @@ export default {
if (formSettings.temp) {
sessionStorage.setItem(formKey, JSON.stringify(formSettings.temp));
}
console.trace();
console.log(
"gzForm::setFormSettings at bottom after commit, listviewid in store is:" +
window.$gz.store.state.formSettings["test-widgets"].dataTable.listViewId
);
}, ////////////////////////////////////
// Add no selection item
// Used by forms that need the option of an unselected

View File

@@ -20,7 +20,6 @@ export default function initialize() {
window.$gz.locale
.fetch(window.$gz.locale.coreKeys)
.then(function initializeNavPanel() {
// console.log("INIT NAV PANEL");
var key = 0;
var sub = [];
@@ -732,7 +731,6 @@ export default function initialize() {
}
})
.then(() => {
//console.log("INIT FETCH USEROPTIONS AND CACHE");
//CACHE LOCALE SETTINGS
window.$gz.api
.get("UserOptions/" + window.$gz.store.state.userId)

View File

@@ -210,7 +210,6 @@ export default {
this.$store.state.formCustomTemplate[this.formKey],
["dataKey", dataKey]
).type;
//console.log("Field with datakey " + dataKey + " is of type " + ctrlType);
//First get current value for the data that came from the server
var ret = cData[dataKey];

View File

@@ -403,9 +403,7 @@ export default {
if (vm.listViewId == 0) {
//default view, no saved, no cached
vm.listView = undefined;
// console.log(
// "listViewchanged: Default NO LIST VIEW selected - Calling saveformsettings"
// );
saveFormSettings(vm);
if (ShouldGetData) {
vm.getDataFromApi();
@@ -415,11 +413,8 @@ export default {
//
} else if (vm.listViewId > 0) {
(async function() {
// console.log("listViewchanged: awaiting fetchListView...");
await fetchListView(vm);
// console.log(
// "listViewchanged: back from fetchListView calling save form settings"
// );
saveFormSettings(vm);
if (ShouldGetData) {
vm.getDataFromApi();
@@ -447,7 +442,6 @@ export default {
if (vm.loading) {
return;
}
// console.log("getDataFromAPI::TOP");
//start with defaults
var listOptions = {
@@ -462,22 +456,8 @@ export default {
listOptions.Limit = itemsPerPage;
}
// //effective ListView
// if (vm.listViewId != 0) {
// //we have a listview id so there will be a temp cached listview
// listOptions["DataFilterID"] = vm.dataFilterId;
// }
vm.loading = true;
// {
// "offset": 0,
// "limit": 0,
// "dataListKey": "string",
// "listView": "string"
// }
// console.log("GetDataFromAPI::ListView is:");
// console.log(vm.listView);
window.$gz.api
.upsert(vm.apiBaseUrl, {
offset: listOptions.Offset,
@@ -719,7 +699,6 @@ function populatePickLists(vm) {
vm.pickLists.listViews = res.data;
window.$gz.form.addNoSelectionItem(vm.pickLists.listViews);
}
// console.log("Done populate picklists");
});
}
@@ -728,7 +707,6 @@ function populatePickLists(vm) {
// Fetch and cache list view
//
function fetchListView(vm) {
//console.log("fetchListView::TOP");
if (!vm.listViewId) {
return;
}
@@ -737,10 +715,6 @@ function fetchListView(vm) {
window.$gz.errorHandler.handleFormError(res.error, vm);
} else {
vm.listView = res.data.listView;
// console.log(
// "fetchListView::insideGet, data returned, set listview to new value " +
// vm.listView
// );
}
});
}
@@ -748,8 +722,6 @@ function fetchListView(vm) {
////////////////////
//
function saveFormSettings(vm) {
// console.log("saveFormSettings::TOP");
var unsavedlv = vm.listView;
var cachedlv = vm.listView;
@@ -781,9 +753,6 @@ function saveFormSettings(vm) {
////////////////////
//
function loadFormSettings(vm) {
//console.log("loadFormSettings::TOP");
// debugger;
console.log("gz-data-table::loadFormSettings getting form settings");
var formSettings = window.$gz.form.getFormSettings(vm.formKey);
//process SAVED formsettings
@@ -808,10 +777,8 @@ function loadFormSettings(vm) {
name: vm.lt("FilterUnsaved"),
id: -1
});
// console.log("loadFormSettings::unsaved Listview in use. It is:");
vm.listView = formSettings.saved.dataTable.unsavedListView;
// console.log(vm.listView);
} else {
//listviewid is for unsaved but we have no unsaved so fix that up
vm.listView = undefined;

View File

@@ -428,16 +428,10 @@ const FORM_KEY = "ay-data-list-view";
const API_BASE_URL = "DataListView/";
var JUST_DELETED = false;
export default {
// beforeRouteEnter(to, from, next) {
// console.log("ay-data-list-view::beforeRouteEnter hit");
// next();
// },
//unsaved changes are actually valid for this form so no need to warn
beforeRouteLeave(to, from, next) {
console.log("ay-data-list-view::beforeRouteLeave hit");
var vm = this;
if (this.formState.dirty && !JUST_DELETED) {
console.log("before route leave: setting to unsaved list view ");
//Put in unsaved listview
var formSettings = window.$gz.form.getFormSettings(vm.formKey);
formSettings.saved.dataTable.unsavedListView = JSON.stringify(
@@ -456,7 +450,7 @@ export default {
},
created() {
var vm = this;
console.log("ay-data-list-view::created hit");
//set route values in data object so init form can handle
vm.dataListKey = this.$route.params.dataListKey;
vm.listViewId = this.$route.params.listViewId;
@@ -476,7 +470,6 @@ export default {
vm.formState.loading = false;
})
.catch(err => {
//console.log("CREATED: ERROR back from initform with error");
vm.formState.ready = true;
window.$gz.errorHandler.handleFormError(err);
});
@@ -759,11 +752,6 @@ export default {
if (res.data.id) {
//Handle "post" of new record (CREATE)
console.log(
"ay-data-list-view::submit, updating form settings, res.data.id is: " +
res.data.id
);
//Update the formSettings now that it's saved
var formSettings = window.$gz.form.getFormSettings(vm.formKey);
formSettings.temp.cachedListview = lvSave.listView;
@@ -1290,8 +1278,6 @@ function setEffectiveListView(vm) {
////////////////////
//
function initDataObject(vm) {
//console.log("called initDataObject");
if (vm.effectiveListView == null) {
throw "ay-data-list::initDataObject - effectiveListView is not set";
}
@@ -1401,8 +1387,6 @@ function fetchEnums(vm) {
}
}
if (enumKeys.length > 0) {
// console.log("fetchEnums::calling fetchenumlist for:");
// console.log(enumKeys);
return window.$gz.enums.fetchEnumList(enumKeys);
}
return Promise.resolve();