You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by rz...@apache.org on 2026/04/14 09:12:51 UTC

(storm) branch master updated: Fix Storm UI bundle cache-busting (#8518)

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

rzo1 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git


The following commit(s) were added to refs/heads/master by this push:
     new fd8db6127 Fix Storm UI bundle cache-busting (#8518)
fd8db6127 is described below

commit fd8db6127c0c374b6bbac8649abd9fcccb8f5853
Author: Richard Zowalla <rz...@apache.org>
AuthorDate: Tue Apr 14 11:12:41 2026 +0200

    Fix Storm UI bundle cache-busting (#8518)
    
      The ${packageTimestamp} token in WEB-INF/*.html was never substituted — no Maven resource filtering was configured for these files — so every deploy served `main.bundle.js?_ts=${packageTimestamp}` as a literal constant URL. Browsers held onto stale bundles across releases, and  after the Bootstrap 5.3.8 / dark-mode rewrite (which touched both main.bundle.js and topology-page-template.html) cached clients hit "Invalid template! ... undefined" on the topology detail page because the c [...]
---
 storm-webapp/cypress/test-server.js                |  6 ++--
 storm-webapp/pom.xml                               | 34 ++++++++++++++++++++++
 .../apache/storm/daemon/ui/WEB-INF/component.html  |  4 +--
 .../daemon/ui/WEB-INF/deep_search_result.html      |  4 +--
 .../org/apache/storm/daemon/ui/WEB-INF/flux.html   |  4 +--
 .../org/apache/storm/daemon/ui/WEB-INF/index.html  |  4 +--
 .../storm/daemon/ui/WEB-INF/logviewer_search.html  |  4 +--
 .../org/apache/storm/daemon/ui/WEB-INF/owner.html  |  4 +--
 .../storm/daemon/ui/WEB-INF/search_result.html     |  4 +--
 .../apache/storm/daemon/ui/WEB-INF/supervisor.html |  4 +--
 .../apache/storm/daemon/ui/WEB-INF/topology.html   |  8 ++---
 .../apache/storm/daemon/ui/WEB-INF/visualize.html  |  4 +--
 12 files changed, 60 insertions(+), 24 deletions(-)

diff --git a/storm-webapp/cypress/test-server.js b/storm-webapp/cypress/test-server.js
index 081e13648..9039b96ad 100644
--- a/storm-webapp/cypress/test-server.js
+++ b/storm-webapp/cypress/test-server.js
@@ -110,10 +110,12 @@ app.post('/api/v1/topology/:id/:action', (_req, res) => {
 });
 
 // --- Serve HTML pages ---
-// The HTML files use ${packageTimestamp} which we replace on the fly
+// The HTML files use @packageTimestamp@ which we replace on the fly
+// (Maven's resource filter substitutes it at build time with the same
+// delimiter — see storm-webapp/pom.xml).
 function serveHtml(filePath, res) {
   let html = fs.readFileSync(filePath, 'utf8');
-  html = html.replace(/\$\{packageTimestamp\}/g, 'test');
+  html = html.replace(/@packageTimestamp@/g, 'test');
   res.type('html').send(html);
 }
 
diff --git a/storm-webapp/pom.xml b/storm-webapp/pom.xml
index fab3ca380..0d9859a58 100644
--- a/storm-webapp/pom.xml
+++ b/storm-webapp/pom.xml
@@ -30,6 +30,15 @@
     <name>Storm Webapp</name>
     <description>Webapp Servers for Apache Storm</description>
 
+    <properties>
+        <!-- Substituted into WEB-INF/*.html as @packageTimestamp@ by
+             maven-resources-plugin for bundle cache-busting. Also passed to
+             webpack (see frontend-maven-plugin configuration below) so the
+             PACKAGE_TIMESTAMP baked into the JS bundle matches the token
+             served in the HTML pages. -->
+        <packageTimestamp>${maven.build.timestamp}</packageTimestamp>
+    </properties>
+
     <dependencies>
         <!-- storm-webapp is based on storm-core -->
         <dependency>
@@ -145,6 +154,18 @@
                 <includes>
                     <include>WEB-INF/**/*.*</include>
                 </includes>
+                <excludes>
+                    <!-- Top-level HTML pages contain @packageTimestamp@ for bundle
+                         cache-busting and are filtered below. -->
+                    <exclude>WEB-INF/*.html</exclude>
+                </excludes>
+            </resource>
+            <resource>
+                <directory>${basedir}/src/main/java/org/apache/storm/daemon/ui</directory>
+                <filtering>true</filtering>
+                <includes>
+                    <include>WEB-INF/*.html</include>
+                </includes>
             </resource>
             <resource>
                 <directory>${basedir}/target/generated-resources</directory>
@@ -197,6 +218,19 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <!-- Use @...@ delimiters only so JS/HTML ${...} (template
+                     literals, shell-style expressions, etc.) in filtered
+                     WEB-INF/*.html files are left untouched. -->
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-resources-plugin</artifactId>
+                <configuration>
+                    <useDefaultDelimiters>false</useDefaultDelimiters>
+                    <delimiters>
+                        <delimiter>@</delimiter>
+                    </delimiters>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-report-plugin</artifactId>
diff --git a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/component.html b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/component.html
index 8ce87f260..1a3b95ddb 100644
--- a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/component.html
+++ b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/component.html
@@ -20,8 +20,8 @@
 <script>!function(){var m=document.cookie.match(/(?:^|;\s*)stormTheme=([^;]*)/);var t=m?decodeURIComponent(m[1]):null;if(!t)t=window.matchMedia&&window.matchMedia("(prefers-color-scheme:dark)").matches?"dark":"light";document.documentElement.setAttribute("data-bs-theme",t)}()</script>
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title>Storm UI</title>
-<link href="/dist/main.bundle.css?_ts=${packageTimestamp}" rel="stylesheet" type="text/css">
-<script src="/dist/main.bundle.js?_ts=${packageTimestamp}" type="text/javascript"></script>
+<link href="/dist/main.bundle.css?_ts=@packageTimestamp@" rel="stylesheet" type="text/css">
+<script src="/dist/main.bundle.js?_ts=@packageTimestamp@" type="text/javascript"></script>
 </head>
 <body>
 <div class="container-fluid">
diff --git a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/deep_search_result.html b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/deep_search_result.html
index be117fc78..fbc50ebd5 100644
--- a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/deep_search_result.html
+++ b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/deep_search_result.html
@@ -19,8 +19,8 @@
 <script>!function(){var m=document.cookie.match(/(?:^|;\s*)stormTheme=([^;]*)/);var t=m?decodeURIComponent(m[1]):null;if(!t)t=window.matchMedia&&window.matchMedia("(prefers-color-scheme:dark)").matches?"dark":"light";document.documentElement.setAttribute("data-bs-theme",t)}()</script>
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title>Storm UI</title>
-<link href="/dist/main.bundle.css?_ts=${packageTimestamp}" rel="stylesheet" type="text/css">
-<script src="/dist/main.bundle.js?_ts=${packageTimestamp}" type="text/javascript"></script>
+<link href="/dist/main.bundle.css?_ts=@packageTimestamp@" rel="stylesheet" type="text/css">
+<script src="/dist/main.bundle.js?_ts=@packageTimestamp@" type="text/javascript"></script>
 </head>
 <body>
 <div class="container-fluid">
diff --git a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/flux.html b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/flux.html
index 05417add0..ad676c17a 100644
--- a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/flux.html
+++ b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/flux.html
@@ -39,8 +39,8 @@
         border: 1px solid var(--bs-border-color);
       }
     </style>
-    <link href="/dist/flux.bundle.css?_ts=${packageTimestamp}" rel="stylesheet" type="text/css">
-    <script src="/dist/flux.bundle.js?_ts=${packageTimestamp}"></script>
+    <link href="/dist/flux.bundle.css?_ts=@packageTimestamp@" rel="stylesheet" type="text/css">
+    <script src="/dist/flux.bundle.js?_ts=@packageTimestamp@"></script>
     <script type="text/javascript">
       function toCytoscapeGraph(doc) {
         var nodes = [];
diff --git a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/index.html b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/index.html
index 2afc415e0..0b5d493e1 100644
--- a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/index.html
+++ b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/index.html
@@ -20,8 +20,8 @@
 <script>!function(){var m=document.cookie.match(/(?:^|;\s*)stormTheme=([^;]*)/);var t=m?decodeURIComponent(m[1]):null;if(!t)t=window.matchMedia&&window.matchMedia("(prefers-color-scheme:dark)").matches?"dark":"light";document.documentElement.setAttribute("data-bs-theme",t)}()</script>
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title>Storm UI</title>
-<link href="/dist/main.bundle.css?_ts=${packageTimestamp}" rel="stylesheet" type="text/css">
-<script src="/dist/main.bundle.js?_ts=${packageTimestamp}" type="text/javascript"></script>
+<link href="/dist/main.bundle.css?_ts=@packageTimestamp@" rel="stylesheet" type="text/css">
+<script src="/dist/main.bundle.js?_ts=@packageTimestamp@" type="text/javascript"></script>
 </head>
 <body>
 <div class="container-fluid">
diff --git a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/logviewer_search.html b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/logviewer_search.html
index 9fcb979e6..7d12b1d44 100644
--- a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/logviewer_search.html
+++ b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/logviewer_search.html
@@ -19,8 +19,8 @@
 <script>!function(){var m=document.cookie.match(/(?:^|;\s*)stormTheme=([^;]*)/);var t=m?decodeURIComponent(m[1]):null;if(!t)t=window.matchMedia&&window.matchMedia("(prefers-color-scheme:dark)").matches?"dark":"light";document.documentElement.setAttribute("data-bs-theme",t)}()</script>
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title>Storm UI</title>
-<link href="/dist/main.bundle.css?_ts=${packageTimestamp}" rel="stylesheet" type="text/css">
-<script src="/dist/main.bundle.js?_ts=${packageTimestamp}" type="text/javascript"></script>
+<link href="/dist/main.bundle.css?_ts=@packageTimestamp@" rel="stylesheet" type="text/css">
+<script src="/dist/main.bundle.js?_ts=@packageTimestamp@" type="text/javascript"></script>
 </head>
 <body>
 <div class="container-fluid">
diff --git a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/owner.html b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/owner.html
index da7d0663c..f0ab1fcb3 100644
--- a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/owner.html
+++ b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/owner.html
@@ -21,8 +21,8 @@
     <script>!function(){var m=document.cookie.match(/(?:^|;\s*)stormTheme=([^;]*)/);var t=m?decodeURIComponent(m[1]):null;if(!t)t=window.matchMedia&&window.matchMedia("(prefers-color-scheme:dark)").matches?"dark":"light";document.documentElement.setAttribute("data-bs-theme",t)}()</script>
     <meta name="viewport" content="width=device-width, initial-scale=1">
     <title>Storm UI</title>
-    <link href="/dist/main.bundle.css?_ts=${packageTimestamp}" rel="stylesheet" type="text/css">
-    <script src="/dist/main.bundle.js?_ts=${packageTimestamp}" type="text/javascript"></script>
+    <link href="/dist/main.bundle.css?_ts=@packageTimestamp@" rel="stylesheet" type="text/css">
+    <script src="/dist/main.bundle.js?_ts=@packageTimestamp@" type="text/javascript"></script>
 </head>
 
 <body>
diff --git a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/search_result.html b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/search_result.html
index 096134ce2..b4545d587 100644
--- a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/search_result.html
+++ b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/search_result.html
@@ -19,8 +19,8 @@
 <script>!function(){var m=document.cookie.match(/(?:^|;\s*)stormTheme=([^;]*)/);var t=m?decodeURIComponent(m[1]):null;if(!t)t=window.matchMedia&&window.matchMedia("(prefers-color-scheme:dark)").matches?"dark":"light";document.documentElement.setAttribute("data-bs-theme",t)}()</script>
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title>Storm UI</title>
-<link href="/dist/main.bundle.css?_ts=${packageTimestamp}" rel="stylesheet" type="text/css">
-<script src="/dist/main.bundle.js?_ts=${packageTimestamp}" type="text/javascript"></script>
+<link href="/dist/main.bundle.css?_ts=@packageTimestamp@" rel="stylesheet" type="text/css">
+<script src="/dist/main.bundle.js?_ts=@packageTimestamp@" type="text/javascript"></script>
 </head>
 <body>
 <div class="container-fluid">
diff --git a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/supervisor.html b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/supervisor.html
index 022cd748e..5122386ee 100644
--- a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/supervisor.html
+++ b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/supervisor.html
@@ -21,8 +21,8 @@
 <script>!function(){var m=document.cookie.match(/(?:^|;\s*)stormTheme=([^;]*)/);var t=m?decodeURIComponent(m[1]):null;if(!t)t=window.matchMedia&&window.matchMedia("(prefers-color-scheme:dark)").matches?"dark":"light";document.documentElement.setAttribute("data-bs-theme",t)}()</script>
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title>Storm UI</title>
-<link href="/dist/main.bundle.css?_ts=${packageTimestamp}" rel="stylesheet" type="text/css">
-<script src="/dist/main.bundle.js?_ts=${packageTimestamp}" type="text/javascript"></script>
+<link href="/dist/main.bundle.css?_ts=@packageTimestamp@" rel="stylesheet" type="text/css">
+<script src="/dist/main.bundle.js?_ts=@packageTimestamp@" type="text/javascript"></script>
 </head>
 <body>
 <div class="supervisor-page container-fluid">
diff --git a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/topology.html b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/topology.html
index 082007830..3dfb2c32a 100644
--- a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/topology.html
+++ b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/topology.html
@@ -21,8 +21,8 @@
 <script>!function(){var m=document.cookie.match(/(?:^|;\s*)stormTheme=([^;]*)/);var t=m?decodeURIComponent(m[1]):null;if(!t)t=window.matchMedia&&window.matchMedia("(prefers-color-scheme:dark)").matches?"dark":"light";document.documentElement.setAttribute("data-bs-theme",t)}()</script>
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <title>Storm UI</title>
-<link href="/dist/main.bundle.css?_ts=${packageTimestamp}" rel="stylesheet" type="text/css">
-<script src="/dist/main.bundle.js?_ts=${packageTimestamp}" type="text/javascript"></script>
+<link href="/dist/main.bundle.css?_ts=@packageTimestamp@" rel="stylesheet" type="text/css">
+<script src="/dist/main.bundle.js?_ts=@packageTimestamp@" type="text/javascript"></script>
 </head>
 <body>
 <div class="container-fluid">
@@ -299,7 +299,7 @@ $(document).ready(function() {
         var formattedConfig = formatConfigData(response["configuration"]);
         var buttonJsonData = topologyActionJson(response["id"],response["encodedId"],response["name"],response["status"]
                                                 ,response["msgTimeout"],response["configuration"]["topology.eventlogger.executors"],response["debug"],response["samplingPct"]);
-        $.ajax ({url: "/templates/topology-page-template.html", success: function(template) {
+        getStatic("/templates/topology-page-template.html", function(template) {
             toggleChangeLogLevel = function (data) {
               renderLogLevelForm (template, data);
             }
@@ -488,7 +488,7 @@ $(document).ready(function() {
                 }
             });
           });
-      }});
+      });
     });
  });
 
diff --git a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/visualize.html b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/visualize.html
index 4bcc66c98..0ba4d522e 100644
--- a/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/visualize.html
+++ b/storm-webapp/src/main/java/org/apache/storm/daemon/ui/WEB-INF/visualize.html
@@ -20,8 +20,8 @@
     <script>!function(){var m=document.cookie.match(/(?:^|;\s*)stormTheme=([^;]*)/);var t=m?decodeURIComponent(m[1]):null;if(!t)t=window.matchMedia&&window.matchMedia("(prefers-color-scheme:dark)").matches?"dark":"light";document.documentElement.setAttribute("data-bs-theme",t)}()</script>
     <meta name="viewport" content="width=device-width, initial-scale=1">
     <title>Topology Visualization</title>
-    <link href="/dist/visualize.bundle.css?_ts=${packageTimestamp}" rel="stylesheet" type="text/css">
-    <script src="/dist/visualize.bundle.js?_ts=${packageTimestamp}" type="text/javascript"></script>
+    <link href="/dist/visualize.bundle.css?_ts=@packageTimestamp@" rel="stylesheet" type="text/css">
+    <script src="/dist/visualize.bundle.js?_ts=@packageTimestamp@" type="text/javascript"></script>
 </head>
 <body>
 <div id="visualization">