diff --git a/frappe/public/js/frappe/ui/toolbar/awesome_bar.js b/frappe/public/js/frappe/ui/toolbar/awesome_bar.js index 0caad8e303..c5850990f7 100644 --- a/frappe/public/js/frappe/ui/toolbar/awesome_bar.js +++ b/frappe/public/js/frappe/ui/toolbar/awesome_bar.js @@ -107,6 +107,10 @@ frappe.search.AwesomeBar = class AwesomeBar { ) ); } + if (d.type == "Desktop Icon") { + target = frappe.utils.get_route_for_icon(d.icon_data); + d.route = target; + } let html = `${__(d.label || d.value)}`; if (d.description && d.value !== d.description) { @@ -189,7 +193,7 @@ frappe.search.AwesomeBar = class AwesomeBar { if (event.ctrlKey || event.metaKey) { frappe.open_in_new_tab = true; } - if (item.route[0].startsWith("https://")) { + if (item.route && item.route[0].startsWith("https://")) { window.open(item.route[0], "_blank"); return; } @@ -278,7 +282,7 @@ frappe.search.AwesomeBar = class AwesomeBar { frappe.search.utils.get_doctypes(txt), frappe.search.utils.get_reports(txt), frappe.search.utils.get_pages(txt), - frappe.search.utils.get_workspaces(txt), + frappe.search.utils.get_desktop_icons(txt), frappe.search.utils.get_dashboards(txt), frappe.search.utils.get_recent_pages(txt || ""), frappe.search.utils.get_executables(txt), diff --git a/frappe/public/js/frappe/ui/toolbar/search_utils.js b/frappe/public/js/frappe/ui/toolbar/search_utils.js index fbd99f1663..2de07432a2 100644 --- a/frappe/public/js/frappe/ui/toolbar/search_utils.js +++ b/frappe/public/js/frappe/ui/toolbar/search_utils.js @@ -328,19 +328,19 @@ frappe.search.utils = { return out; }, - get_workspaces: function (keywords) { + get_desktop_icons: function (keywords) { var me = this; var out = []; - frappe.boot.allowed_workspaces.forEach(function (item) { - const search_result = me.fuzzy_search(keywords, item.name, true); + frappe.boot.desktop_icons.forEach(function (item) { + const search_result = me.fuzzy_search(keywords, item.label, true); var level = search_result.score; if (level > 0) { var ret = { - type: "Workspace", - label: __("Open {0}", [search_result.marked_string || __(item.name)]), - value: __("Open {0}", [__(item.name)]), + type: "Desktop Icon", + label: __("Open {0}", [search_result.marked_string || __(item.label)]), + value: __("Open {0}", [__(item.label)]), index: level, - route: [frappe.router.slug(item.name)], + icon_data: item, }; out.push(ret); @@ -568,7 +568,7 @@ frappe.search.utils = { results: sort_uniques(this.get_pages(keywords)), }, { - title: __("Workspace"), + title: __("Desktop Icon"), fetch_type: "Nav", results: sort_uniques(this.get_workspaces(keywords)), },