From 9511fcc0026704bb589ffc1ce343cf3a7871a0d3 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Fri, 9 Oct 2020 12:35:29 +0530 Subject: [PATCH 1/2] fix: freeze DOM on call --- frappe/public/js/frappe/views/desktop/desktop.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frappe/public/js/frappe/views/desktop/desktop.js b/frappe/public/js/frappe/views/desktop/desktop.js index 0974a6c9f5..790eac0828 100644 --- a/frappe/public/js/frappe/views/desktop/desktop.js +++ b/frappe/public/js/frappe/views/desktop/desktop.js @@ -282,6 +282,7 @@ class DesktopPage { } save_customization() { + frappe.dom.freeze(); const config = {}; if (this.sections.charts) config.charts = this.sections.charts.get_widget_config(); @@ -292,14 +293,15 @@ class DesktopPage { page: this.page_name, config: config }).then(res => { + frappe.dom.unfreeze(); if (res.message) { - frappe.msgprint({ message: __("Customizations Saved Successfully"), title: __("Success")}); + frappe.msgprint({ message: __("Customizations Saved Successfully"), title: __("Success") }); this.reload(); } else { - frappe.throw({message: __("Something went wrong while saving customizations"), title: __("Failed")}); + frappe.throw({ message: __("Something went wrong while saving customizations"), title: __("Failed") }); this.reload(); } - }); + }) } make_onboarding() { From 7edf72b9b09ee789a7aa8dd1d124664859049fc5 Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Fri, 9 Oct 2020 12:35:38 +0530 Subject: [PATCH 2/2] chore: formatting fixes --- frappe/public/js/frappe/views/desktop/desktop.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frappe/public/js/frappe/views/desktop/desktop.js b/frappe/public/js/frappe/views/desktop/desktop.js index 790eac0828..e967e14dfc 100644 --- a/frappe/public/js/frappe/views/desktop/desktop.js +++ b/frappe/public/js/frappe/views/desktop/desktop.js @@ -70,9 +70,9 @@ export default class Desktop { } make_sidebar() { - const get_sidebar_item = function(item) { + const get_sidebar_item = function (item) { return $(` @@ -87,7 +87,7 @@ export default class Desktop { } let $item = get_sidebar_item(item); let $mobile_item = $item.clone(); - + $item.appendTo(this.sidebar); this.sidebar_items[item.name] = $item; @@ -128,7 +128,7 @@ export default class Desktop { if (this.sidebar_items && this.sidebar_items[this.current_page]) { this.sidebar_items[this.current_page].removeClass("selected"); this.mobile_sidebar_items[this.current_page].removeClass("selected"); - + this.sidebar_items[page].addClass("selected"); this.mobile_sidebar_items[page].addClass("selected"); } @@ -326,7 +326,7 @@ class DesktopPage { make_charts() { return frappe.dashboard_utils.get_dashboard_settings().then(settings => { - let chart_config = settings.chart_config ? JSON.parse(settings.chart_config): {}; + let chart_config = settings.chart_config ? JSON.parse(settings.chart_config) : {}; if (this.data.charts.items) { this.data.charts.items.map(chart => { chart.chart_settings = chart_config[chart.chart_name] || {};