Merge pull request #18773 from ankush/dashboards_not_loading

fix: standard dashboards not loading
This commit is contained in:
Ankush Menat 2022-11-06 11:39:17 +05:30 committed by GitHub
commit afe992f1e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 2 deletions

View file

@ -0,0 +1,50 @@
describe("Dashboard view", { scrollBehavior: false }, () => {
before(() => {
cy.login();
cy.visit("/app");
});
it("should load", () => {
const chart = "TODO-YEARLY-TRENDS";
const dashboard = "TODO-TEST-DASHBOARD"; // check slash in name intentionally.
cy.insert_doc(
"Dashboard Chart",
{
is_standard: 0,
chart_name: chart,
chart_type: "Count",
document_type: "ToDo",
parent_document_type: "",
based_on: "creation",
group_by_type: "Count",
timespan: "Last Year",
time_interval: "Yearly",
timeseries: 1,
type: "Line",
filters_json: "[]",
},
true
);
cy.insert_doc(
"Dashboard",
{
name: dashboard,
dashboard_name: dashboard,
is_standard: 0,
charts: [
{
chart: chart,
},
],
},
true
);
cy.visit(`/app/dashboard-view/${dashboard}`);
// expect chart to be loaded
cy.findByText(chart).should("be.visible");
});
});

View file

@ -137,13 +137,13 @@ frappe.breadcrumbs = {
const doctype_meta = frappe.get_doc("DocType", doctype);
if (
(doctype === "User" && !frappe.user.has_role("System Manager")) ||
(doctype_meta && doctype_meta.issingle)
doctype_meta?.issingle
) {
// no user listview for non-system managers and single doctypes
} else {
let route;
const doctype_route = frappe.router.slug(frappe.router.doctype_layout || doctype);
if (doctype_meta.is_tree) {
if (doctype_meta?.is_tree) {
let view = frappe.model.user_settings[doctype].last_view || "Tree";
route = `${doctype_route}/view/${view}`;
} else {