fix: dont render demo clear button if onboarding tour present
diff --git a/erpnext/public/js/utils/demo.js b/erpnext/public/js/utils/demo.js
index 05866e9..6cacd5d 100644
--- a/erpnext/public/js/utils/demo.js
+++ b/erpnext/public/js/utils/demo.js
@@ -1,15 +1,25 @@
$(document).on("toolbar_setup", function () {
if (frappe.boot.sysdefaults.demo_company) {
- erpnext.setup_clear_button();
+ render_clear_demo_button();
}
- // for first load
+ // for first load after setup.
frappe.realtime.on("demo_data_complete", () => {
- erpnext.setup_clear_button();
+ render_clear_demo_button();
});
});
-erpnext.setup_clear_button = function () {
+function render_clear_demo_button() {
+ let wait_for_onboaring_tours = setInterval(() => {
+ if ($("#driver-page-overlay").length) {
+ return;
+ }
+ setup_clear_demo_button();
+ clearInterval(wait_for_onboaring_tours);
+ }, 2000);
+}
+
+function setup_clear_demo_button() {
let message_string = __(
"Demo data is present on the system, erase data before starting real usage."
);
@@ -68,4 +78,4 @@
}
);
});
-};
+}