Added auto-open object and also some fixes for vuex store issues revealed when adding this feature
This commit is contained in:
@@ -9,6 +9,10 @@ todo: can I receive an email link to an AyaNova object that opens the AyaNova ap
|
|||||||
- a link to localhost:8080?go=2,1
|
- a link to localhost:8080?go=2,1
|
||||||
- http://localhost:7575?go=2,1
|
- http://localhost:7575?go=2,1
|
||||||
|
|
||||||
|
|
||||||
|
todo: persisted state: https://github.com/robinvdvleuten/vuex-persistedstate
|
||||||
|
- I can control which paths are persisted, maybe there is shit in there that doesn't need to be persisted or shouldn't be
|
||||||
|
|
||||||
todo: remember scroll position in lists when returning, make sure it is working, will be a pain if not
|
todo: remember scroll position in lists when returning, make sure it is working, will be a pain if not
|
||||||
|
|
||||||
todo: OPS routes (SERVER AND CLIENT)
|
todo: OPS routes (SERVER AND CLIENT)
|
||||||
|
|||||||
@@ -276,22 +276,6 @@ export default {
|
|||||||
window.$gz.eventBus.$off();
|
window.$gz.eventBus.$off();
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
//Open object after login?
|
|
||||||
if (window.location.search) {
|
|
||||||
//https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
|
|
||||||
var searchParams = new URLSearchParams(window.location.search);
|
|
||||||
var openObject = {};
|
|
||||||
//data should be format for open-object-handler
|
|
||||||
// { type: [AYATYPE], id: [RECORDID] }
|
|
||||||
if (searchParams.has("type")) {
|
|
||||||
openObject.type = searchParams.get("type");
|
|
||||||
if (searchParams.has("id")) {
|
|
||||||
openObject.type = searchParams.get("id");
|
|
||||||
}
|
|
||||||
window.$gz.store.commit("setOpenObject", openObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$root.$gzconfirm = this.$refs.gzconfirm.open;
|
this.$root.$gzconfirm = this.$refs.gzconfirm.open;
|
||||||
this.$root.$gznotify = this.$refs.gznotify.addNotification;
|
this.$root.$gznotify = this.$refs.gznotify.addNotification;
|
||||||
|
|
||||||
@@ -300,6 +284,24 @@ export default {
|
|||||||
//this smells bad but it works
|
//this smells bad but it works
|
||||||
this.$root.$gz = window.$gz;
|
this.$root.$gz = window.$gz;
|
||||||
|
|
||||||
|
//Capture open object type and id if present
|
||||||
|
//localhost:8080/login?type=2&id=22
|
||||||
|
|
||||||
|
if (window.location.search) {
|
||||||
|
//https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams
|
||||||
|
var searchParams = new URLSearchParams(window.location.search);
|
||||||
|
var openObject = {};
|
||||||
|
//data should be format for open-object-handler
|
||||||
|
// { type: [AYATYPE], id: [RECORDID] }
|
||||||
|
if (searchParams.has("type")) {
|
||||||
|
openObject.type = Number(searchParams.get("type"));
|
||||||
|
if (searchParams.has("id")) {
|
||||||
|
openObject.id = Number(searchParams.get("id"));
|
||||||
|
}
|
||||||
|
window.$gz.store.commit("setOpenObject", openObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//redirect to login if not authenticated
|
//redirect to login if not authenticated
|
||||||
if (!this.$store.state.authenticated) {
|
if (!this.$store.state.authenticated) {
|
||||||
this.$router.push("login");
|
this.$router.push("login");
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ export function processLogin(response) {
|
|||||||
return reject();
|
return reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//ensure the store is clean first in case we didn't come here from a clean logout
|
||||||
|
window.$gz.store.commit("logout");
|
||||||
|
sessionStorage.clear(); //clear all temporary session storage data
|
||||||
|
|
||||||
//Put app relevant items into vuex store so app can use them
|
//Put app relevant items into vuex store so app can use them
|
||||||
window.$gz.store.commit("login", {
|
window.$gz.store.commit("login", {
|
||||||
apiToken: response.data.token,
|
apiToken: response.data.token,
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
/* Xeslint-disable */
|
/* Xeslint-disable */
|
||||||
|
|
||||||
import "@fortawesome/fontawesome-free/css/all.css";
|
import "@fortawesome/fontawesome-free/css/all.css";
|
||||||
import "typeface-roboto/index.css";
|
import "typeface-roboto/index.css";
|
||||||
import "github-markdown-css";
|
import "github-markdown-css";
|
||||||
@@ -55,7 +54,7 @@ import attachmentControl from "./components/attachment-control.vue";
|
|||||||
//DEVELOPMENT MODE
|
//DEVELOPMENT MODE
|
||||||
//THIS SHOULD BE FALSE IN RELEASE
|
//THIS SHOULD BE FALSE IN RELEASE
|
||||||
//************************************************************
|
//************************************************************
|
||||||
const DEV_MODE = false;
|
const DEV_MODE = true;
|
||||||
//************************************************************
|
//************************************************************
|
||||||
//**************************************************************
|
//**************************************************************
|
||||||
//**************************************************************
|
//**************************************************************
|
||||||
|
|||||||
@@ -7,8 +7,17 @@ const MaxLogLength = 100;
|
|||||||
|
|
||||||
Vue.use(Vuex);
|
Vue.use(Vuex);
|
||||||
|
|
||||||
|
//reset all local settings via url in case of fucked up situation
|
||||||
|
if (window.location.search) {
|
||||||
|
var searchParams = new URLSearchParams(window.location.search);
|
||||||
|
if (searchParams.has("reset")) {
|
||||||
|
localStorage.removeItem("AyaNova");
|
||||||
|
console.log("RESET LOCAL SETTINGS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default new Vuex.Store({
|
export default new Vuex.Store({
|
||||||
plugins: [createPersistedState()],
|
plugins: [createPersistedState({ key: "AyaNova" })],
|
||||||
state: {
|
state: {
|
||||||
openObject: null,
|
openObject: null,
|
||||||
lastClientVersion: "",
|
lastClientVersion: "",
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ export default {
|
|||||||
auth
|
auth
|
||||||
.authenticate(vm.input.username, vm.input.password)
|
.authenticate(vm.input.username, vm.input.password)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (vm.$store.state.openObject) {
|
if (vm.$store.state.openObject != null) {
|
||||||
window.$gz.eventBus.$emit("openobject", null);
|
window.$gz.eventBus.$emit("openobject", null);
|
||||||
} else {
|
} else {
|
||||||
vm.$router.push(vm.$store.state.homePage);
|
vm.$router.push(vm.$store.state.homePage);
|
||||||
|
|||||||
Reference in New Issue
Block a user