This commit is contained in:
2019-04-19 20:57:06 +00:00
parent 56f8ee0a35
commit 2a15d8e1aa
6 changed files with 39 additions and 33 deletions

View File

@@ -128,7 +128,7 @@ export default {
mounted() {
//redirect to login if not authenticated
if (!this.$store.state.authenticated) {
this.$router.replace({ name: "login" });
this.$router.push({ name: "login" });
}
},
computed: {

View File

@@ -87,7 +87,7 @@ export default {
//
// Deal with a menu change request
// called from App.vue
handleAppClick(that, menuitem) {
handleAppClick(that, menuItem) {
//Key will start with the string "app:" if it's a global application command that should be handled here,
//otherwise it's a local command for a local form only
//If there is any extended information required for the command it will be in the data property of the menu item
@@ -95,41 +95,45 @@ export default {
//each part is separated by a colon
//Handle different items
if (!menuitem.disabled && menuitem.key.startsWith("app:")) {
var keyparts = menuitem.key.split(":");
var cmd = keyparts[1];
switch (cmd) {
var item = this.parseMenuItem(menuItem);
if (!item.disabled && item.owner == "app") {
switch (item.key) {
case "help":
var helpurl = that.$store.state.helpUrl + menuitem.data;
var helpurl = that.$store.state.helpUrl + item.data;
window.open(helpurl, "_blank");
break;
case "logout":
processLogout();
that.$router.replace({ name: "login" });
that.$router.push({ name: "login" });
break;
case "nav":
that.$router.replace({ name: menuitem.data });
that.$router.push({ name: item.data });
break;
default:
alert(
"gzmenu:handleAppClick - unrecognized command [" +
menuitem.key +
menuItem.key +
"]"
);
}
}
},
///////////////////////////////
// CONFIRM RELEVANT CLICK
// PARSE MENU ITEM CLICK
//
// confirm the click is relevant
// to a contextual caller
// called by all forms except app.vue
isRelevantClick(menuitem) {
if (!menuitem.disabled && !menuitem.key.startsWith("app:")) {
return true;
}
return false;
// parse out the parts of a
// menu item from a click event
//
parseMenuItem(menuItem) {
//format is "AREA:KEY:UNIQUEID"
//and data is in data portion
var keyparts = menuItem.key.split(":");
return {
owner: keyparts[0],
key: keyparts[1],
data: menuItem.data,
disabled: menuItem.disabled
};
}
//new functions above here
};

View File

@@ -107,9 +107,10 @@
/* Xeslint-disable */
import aboutInfo from "../api/aboutinfo";
// function clickHandler(item) {
// if (this.$gzmenu.isRelevantClick(item)) {
// alert("about.vue::context click: " + item.key);
// function clickHandler(menuItem) {
// var item = this.$gzmenu.parseMenuItem(menuItem);
// if (item.owner == "about" && !item.disabled) {
// alert("about::context click: " + item.key);
// }
// }

View File

@@ -130,8 +130,9 @@
<script>
/* xeslint-disable */
function clickHandler(item) {
if (this.$gzmenu.isRelevantClick(item)) {
function clickHandler(menuItem) {
var item = this.$gzmenu.parseMenuItem(menuItem);
if (item.owner == "inventory-widget-edit" && !item.disabled) {
alert("inventory-widget-edit.vue::context click: " + item.key);
}
}

View File

@@ -79,7 +79,7 @@ export default {
auth
.authenticate(this.input.username, this.input.password)
.then(() => {
this.$router.replace({ name: "home" });
this.$router.push({ name: "home" });
})
.catch(function handleCaughtLoginError(error) {
/* xeslint-disable-next-line */