From cc90847711a3bfdba1d3bab5529b478111431e29 Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Mon, 6 May 2024 16:06:30 +0200 Subject: [PATCH] #13353 Pause and resume if edit mode is checked in the View panel --- .../include/javascript/pandora_dashboards.js | 13 +++++++++++++ pandora_console/views/dashboard/layout.php | 3 +++ 2 files changed, 16 insertions(+) diff --git a/pandora_console/include/javascript/pandora_dashboards.js b/pandora_console/include/javascript/pandora_dashboards.js index b6e20aa4ba..9acd059543 100644 --- a/pandora_console/include/javascript/pandora_dashboards.js +++ b/pandora_console/include/javascript/pandora_dashboards.js @@ -1722,3 +1722,16 @@ function show_projection_period() { $("#div_projection_period").hide(); } } + +// Paused and resume if edit mode is checked. +// eslint-disable-next-line no-unused-vars +function paused_resume_dashboard_countdown() { + $("#checkbox-edit-mode").on("click", function() { + let isChecked = $("#checkbox-edit-mode").is(":checked"); + if (isChecked) { + $("#refrcounter").countdown("pause"); + } else { + $("#refrcounter").countdown("resume"); + } + }); +} diff --git a/pandora_console/views/dashboard/layout.php b/pandora_console/views/dashboard/layout.php index 4d1553dd7e..478d0f0f4e 100644 --- a/pandora_console/views/dashboard/layout.php +++ b/pandora_console/views/dashboard/layout.php @@ -94,5 +94,8 @@ echo $output; $("#button-add-widget-"+cellId).trigger("click"); }, 500); } + + // Paused and resume if edit mode is checked. + paused_resume_dashboard_countdown(); });