From 2415dcf1cc37b2f20dc7ca36911d29ccab01670a Mon Sep 17 00:00:00 2001 From: Joshua Rodriguez Date: Tue, 7 Jan 2025 14:41:37 -0800 Subject: [PATCH] Fixes broken deplyoments -> progress bar click handler --- install/cws-ui/deployments.ftl | 77 +++++++++++++--------------------- 1 file changed, 28 insertions(+), 49 deletions(-) diff --git a/install/cws-ui/deployments.ftl b/install/cws-ui/deployments.ftl index cc5d861a..96ec21c3 100644 --- a/install/cws-ui/deployments.ftl +++ b/install/cws-ui/deployments.ftl @@ -737,61 +737,40 @@ idleTimer = setInterval(idleMode, idleInterval); }); - $(".bar-error").on("click", function () { - id = $(this).parent().attr("data-pdk"); - if (id) { - window.location = "/${base}/processes?procDefKey=" + id + "&status=fail&cache=false"; - } else { - window.location = "/${base}/processes?status=fail&cache=false"; - } + // Handle clicks on status bars using event delegation + $(document).on("click", ".bar-error", function() { + var id = $(this).closest(".progress").attr("data-pdk"); + window.location = "/${base}/processes?procDefKey=" + (id || "") + "&status=fail&cache=false"; }); - $(".bar-completed").on("click", function () { - id = $(this).parent().attr("data-pdk"); - if (id) { - window.location = "/${base}/processes?procDefKey=" + id + "&status=complete,resolved&cache=false"; - } else { - window.location = "/${base}/processes?status=complete,resolved&cache=false"; - } + + $(document).on("click", ".bar-completed", function() { + var id = $(this).closest(".progress").attr("data-pdk"); + window.location = "/${base}/processes?procDefKey=" + (id || "") + "&status=complete,resolved&cache=false"; }); - $(".bar-pending").on("click", function () { - id = $(this).parent().attr("data-pdk"); - if (id) { - window.location = "/${base}/processes?procDefKey=" + id + "&status=pending&cache=false"; - } else { - window.location = "/${base}/processes?status=pending&cache=false"; - } + + $(document).on("click", ".bar-pending", function() { + var id = $(this).closest(".progress").attr("data-pdk"); + window.location = "/${base}/processes?procDefKey=" + (id || "") + "&status=pending&cache=false"; }); - $(".bar-disabled").on("click", function () { - id = $(this).parent().attr("data-pdk"); - if (id) { - window.location = "/${base}/processes?procDefKey=" + id + "&status=disabled&cache=false"; - } else { - window.location = "/${base}/processes?status=disabled&cache=false"; - } + + $(document).on("click", ".bar-disabled", function() { + var id = $(this).closest(".progress").attr("data-pdk"); + window.location = "/${base}/processes?procDefKey=" + (id || "") + "&status=disabled&cache=false"; }); - $(".bar-active").on("click", function () { - id = $(this).parent().attr("data-pdk"); - if (id) { - window.location = "/${base}/processes?procDefKey=" + id + "&status=running&cache=false"; - } else { - window.location = "/${base}/processes?status=running&cache=false"; - } + + $(document).on("click", ".bar-active", function() { + var id = $(this).closest(".progress").attr("data-pdk"); + window.location = "/${base}/processes?procDefKey=" + (id || "") + "&status=running&cache=false"; }); - $(".bar-failedToStart").on("click", function () { - id = $(this).parent().attr("data-pdk"); - if (id) { - window.location = "/${base}/processes?procDefKey=" + id + "&status=failedToStart&cache=false"; - } else { - window.location = "/${base}/processes?status=failedToStart&cache=false"; - } + + $(document).on("click", ".bar-failedToStart", function() { + var id = $(this).closest(".progress").attr("data-pdk"); + window.location = "/${base}/processes?procDefKey=" + (id || "") + "&status=failedToStart&cache=false"; }); - $(".bar-incident").on("click", function () { - id = $(this).parent().attr("data-pdk"); - if (id) { - window.location = "/${base}/processes?procDefKey=" + id + "&status=incident&cache=false"; - } else { - window.location = "/${base}/processes?status=incident&cache=false"; - } + + $(document).on("click", ".bar-incident", function() { + var id = $(this).closest(".progress").attr("data-pdk"); + window.location = "/${base}/processes?procDefKey=" + (id || "") + "&status=incident&cache=false"; }); adjustWorkersButton();