This commit is contained in:
2020-09-16 20:41:47 +00:00
parent 425ef921e5
commit 943e390bce
4 changed files with 55 additions and 56 deletions

View File

@@ -10,6 +10,10 @@ todo: NON DEV MODE
No stack trace in error messages! No stack trace in error messages!
But do keep stack trace in internal LOG for diagnosis But do keep stack trace in internal LOG for diagnosis
todo: when server down get this weird TypeError string at client:
"Could not connect to AyaNova server at http://localhost:7575/api/v8.0/
Error: TypeError: NetworkError when attempting to fetch resource."
todo: a script error when just running a report from the report selector acts weird todo: a script error when just running a report from the report selector acts weird
Test with dev mode off to confirm it won't show it in the UI Test with dev mode off to confirm it won't show it in the UI
Should show the error in the UI Should show the error in the UI

View File

@@ -34,7 +34,6 @@ function dealWithError(msg, vm) {
console.error(errMsg); console.error(errMsg);
console.trace(); console.trace();
debugger; debugger;
// window.$gz.eventBus.$emit("notify-error", "Dev error see log / console");
return; return;
} }

View File

@@ -89,19 +89,20 @@ export default {
let reportDataOptions = vm.reportDataOptions; let reportDataOptions = vm.reportDataOptions;
if (!reportDataOptions) { if (!reportDataOptions) {
throw new Error("Missing report data unable to render report"); this.reject("Missing report data unable to render report");
} }
reportDataOptions.ReportId = reportId; reportDataOptions.ReportId = reportId;
//Meta data from client for use by report script //Meta data from client for use by report script
reportDataOptions.ClientMeta = window.$gz.api.reportClientMetaData(); reportDataOptions.ClientMeta = window.$gz.api.reportClientMetaData();
let url = "report/render"; let url = "report/render";
let res = await window.$gz.api.upsert(url, reportDataOptions); let res = await window.$gz.api.upsert(url, reportDataOptions);
if (res.error) { if (res.error) {
throw new Error(res.error); this.reject(res);
} else { } else {
let reportUrl = window.$gz.api.reportDownloadUrl(res.data); let reportUrl = window.$gz.api.reportDownloadUrl(res.data);
if (window.open(reportUrl, "Report") == null) { if (window.open(reportUrl, "Report") == null) {
throw new Error( this.reject(
"Problem displaying report in new window. Browser must allow pop-ups to view reports; check your browser setting" "Problem displaying report in new window. Browser must allow pop-ups to view reports; check your browser setting"
); );
} }

View File

@@ -611,64 +611,59 @@ async function clickHandler(menuItem) {
return; return;
} }
let m = window.$gz.menu.parseMenuItem(menuItem); let m = window.$gz.menu.parseMenuItem(menuItem);
try { if (m.owner == FORM_KEY && !m.disabled) {
if (m.owner == FORM_KEY && !m.disabled) { switch (m.key) {
switch (m.key) { case "save":
case "save": m.vm.submit();
m.vm.submit(); break;
break; case "delete":
case "delete": m.vm.remove();
m.vm.remove(); break;
break; case "new":
case "new": m.vm.$router.push({
name: "widget-edit",
params: { recordid: 0, new: true }
});
break;
case "duplicate":
m.vm.duplicate();
break;
case "report":
if (m.id != null) {
//last report selected is in m.id
m.vm.$router.push({ m.vm.$router.push({
name: "widget-edit", name: "ay-report",
params: { recordid: 0, new: true } params: { recordid: m.id, ayatype: window.$gz.type.Widget }
}); });
break; } else {
case "duplicate": //general report selector chosen
m.vm.duplicate();
break;
case "report":
if (m.id != null) {
//last report selected is in m.id
m.vm.$router.push({
name: "ay-report",
params: { recordid: m.id, ayatype: window.$gz.type.Widget }
});
} else {
//general report selector chosen
let res = await m.vm.$refs.reportSelector.open({ let res = await m.vm.$refs.reportSelector.open({
ObjectType: window.$gz.type.Widget, ObjectType: window.$gz.type.Widget,
selectedRowIds: [m.vm.obj.id] selectedRowIds: [m.vm.obj.id]
}); });
//if null for no selection //if null for no selection
//just bail out //just bail out
if (res == null) { if (res == null) {
return; return;
}
//persist last report selected
window.$gz.form.setLastReport(FORM_KEY, res);
//Now open the report viewer...
m.vm.$router.push({
name: "ay-report",
params: { recordid: res.id, ayatype: window.$gz.type.Widget }
});
} }
break; //persist last report selected
default: window.$gz.form.setLastReport(FORM_KEY, res);
window.$gz.eventBus.$emit(
"notify-warning", //Now open the report viewer...
FORM_KEY + "::context click: [" + m.key + "]" m.vm.$router.push({
); name: "ay-report",
} params: { recordid: res.id, ayatype: window.$gz.type.Widget }
});
}
break;
default:
window.$gz.eventBus.$emit(
"notify-warning",
FORM_KEY + "::context click: [" + m.key + "]"
);
} }
} catch (ex) {
console.log("Widget menu handler error handler");
window.$gz.errorHandler.handleFormError(ex, m.vm);
} }
} }