From c2289eaf30d847cbac6002f9b23ab055e9d21322 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 18 Apr 2019 22:03:16 +0000 Subject: [PATCH] --- ayanova/src/api/gzmenu.js | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/ayanova/src/api/gzmenu.js b/ayanova/src/api/gzmenu.js index 8d3636e9..70ff69ad 100644 --- a/ayanova/src/api/gzmenu.js +++ b/ayanova/src/api/gzmenu.js @@ -1,7 +1,8 @@ /* Xeslint-disable */ +import { processLogout } from "./authutil"; ///////////////////////////////// -// Menu utils and handlers (if necessary) +// Menu utils and handlers // export default { /////////////////////////////// @@ -46,7 +47,8 @@ export default { that.appBar.menuItems.push({ title: that.$gzlocale.get("MenuHelp"), icon: "question-circle", - key: "app:help:" + that.appBar.helpUrl + key: "app:help", + data: that.appBar.helpUrl }); }, /////////////////////////////// @@ -75,19 +77,26 @@ export default { // Deal with a menu change request // called from App.vue handleClick(that, menuitem) { - if (!menuitem.disabled && menuitem.key.startsWith("app:")) { - if (menuitem.key.startsWith("app:help:")) { - // "https://www.ayanova.com/AyaNova7webHelp/" + - var helpurl = - that.$store.state.helpUrl + menuitem.key.replace("app:help:", ""); - window.open(helpurl, "_blank"); - } else { - alert("STUB gzmenu::handleClick - menu item clicked: " + menuitem.key); - } + //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" key of the menu item (e.g. the url in a app:help link) - //Logout - // auth.logout(); - // this.$router.replace({ name: "login" }); + //Handle different items + if (!menuitem.disabled && menuitem.key.startsWith("app:")) { + switch (menuitem.key) { + case "app:help": + var helpurl = that.$store.state.helpUrl + menuitem.data; + window.open(helpurl, "_blank"); + break; + case "app:logout": + processLogout(); + that.$router.replace({ name: "login" }); + break; + default: + alert( + "gzmenu:handleClick - unrecognized command [" + menuitem.key + "]" + ); + } } } //new functions above here