From ae59b59e30778858c5c0ecc76029eb3690d042fa Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 30 Jan 2020 21:34:50 +0000 Subject: [PATCH] --- ayanova/src/api/open-object-handler.js | 65 ++++---------------------- 1 file changed, 9 insertions(+), 56 deletions(-) diff --git a/ayanova/src/api/open-object-handler.js b/ayanova/src/api/open-object-handler.js index bf872f1d..cbd71660 100644 --- a/ayanova/src/api/open-object-handler.js +++ b/ayanova/src/api/open-object-handler.js @@ -6,69 +6,22 @@ export default { // // 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 + handleOpenObjectClick(vm, tid) { + //expects extra data (tid) to be { type: [AYATYPE], id: [RECORDID] } - //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; + if (tid.type && tid.id) { + switch (tid.type) { 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 + - "]" + "open-object-handler: unrecognized type [" + tid.type + "]" ); } } @@ -81,9 +34,9 @@ export default { // wireUpEventHandlers(vm) { var self = this; - - window.$gz.eventBus.$on("openobject", function handleOpenObjectClick(data) { - self.handleAppClick(vm, data); + //expects extra data (tid) to be { type: [AYATYPE], id: [RECORDID] } + window.$gz.eventBus.$on("openobject", function handleOpenObjectClick(tid) { + self.handleAppClick(vm, tid); }); } //new functions above here