This commit is contained in:
@@ -31,6 +31,7 @@ function dealWithError(msg, vm) {
|
|||||||
msg;
|
msg;
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(errMsg);
|
console.log(errMsg);
|
||||||
|
console.trace();
|
||||||
debugger;
|
debugger;
|
||||||
window.$gz.eventBus.$emit("notify-error", "Dev error see log / console");
|
window.$gz.eventBus.$emit("notify-error", "Dev error see log / console");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ function devShowUnknownError(error) {
|
|||||||
console.log("gzapi::devShowUnknownError, error is:");
|
console.log("gzapi::devShowUnknownError, error is:");
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
console.trace();
|
||||||
debugger;
|
debugger;
|
||||||
|
|
||||||
window.$gz.eventBus.$emit(
|
window.$gz.eventBus.$emit(
|
||||||
@@ -284,19 +285,12 @@ export default {
|
|||||||
// GET DATA FROM API SERVER
|
// GET DATA FROM API SERVER
|
||||||
//
|
//
|
||||||
get(route) {
|
get(route) {
|
||||||
//console.log("gzapi::get(" + route + ")");
|
|
||||||
var that = this;
|
var that = this;
|
||||||
return new Promise(function getDataFromServer(resolve, reject) {
|
return new Promise(function getDataFromServer(resolve, reject) {
|
||||||
fetch(that.APIUrl(route), that.fetchGetOptions())
|
fetch(that.APIUrl(route), that.fetchGetOptions())
|
||||||
.then(that.status)
|
.then(that.status)
|
||||||
.then(that.json)
|
.then(that.json)
|
||||||
.then(response => {
|
.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);
|
resolve(response);
|
||||||
})
|
})
|
||||||
.catch(function handleGetError(error) {
|
.catch(function handleGetError(error) {
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ function getErrorsForField(vm, ref) {
|
|||||||
//client field names are generally lower case except for custom fields
|
//client field names are generally lower case except for custom fields
|
||||||
//so we need to normalize them all to lower case to match
|
//so we need to normalize them all to lower case to match
|
||||||
//they will always differ by more than case so this is fine
|
//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();
|
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
|
// This is required so that server errors can be cleared when input is changed
|
||||||
//
|
//
|
||||||
onChange(vm, ref) {
|
onChange(vm, ref) {
|
||||||
//xeslint-disable-next-line
|
|
||||||
//WidgetCustom2
|
|
||||||
//console.log("GZFORM::onChange triggered for field " + ref);
|
|
||||||
if (triggeringChange || vm.formState.loading) {
|
if (triggeringChange || vm.formState.loading) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -659,11 +656,6 @@ export default {
|
|||||||
saved: window.$gz.store.state.formSettings[formKey]
|
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;
|
return formSettings;
|
||||||
},
|
},
|
||||||
////////////////////////////////////
|
////////////////////////////////////
|
||||||
@@ -672,7 +664,6 @@ export default {
|
|||||||
// requires object with one or both keys {temp:{...tempformsettings...},saved:{...persistedformsettings...}}
|
// requires object with one or both keys {temp:{...tempformsettings...},saved:{...persistedformsettings...}}
|
||||||
//
|
//
|
||||||
setFormSettings(formKey, formSettings) {
|
setFormSettings(formKey, formSettings) {
|
||||||
// console.log("gzform::setFormSettings for formkey:" + formKey);
|
|
||||||
if (window.$gz.errorHandler.devMode()) {
|
if (window.$gz.errorHandler.devMode()) {
|
||||||
if (!formSettings.saved && !formSettings.temp) {
|
if (!formSettings.saved && !formSettings.temp) {
|
||||||
throw "gzform:setFormSettings - saved AND temp keys are both missing from form data!";
|
throw "gzform:setFormSettings - saved AND temp keys are both missing from form data!";
|
||||||
@@ -689,11 +680,6 @@ export default {
|
|||||||
if (formSettings.temp) {
|
if (formSettings.temp) {
|
||||||
sessionStorage.setItem(formKey, JSON.stringify(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
|
// Add no selection item
|
||||||
// Used by forms that need the option of an unselected
|
// Used by forms that need the option of an unselected
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ export default function initialize() {
|
|||||||
window.$gz.locale
|
window.$gz.locale
|
||||||
.fetch(window.$gz.locale.coreKeys)
|
.fetch(window.$gz.locale.coreKeys)
|
||||||
.then(function initializeNavPanel() {
|
.then(function initializeNavPanel() {
|
||||||
// console.log("INIT NAV PANEL");
|
|
||||||
var key = 0;
|
var key = 0;
|
||||||
var sub = [];
|
var sub = [];
|
||||||
|
|
||||||
@@ -732,7 +731,6 @@ export default function initialize() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
//console.log("INIT FETCH USEROPTIONS AND CACHE");
|
|
||||||
//CACHE LOCALE SETTINGS
|
//CACHE LOCALE SETTINGS
|
||||||
window.$gz.api
|
window.$gz.api
|
||||||
.get("UserOptions/" + window.$gz.store.state.userId)
|
.get("UserOptions/" + window.$gz.store.state.userId)
|
||||||
|
|||||||
@@ -210,7 +210,6 @@ export default {
|
|||||||
this.$store.state.formCustomTemplate[this.formKey],
|
this.$store.state.formCustomTemplate[this.formKey],
|
||||||
["dataKey", dataKey]
|
["dataKey", dataKey]
|
||||||
).type;
|
).type;
|
||||||
//console.log("Field with datakey " + dataKey + " is of type " + ctrlType);
|
|
||||||
|
|
||||||
//First get current value for the data that came from the server
|
//First get current value for the data that came from the server
|
||||||
var ret = cData[dataKey];
|
var ret = cData[dataKey];
|
||||||
|
|||||||
@@ -403,9 +403,7 @@ export default {
|
|||||||
if (vm.listViewId == 0) {
|
if (vm.listViewId == 0) {
|
||||||
//default view, no saved, no cached
|
//default view, no saved, no cached
|
||||||
vm.listView = undefined;
|
vm.listView = undefined;
|
||||||
// console.log(
|
|
||||||
// "listViewchanged: Default NO LIST VIEW selected - Calling saveformsettings"
|
|
||||||
// );
|
|
||||||
saveFormSettings(vm);
|
saveFormSettings(vm);
|
||||||
if (ShouldGetData) {
|
if (ShouldGetData) {
|
||||||
vm.getDataFromApi();
|
vm.getDataFromApi();
|
||||||
@@ -415,11 +413,8 @@ export default {
|
|||||||
//
|
//
|
||||||
} else if (vm.listViewId > 0) {
|
} else if (vm.listViewId > 0) {
|
||||||
(async function() {
|
(async function() {
|
||||||
// console.log("listViewchanged: awaiting fetchListView...");
|
|
||||||
await fetchListView(vm);
|
await fetchListView(vm);
|
||||||
// console.log(
|
|
||||||
// "listViewchanged: back from fetchListView calling save form settings"
|
|
||||||
// );
|
|
||||||
saveFormSettings(vm);
|
saveFormSettings(vm);
|
||||||
if (ShouldGetData) {
|
if (ShouldGetData) {
|
||||||
vm.getDataFromApi();
|
vm.getDataFromApi();
|
||||||
@@ -447,7 +442,6 @@ export default {
|
|||||||
if (vm.loading) {
|
if (vm.loading) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// console.log("getDataFromAPI::TOP");
|
|
||||||
|
|
||||||
//start with defaults
|
//start with defaults
|
||||||
var listOptions = {
|
var listOptions = {
|
||||||
@@ -462,22 +456,8 @@ export default {
|
|||||||
listOptions.Limit = itemsPerPage;
|
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;
|
vm.loading = true;
|
||||||
|
|
||||||
// {
|
|
||||||
// "offset": 0,
|
|
||||||
// "limit": 0,
|
|
||||||
// "dataListKey": "string",
|
|
||||||
// "listView": "string"
|
|
||||||
// }
|
|
||||||
// console.log("GetDataFromAPI::ListView is:");
|
|
||||||
// console.log(vm.listView);
|
|
||||||
window.$gz.api
|
window.$gz.api
|
||||||
.upsert(vm.apiBaseUrl, {
|
.upsert(vm.apiBaseUrl, {
|
||||||
offset: listOptions.Offset,
|
offset: listOptions.Offset,
|
||||||
@@ -719,7 +699,6 @@ function populatePickLists(vm) {
|
|||||||
vm.pickLists.listViews = res.data;
|
vm.pickLists.listViews = res.data;
|
||||||
window.$gz.form.addNoSelectionItem(vm.pickLists.listViews);
|
window.$gz.form.addNoSelectionItem(vm.pickLists.listViews);
|
||||||
}
|
}
|
||||||
// console.log("Done populate picklists");
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -728,7 +707,6 @@ function populatePickLists(vm) {
|
|||||||
// Fetch and cache list view
|
// Fetch and cache list view
|
||||||
//
|
//
|
||||||
function fetchListView(vm) {
|
function fetchListView(vm) {
|
||||||
//console.log("fetchListView::TOP");
|
|
||||||
if (!vm.listViewId) {
|
if (!vm.listViewId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -737,10 +715,6 @@ function fetchListView(vm) {
|
|||||||
window.$gz.errorHandler.handleFormError(res.error, vm);
|
window.$gz.errorHandler.handleFormError(res.error, vm);
|
||||||
} else {
|
} else {
|
||||||
vm.listView = res.data.listView;
|
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) {
|
function saveFormSettings(vm) {
|
||||||
// console.log("saveFormSettings::TOP");
|
|
||||||
|
|
||||||
var unsavedlv = vm.listView;
|
var unsavedlv = vm.listView;
|
||||||
var cachedlv = vm.listView;
|
var cachedlv = vm.listView;
|
||||||
|
|
||||||
@@ -781,9 +753,6 @@ function saveFormSettings(vm) {
|
|||||||
////////////////////
|
////////////////////
|
||||||
//
|
//
|
||||||
function loadFormSettings(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);
|
var formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
||||||
|
|
||||||
//process SAVED formsettings
|
//process SAVED formsettings
|
||||||
@@ -808,10 +777,8 @@ function loadFormSettings(vm) {
|
|||||||
name: vm.lt("FilterUnsaved"),
|
name: vm.lt("FilterUnsaved"),
|
||||||
id: -1
|
id: -1
|
||||||
});
|
});
|
||||||
// console.log("loadFormSettings::unsaved Listview in use. It is:");
|
|
||||||
|
|
||||||
vm.listView = formSettings.saved.dataTable.unsavedListView;
|
vm.listView = formSettings.saved.dataTable.unsavedListView;
|
||||||
// console.log(vm.listView);
|
|
||||||
} else {
|
} else {
|
||||||
//listviewid is for unsaved but we have no unsaved so fix that up
|
//listviewid is for unsaved but we have no unsaved so fix that up
|
||||||
vm.listView = undefined;
|
vm.listView = undefined;
|
||||||
|
|||||||
@@ -428,16 +428,10 @@ const FORM_KEY = "ay-data-list-view";
|
|||||||
const API_BASE_URL = "DataListView/";
|
const API_BASE_URL = "DataListView/";
|
||||||
var JUST_DELETED = false;
|
var JUST_DELETED = false;
|
||||||
export default {
|
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
|
//unsaved changes are actually valid for this form so no need to warn
|
||||||
beforeRouteLeave(to, from, next) {
|
beforeRouteLeave(to, from, next) {
|
||||||
console.log("ay-data-list-view::beforeRouteLeave hit");
|
|
||||||
var vm = this;
|
var vm = this;
|
||||||
if (this.formState.dirty && !JUST_DELETED) {
|
if (this.formState.dirty && !JUST_DELETED) {
|
||||||
console.log("before route leave: setting to unsaved list view ");
|
|
||||||
//Put in unsaved listview
|
//Put in unsaved listview
|
||||||
var formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
var formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
||||||
formSettings.saved.dataTable.unsavedListView = JSON.stringify(
|
formSettings.saved.dataTable.unsavedListView = JSON.stringify(
|
||||||
@@ -456,7 +450,7 @@ export default {
|
|||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
var vm = this;
|
var vm = this;
|
||||||
console.log("ay-data-list-view::created hit");
|
|
||||||
//set route values in data object so init form can handle
|
//set route values in data object so init form can handle
|
||||||
vm.dataListKey = this.$route.params.dataListKey;
|
vm.dataListKey = this.$route.params.dataListKey;
|
||||||
vm.listViewId = this.$route.params.listViewId;
|
vm.listViewId = this.$route.params.listViewId;
|
||||||
@@ -476,7 +470,6 @@ export default {
|
|||||||
vm.formState.loading = false;
|
vm.formState.loading = false;
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
//console.log("CREATED: ERROR back from initform with error");
|
|
||||||
vm.formState.ready = true;
|
vm.formState.ready = true;
|
||||||
window.$gz.errorHandler.handleFormError(err);
|
window.$gz.errorHandler.handleFormError(err);
|
||||||
});
|
});
|
||||||
@@ -759,11 +752,6 @@ export default {
|
|||||||
if (res.data.id) {
|
if (res.data.id) {
|
||||||
//Handle "post" of new record (CREATE)
|
//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
|
//Update the formSettings now that it's saved
|
||||||
var formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
var formSettings = window.$gz.form.getFormSettings(vm.formKey);
|
||||||
formSettings.temp.cachedListview = lvSave.listView;
|
formSettings.temp.cachedListview = lvSave.listView;
|
||||||
@@ -1290,8 +1278,6 @@ function setEffectiveListView(vm) {
|
|||||||
////////////////////
|
////////////////////
|
||||||
//
|
//
|
||||||
function initDataObject(vm) {
|
function initDataObject(vm) {
|
||||||
//console.log("called initDataObject");
|
|
||||||
|
|
||||||
if (vm.effectiveListView == null) {
|
if (vm.effectiveListView == null) {
|
||||||
throw "ay-data-list::initDataObject - effectiveListView is not set";
|
throw "ay-data-list::initDataObject - effectiveListView is not set";
|
||||||
}
|
}
|
||||||
@@ -1401,8 +1387,6 @@ function fetchEnums(vm) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (enumKeys.length > 0) {
|
if (enumKeys.length > 0) {
|
||||||
// console.log("fetchEnums::calling fetchenumlist for:");
|
|
||||||
// console.log(enumKeys);
|
|
||||||
return window.$gz.enums.fetchEnumList(enumKeys);
|
return window.$gz.enums.fetchEnumList(enumKeys);
|
||||||
}
|
}
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
|
|||||||
Reference in New Issue
Block a user