diff --git a/cypress/integration/control_link.js b/cypress/integration/control_link.js index 0ad891772e..b77fce3399 100644 --- a/cypress/integration/control_link.js +++ b/cypress/integration/control_link.js @@ -120,7 +120,7 @@ context("Control Link", () => { cy.get("@input").trigger("mouseover"); cy.get(".frappe-control[data-fieldname=link] .btn-open") .should("be.visible") - .should("have.attr", "href", `/app/todo/${todos[0]}`); + .should("have.attr", "href", `/desk/todo/${todos[0]}`); }); }); @@ -176,7 +176,7 @@ context("Control Link", () => { it("should update dependant fields (via fetch_from)", () => { cy.get("@todos").then((todos) => { - cy.visit(`/app/todo/${todos[0]}`); + cy.visit(`/desk/todo/${todos[0]}`); cy.intercept("POST", "/api/method/frappe.desk.search.search_link").as("search_link"); cy.intercept("/api/method/frappe.client.validate_link*").as("validate_link"); diff --git a/frappe/public/js/frappe/ui/sidebar/sidebar.js b/frappe/public/js/frappe/ui/sidebar/sidebar.js index de2dd78f3b..638e490e82 100644 --- a/frappe/public/js/frappe/ui/sidebar/sidebar.js +++ b/frappe/public/js/frappe/ui/sidebar/sidebar.js @@ -27,13 +27,18 @@ frappe.ui.Sidebar = class Sidebar { } prepare() { - this.sidebar_data = frappe.boot.workspace_sidebar_item[this.workspace_title.toLowerCase()]; - this.workspace_sidebar_items = this.sidebar_data.items; - if (this.edit_mode) { - this.workspace_sidebar_items = this.new_sidebar_items; + try { + this.sidebar_data = + frappe.boot.workspace_sidebar_item[this.workspace_title.toLowerCase()]; + this.workspace_sidebar_items = this.sidebar_data.items; + if (this.edit_mode) { + this.workspace_sidebar_items = this.new_sidebar_items; + } + this.choose_app_name(); + this.find_nested_items(); + } catch (e) { + console.log(e); } - this.choose_app_name(); - this.find_nested_items(); } choose_app_name() { @@ -350,7 +355,9 @@ frappe.ui.Sidebar = class Sidebar { workspace_title = this.get_correct_workspace_sidebars(route); } let module_name = workspace_title[0]; - frappe.app.sidebar.setup(module_name || this.workspace_title); + if (module_name) { + frappe.app.sidebar.setup(module_name || this.workspace_title); + } } get_correct_workspace_sidebars(link_to) { @@ -718,6 +725,7 @@ frappe.ui.Sidebar = class Sidebar { message: __("Saving Sidebar"), indicator: "success", }); + await frappe.call({ type: "POST", method: "frappe.desk.doctype.workspace_sidebar.workspace_sidebar.add_sidebar_items", diff --git a/frappe/public/js/frappe/ui/sidebar/sidebar_header.js b/frappe/public/js/frappe/ui/sidebar/sidebar_header.js index b715e78441..fb2f688794 100644 --- a/frappe/public/js/frappe/ui/sidebar/sidebar_header.js +++ b/frappe/public/js/frappe/ui/sidebar/sidebar_header.js @@ -62,7 +62,7 @@ frappe.ui.SidebarHeader = class SidebarHeader { this.$drop_icon = this.wrapper.find(".drop-icon"); } set_header_icon() { - this.header_icon = this.sidebar.sidebar_data.header_icon; + if (this.sidebar.sidebar_data) this.header_icon = this.sidebar.sidebar_data.header_icon; } setup_app_switcher() { this.dropdown_menu = $(".sidebar-header-menu");