This commit is contained in:
2019-06-05 18:38:30 +00:00
parent 47d037dc76
commit 65967d4992
4 changed files with 58 additions and 20 deletions

View File

@@ -9,13 +9,11 @@ NEXT TODOS:
DONE (for widgetlist grid and basic views): VIEW PERSISTANCE / STATE
- There is temporary SESSION DATA and PERSISTED SESSION DATA
- Some needs to go on closing session (login/logout) and some needs to stay
- Persist view on return
- useful info here: https://vuejsdevelopers.com/2017/04/16/vue-js-browser-button-ux/
- there's another item like this below somewhere.
- Widget list, refresh page causes items per page to reset back to 5 from custom setting, it should cache that shit at least for a session anyway
- Although people probably would want this to be saved to survive sessions
- maybe it should save it per device locally only so that the customizations are local to the device so they can customize differently for different ui's?
- Or, maybe they always want to see 50 widgets no matter where but 10 clients??
- useful info here: https://vuejsdevelopers.com/2017/04/16/vue-js-browser-button-ux/
- Widget list, refresh page causes items per page to reset back to 5 from custom setting, it should cache that shit at least for a session anyway
- SCROLL POSITION !! - Very important, must return UI to exact scroll position on navigation backwards, not doing so causes a hellish UI to use.
- Seems to be a thing in teh vue router already:
- https://router.vuejs.org/guide/advanced/scroll-behavior.html
@@ -63,7 +61,7 @@ TODO: Local user settings page / UI where can
- set locale choices and values
- Reset to default form settings
- Other shit I can't think of right now but there will be a lot
TODO: Add formstate data to technical support information
### RETEST ALL DEVICES WHEN GET TO HERE #####

View File

@@ -61,6 +61,7 @@ export function processLogout() {
store.commit("logItem", "auth::processLogout -> User logged out");
}
store.commit("logout");
sessionStorage.clear(); //clear all temporary session storage data
}
export function isLoggedIn() {

View File

@@ -13,6 +13,7 @@ import Vue from "vue";
import errorHandler from "./errorhandler";
import store from "../store";
var triggeringChange = false;
function isEmpty(o) {
@@ -512,20 +513,35 @@ export default {
// for form specified or empty object if there is none
// EAch form is responsible for what it stores and how it initializes, this just provides that
// the form does the actual work of what settings it requires
// Form settings are temp and saved, saved ones go into vuex and localstorage and temporary ones are stored in session storage
//
getFormSettings(formKey) {
var theFormSettings = store.state.formSettings[formKey];
return theFormSettings;
return {
temp: JSON.parse(sessionStorage.getItem(formKey)),
saved: store.state.formSettings[formKey]
};
},
////////////////////////////////////
// Set form settings
// for form key specified
//
// requires object with one or both keys {temp:{...tempformsettings...},saved:{...persistedformsettings...}}
//
setFormSettings(formKey, formSettings) {
store.commit("setFormSettings", {
formKey: formKey,
formSettings: formSettings
});
if (errorHandler.devMode()) {
if (!formSettings.saved && !formSettings.temp) {
throw "gzform:setFormSettings - saved AND temp keys are both missing from form data!";
}
}
if (formSettings.saved) {
store.commit("setFormSettings", {
formKey: formKey,
formSettings: formSettings.saved
});
}
if (formSettings.temp) {
sessionStorage.setItem(formKey, JSON.stringify(formSettings.temp));
}
}
};

View File

@@ -97,15 +97,31 @@ export default {
});
})
.then(() => {
var storedFormSettings = that.$gzform.getFormSettings(FORM_KEY);
var formSettings = that.$gzform.getFormSettings(FORM_KEY);
/**
* {
temp: { page: that.localFormSettings.pagination.page },
saved: {
rowsPerPage: that.localFormSettings.pagination.rowsPerPage,
sortBy: that.localFormSettings.pagination.sortBy,
descending: that.localFormSettings.pagination.descending
}
}
*/
//set default values for form settings if they are not present yet
if (!storedFormSettings) {
storedFormSettings = {
if (!formSettings.saved || !formSettings.saved.rowsPerPage) {
that.localFormSettings = {
pagination: {}
};
} else {
that.localFormSettings = storedFormSettings;
that.localFormSettings.pagination = {
rowsPerPage: formSettings.saved.rowsPerPage,
sortBy: formSettings.saved.sortBy,
descending: formSettings.saved.descending
};
if (formSettings.temp && formSettings.temp.page) {
that.localFormSettings.pagination.page = formSettings.temp.page;
}
}
that.formState.ready = true;
@@ -192,7 +208,14 @@ export default {
that.localFormSettings.pagination &&
that.localFormSettings.pagination.rowsPerPage
) {
that.$gzform.setFormSettings(FORM_KEY, that.localFormSettings);
that.$gzform.setFormSettings(FORM_KEY, {
temp: { page: that.localFormSettings.pagination.page },
saved: {
rowsPerPage: that.localFormSettings.pagination.rowsPerPage,
sortBy: that.localFormSettings.pagination.sortBy,
descending: that.localFormSettings.pagination.descending
}
});
}
this.loading = true;