Merge pull request #37098 from sokumon/route-correctly

fix: route correctly from desktop
This commit is contained in:
Soham Kulkarni 2026-02-17 02:52:47 +05:30 committed by GitHub
commit 9dcffad232
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 9 deletions

View file

@ -68,15 +68,15 @@ function get_route(desktop_icon) {
} else if (first_link.link_type == "Workspace") { } else if (first_link.link_type == "Workspace") {
let workspaces = frappe.workspaces[frappe.router.slug(first_link.link_to)]; let workspaces = frappe.workspaces[frappe.router.slug(first_link.link_to)];
if (workspaces) { if (workspaces) {
if (workspaces.public) { let args = {
route = "/desk/" + frappe.router.slug(first_link.link_to); type: "workspace",
} else { name: first_link.link_to,
route = "/desk/private/" + frappe.router.slug(workspaces.title); public: workspaces.public ? 1 : 0,
} route_options: {
} sidebar: desktop_icon.label,
},
if (first_link.route) { };
route = first_link.route; route = frappe.utils.generate_route(args);
} }
} else if (first_link.link_type === "URL") { } else if (first_link.link_type === "URL") {
route = first_link.url; route = first_link.url;

View file

@ -135,6 +135,7 @@ frappe.ui.Sidebar = class Sidebar {
frappe.router.on("change", function (router) { frappe.router.on("change", function (router) {
if (frappe.route_options.sidebar) { if (frappe.route_options.sidebar) {
frappe.app.sidebar.setup(frappe.route_options.sidebar); frappe.app.sidebar.setup(frappe.route_options.sidebar);
frappe.route_options = null;
} else { } else {
frappe.app.sidebar.set_workspace_sidebar(router); frappe.app.sidebar.set_workspace_sidebar(router);
} }

View file

@ -1583,6 +1583,12 @@ Object.assign(frappe.utils, {
route = item.name; route = item.name;
} else if (type === "dashboard") { } else if (type === "dashboard") {
route = `dashboard-view/${item.name}`; route = `dashboard-view/${item.name}`;
} else if (type == "workspace") {
if (item.public) {
route = frappe.router.slug(item.name);
} else {
route = "private/" + frappe.router.slug(item.name);
}
} }
} else { } else {
route = item.route; route = item.route;