diff --git a/ayanova/src/App.vue b/ayanova/src/App.vue index fc582c37..2bb91baa 100644 --- a/ayanova/src/App.vue +++ b/ayanova/src/App.vue @@ -218,7 +218,7 @@ import ayaNovaVersion from "./api/ayanova-version"; import gzconfirm from "./components/gzconfirm"; import gznotify from "./components/gznotify"; -//import gztest from "./components/gztest"; +import openObjectHandler from "./api/open-object-handler"; export default { components: { @@ -241,12 +241,12 @@ export default { created() { ////////////////////////////////// // WIRE UP - // MENU and DIALOG EVENT HANDLERS - // ON GZEVENTBUS + // EVENT HANDLERS ON GZEVENTBUS // // window.$gz.menu.wireUpEventHandlers(this); window.$gz.dialog.wireUpEventHandlers(this); + openObjectHandler.wireUpEventHandlers(this); }, beforeDestroy() { //UNWIRE ALL EVENT HANDLERS FROM GZEVENTBUS diff --git a/ayanova/src/api/open-object-handler.js b/ayanova/src/api/open-object-handler.js new file mode 100644 index 00000000..bf872f1d --- /dev/null +++ b/ayanova/src/api/open-object-handler.js @@ -0,0 +1,90 @@ +/* xxxeslint-disable */ + +export default { + /////////////////////////////// + // APP (GLOBAL) openobject CLICK HANDLER + // + // Deal with a request to open an object (from main datatables mainly) + // called from App.vue + handleOpenObjectClick(vm, 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 + //split a key into component parts, part one is the responsible party, part two is the command, part three only exists to make it unique if necessary + //each part is separated by a colon + + //Handle different items + var item = this.parseMenuItem(menuItem); + if (!item.disabled && item.owner == "app") { + switch (item.key) { + case "help": + var helpurl = vm.$store.state.helpUrl + item.data; + window.open(helpurl, "_blank"); + break; + case "search": + vm.$router.push({ + name: "home-search", + params: { ayatype: item.data } + }); + break; + case "attachments": + vm.$router.push({ + name: "ay-attachments", + params: { ayatype: item.data.ayaType, recordid: item.data.recordId } + }); + break; + case "wiki": + vm.$router.push({ + name: "ay-wiki", + params: { ayatype: item.data.ayaType, recordid: item.data.recordId } + }); + break; + case "review": + vm.$router.push({ + name: "ay-review", + params: { ayatype: item.data.ayaType, recordid: item.data.recordId } + }); + break; + case "history": + vm.$router.push({ + name: "ay-history", + params: { ayatype: item.data.ayaType, recordid: item.data.recordId } + }); + break; + case "logout": + vm.$router.push("/login"); + break; + case "customize": + vm.$router.push({ + name: "ay-customize", + params: { formCustomTemplateKey: item.data } + }); + break; + case "nav": + vm.$router.push({ name: item.data }); + break; + default: + window.$gz.eventBus.$emit( + "notify-warning", + "gzmenu:handleAppClick - unrecognized command [" + + menuItem.key + + "]" + ); + } + } + }, + + /////////////////////////////////// + // WIRE UP MENU EVENTS + // + // called once from app.vue only + // + wireUpEventHandlers(vm) { + var self = this; + + window.$gz.eventBus.$on("openobject", function handleOpenObjectClick(data) { + self.handleAppClick(vm, data); + }); + } + //new functions above here +}; diff --git a/ayanova/src/components/gz-data-table.vue b/ayanova/src/components/gz-data-table.vue index 52f07005..98b71b28 100644 --- a/ayanova/src/components/gz-data-table.vue +++ b/ayanova/src/components/gz-data-table.vue @@ -64,10 +64,10 @@ -
+