This commit is contained in:
@@ -133,7 +133,11 @@ export default {
|
||||
next();
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
window.$gz.eventBus.$off("menu-click", clickHandler);
|
||||
},
|
||||
created() {
|
||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||
//NOTE: this would normally be in getDataFromAPI but this form doesn't really need that function so doing it here
|
||||
//modify the menu as necessary
|
||||
generateMenu(this, false); //default is never read only and passing in this vm
|
||||
@@ -197,6 +201,52 @@ function enableSaveButton() {
|
||||
window.$gz.eventBus.$emit("menu-enable-item", FORM_KEY + ":save");
|
||||
}
|
||||
|
||||
/////////////////////////////
|
||||
//
|
||||
//
|
||||
function clickHandler(menuItem) {
|
||||
if (!menuItem) {
|
||||
return;
|
||||
}
|
||||
var m = window.$gz.menu.parseMenuItem(menuItem);
|
||||
if (m.owner == FORM_KEY && !m.disabled) {
|
||||
switch (m.key) {
|
||||
case "save":
|
||||
m.vm.submit();
|
||||
break;
|
||||
case "delete":
|
||||
m.vm.remove();
|
||||
break;
|
||||
case "duplicate":
|
||||
m.vm.duplicate();
|
||||
break;
|
||||
case "report":
|
||||
//TODO: FOLLOWING TWO LINES STILL VALID BUT NEED TO MAKE A REPORT CHOOSER COMPONENT
|
||||
// var reportList = window.$gz.report.availableReports("WIDGET");
|
||||
// var selectedItem = reportList[0].value;
|
||||
alert("STUB: REPORT LIST DIALOG");
|
||||
|
||||
// window.$gz.dialog
|
||||
// .getReportChoice(m.vm, reportList, selectedItem)
|
||||
// .then(res => {
|
||||
// if (res) {
|
||||
// window.$gz.eventBus.$emit(
|
||||
// "notify-success",
|
||||
// FORM_KEY + "::report click, selected is: [" + res + "]"
|
||||
// );
|
||||
// }
|
||||
// });
|
||||
|
||||
break;
|
||||
default:
|
||||
window.$gz.eventBus.$emit(
|
||||
"notify-warning",
|
||||
FORM_KEY + "::context click: [" + m.key + "]"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
//
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user