diff --git a/frappe/boot.py b/frappe/boot.py
index c312ea6eb8..7b3a473d48 100644
--- a/frappe/boot.py
+++ b/frappe/boot.py
@@ -152,7 +152,6 @@ def load_desktop_data(bootinfo):
bootinfo.desktop_icons = get_desktop_icons()
bootinfo.workspaces = get_workspace_sidebar_items()
bootinfo.workspace_sidebar_item = get_sidebar_items()
- print(bootinfo.workspace_sidebar_item)
allowed_pages = [d.name for d in bootinfo.workspaces.get("pages")]
bootinfo.module_wise_workspaces = get_controller("Workspace").get_module_wise_workspaces()
bootinfo.dashboards = frappe.get_all("Dashboard")
@@ -542,6 +541,14 @@ def get_sidebar_items():
"icon": si.icon,
"child": si.child,
}
+ if si.link_type == "Report":
+ report_type, ref_doctype = frappe.db.get_value(
+ "Report", si.link_to, ["report_type", "ref_doctype"]
+ )
+ workspace_sidebar["report"] = {
+ "report_type": report_type,
+ "ref_doctype": ref_doctype,
+ }
sidebar_items[desktop_icon].append(workspace_sidebar)
return sidebar_items
diff --git a/frappe/public/icons/timeless/icons.svg b/frappe/public/icons/timeless/icons.svg
index 0b327777f0..5938a9d73f 100644
--- a/frappe/public/icons/timeless/icons.svg
+++ b/frappe/public/icons/timeless/icons.svg
@@ -184,7 +184,9 @@ Tip: use lucide.svg in /icons for all downloaded icons
-
+
+
+
@@ -432,6 +434,10 @@ Tip: use lucide.svg in /icons for all downloaded icons
+
+
+
+
diff --git a/frappe/public/js/frappe/ui/sidebar.js b/frappe/public/js/frappe/ui/sidebar.js
index 0a6588263b..ed4e39131a 100644
--- a/frappe/public/js/frappe/ui/sidebar.js
+++ b/frappe/public/js/frappe/ui/sidebar.js
@@ -36,6 +36,7 @@ frappe.ui.Sidebar = class Sidebar {
}
setup(workspace_title) {
if (!this.setup_complete) {
+ this.workspace_title = workspace_title;
this.make_dom();
this.apps_switcher = new frappe.ui.SidebarHeader(this, workspace_title);
this.make_sidebar(workspace_title.toLowerCase());
@@ -54,8 +55,6 @@ frappe.ui.Sidebar = class Sidebar {
this.wrapper.find(".overlay").on("click", () => {
this.close_sidebar();
});
- this.apps_switcher = new frappe.ui.SidebarHeader(this);
- this.apps_switcher.create_app_data_map();
}
set_hover() {
@@ -72,7 +71,18 @@ frappe.ui.Sidebar = class Sidebar {
set_all_pages() {
this.sidebar_items = frappe.boot.workspace_sidebar_item;
}
-
+ async set_report_items() {
+ for (let f of this.workspace_sidebar_items) {
+ if (f.link_type === "Report") {
+ const { message } = await frappe.db.get_value("Report", f.link_to, [
+ "report_type",
+ "ref_doctype",
+ ]);
+ f.report = message;
+ }
+ }
+ console.log(this.workspace_sidebar_items);
+ }
set_default_app() {
// sort apps based on # of workspaces
frappe.boot.app_data.sort((a, b) => (a.workspaces.length < b.workspaces.length ? 1 : -1));
@@ -177,7 +187,6 @@ frappe.ui.Sidebar = class Sidebar {
this.wrapper.find(".standard-sidebar-section").remove();
}
this.workspace_sidebar_items = frappe.boot.workspace_sidebar_item[workspace_title];
- let parent_pages = this.workspace_sidebar_items;
if (this.workspace_sidebar_items && this.workspace_sidebar_items.length > 0) {
this.workspace_sidebar_items.unshift({
label: "Home",
@@ -194,7 +203,7 @@ frappe.ui.Sidebar = class Sidebar {
route: `/app/${workspace_title}`,
};
}
-
+ this.set_report_items();
// this.build_sidebar_section("All", parent_pages);
this.create_sidebar();
@@ -209,6 +218,7 @@ frappe.ui.Sidebar = class Sidebar {
this.set_sidebar_state();
}
create_sidebar() {
+ this.set_report_items();
if (this.workspace_sidebar_items && this.workspace_sidebar_items.length > 0) {
let parent_links = this.workspace_sidebar_items.filter((f) => f.child !== 1);
parent_links.forEach((w) => {
@@ -305,9 +315,14 @@ frappe.ui.Sidebar = class Sidebar {
if (item.type == "Section Break") {
let current_index = this.workspace_sidebar_items.indexOf(item);
- let child_items = this.workspace_sidebar_items
- .slice(current_index)
- .filter((page) => page.child == 1);
+ let sidebar_items = this.workspace_sidebar_items.slice(current_index + 1);
+ let next_section_break = sidebar_items.findIndex((f) => f.type == "Section Break");
+ let child_items;
+ if (next_section_break == -1) {
+ child_items = sidebar_items;
+ } else {
+ child_items = sidebar_items.slice(0, next_section_break);
+ }
if (child_items.length > 0) {
let child_container = $item_container.find(".sidebar-child-item");
child_container.addClass("hidden");
@@ -350,7 +365,6 @@ frappe.ui.Sidebar = class Sidebar {
path = item.route;
}
}
- console.log(item);
return $(
frappe.render_template("sidebar_item", {
item: item,