You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2026/08/20 17:37:44 UTC

(spark) branch branch-4.x updated: [SPARK-58914][CORE][UI] Add a reusable `confirm-link` for Web UI links

This is an automated email from the ASF dual-hosted git repository.

dongjoon-hyun pushed a commit to branch branch-4.x
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.x by this push:
     new 2ad4ae1c65bc [SPARK-58914][CORE][UI] Add a reusable `confirm-link` for Web UI links
2ad4ae1c65bc is described below

commit 2ad4ae1c65bc4e9bfd5d35f4bf371b664891b309
Author: Dongjoon Hyun <do...@apache.org>
AuthorDate: Thu Aug 20 10:37:20 2026 -0700

    [SPARK-58914][CORE][UI] Add a reusable `confirm-link` for Web UI links
    
    ### What changes were proposed in this pull request?
    
    This PR adds a reusable confirmation prompt for Web UI links:
    
    - `webui.css`: a new `a.confirm-link` style, following the existing `a.kill-link` style.
    - `webui.js`: a CSP-compliant delegated click handler for `a.confirm-link[data-confirm-message]`
      that shows `window.confirm()` with the message and cancels the navigation when declined.
    
    ### Why are the changes needed?
    
    The only existing confirmation pattern, `kill-link`, is tied to the kill-request form submission.
    `confirm-link` guards a plain link navigation instead, so any page can add a prompt without a
    page-specific inline script, which the Web UI no longer allows under CSP.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No. No page renders `confirm-link` yet, so the rendered UI is unchanged.
    
    ### How was this patch tested?
    
    Pass the CIs, including `dev/lint-js`.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Opus 5
    
    Closes #58172 from dongjoon-hyun/SPARK-58914.
    
    Authored-by: Dongjoon Hyun <do...@apache.org>
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
    (cherry picked from commit c9777328627387caa59dc64e7f9e998dfb18c8cb)
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
 core/src/main/resources/org/apache/spark/ui/static/webui.css | 5 +++++
 core/src/main/resources/org/apache/spark/ui/static/webui.js  | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/core/src/main/resources/org/apache/spark/ui/static/webui.css b/core/src/main/resources/org/apache/spark/ui/static/webui.css
index c407c8cb22bd..94b4ec0971e9 100755
--- a/core/src/main/resources/org/apache/spark/ui/static/webui.css
+++ b/core/src/main/resources/org/apache/spark/ui/static/webui.css
@@ -139,6 +139,11 @@ a.kill-link {
   color: var(--bs-secondary-color);
 }
 
+a.confirm-link {
+  margin-left: 4px;
+  color: var(--bs-secondary-color);
+}
+
 a.name-link {
   word-wrap: break-word;
 }
diff --git a/core/src/main/resources/org/apache/spark/ui/static/webui.js b/core/src/main/resources/org/apache/spark/ui/static/webui.js
index 436b987a1713..aab41a6a6717 100644
--- a/core/src/main/resources/org/apache/spark/ui/static/webui.js
+++ b/core/src/main/resources/org/apache/spark/ui/static/webui.js
@@ -131,6 +131,13 @@ $(function() {
     }
   });
 
+  // generic links guarded by a confirmation prompt before navigating
+  $(document).on("click", "a.confirm-link[data-confirm-message]", function(e) {
+    if (!window.confirm($(this).data("confirm-message"))) {
+      e.preventDefault();
+    }
+  });
+
   // loadMore / loadNew buttons
   $(document).on("click", ".log-more-btn", function() { loadMore(); });
   $(document).on("click", ".log-new-btn", function() { loadNew(); });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org