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

JiaLiangC pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 116be946fb AMBARI-26658: Ambari Web is reachable before a cluster is 
created, showing an empty UI instead of the install wizard (#4220)
116be946fb is described below

commit 116be946fb5f911236db70861631eb4ed95792cc
Author: Sandeep  Kumar <[email protected]>
AuthorDate: Mon Sep 14 07:58:13 2026 +0530

    AMBARI-26658: Ambari Web is reachable before a cluster is created, showing 
an empty UI instead of the install wizard (#4220)
---
 ambari-web/latest/src/Utils/authPolicy.test.ts | 49 ++++++++++++++++++++++++++
 ambari-web/latest/src/Utils/authPolicy.ts      | 13 +++++--
 2 files changed, 59 insertions(+), 3 deletions(-)

diff --git a/ambari-web/latest/src/Utils/authPolicy.test.ts 
b/ambari-web/latest/src/Utils/authPolicy.test.ts
index fcd0ccbec9..4f148be017 100644
--- a/ambari-web/latest/src/Utils/authPolicy.test.ts
+++ b/ambari-web/latest/src/Utils/authPolicy.test.ts
@@ -89,6 +89,21 @@ describe("application landing policy", () => {
       clusterName: "c1",
       pathname: "/installer/step3",
     }, "/main/view"],
+    // Mid-install the wizard must be left alone. The cluster is only created 
near the
+    // end of the wizard, so an authorized user sits in /installer with no 
cluster at
+    // all for most of it - that must not be redirected anywhere.
+    [{
+      canAddDeleteClusters: true,
+      clusterInstalled: false,
+      clusterName: undefined,
+      pathname: "/installer/step3",
+    }, null],
+    [{
+      canAddDeleteClusters: true,
+      clusterInstalled: false,
+      clusterName: "c1",
+      pathname: "/installer/step3",
+    }, null],
     [{
       canAddDeleteClusters: true,
       clusterInstalled: false,
@@ -113,6 +128,40 @@ describe("application landing policy", () => {
       clusterName: "c1",
       pathname: "/main/views/TEZ/1.0/INSTANCE",
     }, null],
+    // No cluster created yet: the main UI has nothing to show, so the user 
must be
+    // sent back to the landing decision rather than left sitting in it.
+    [{
+      canAddDeleteClusters: true,
+      clusterInstalled: false,
+      clusterName: undefined,
+      pathname: "/main/dashboard/metrics",
+    }, "/"],
+    [{
+      canAddDeleteClusters: true,
+      clusterInstalled: false,
+      clusterName: "",
+      pathname: "/main/dashboard/metrics",
+    }, "/"],
+    [{
+      canAddDeleteClusters: false,
+      clusterInstalled: false,
+      clusterName: undefined,
+      pathname: "/main/dashboard/metrics",
+    }, "/main/view"],
+    // Views stay reachable with no cluster, so the redirect cannot ping-pong.
+    [{
+      canAddDeleteClusters: true,
+      clusterInstalled: false,
+      clusterName: undefined,
+      pathname: "/main/view",
+    }, null],
+    // Still nothing to do while the cluster state is unknown.
+    [{
+      canAddDeleteClusters: true,
+      clusterInstalled: undefined,
+      clusterName: undefined,
+      pathname: "/main/dashboard/metrics",
+    }, null],
   ])("applies the incomplete-cluster Views/Installer policy", (input, 
expected) => {
     expect(clusterProvisioningRedirect(input)).toBe(expected);
   });
diff --git a/ambari-web/latest/src/Utils/authPolicy.ts 
b/ambari-web/latest/src/Utils/authPolicy.ts
index f61ca5f0ad..b4bbdfe468 100644
--- a/ambari-web/latest/src/Utils/authPolicy.ts
+++ b/ambari-web/latest/src/Utils/authPolicy.ts
@@ -53,12 +53,19 @@ export function clusterProvisioningRedirect({
     }
   }
   if (
-    clusterName
-    && clusterInstalled === false
+    clusterInstalled === false
     && pathname.startsWith("/main")
     && !pathname.startsWith("/main/view")
   ) {
-    return canAddDeleteClusters ? "/installer/step0" : "/main/view";
+    if (!canAddDeleteClusters) {
+      return "/main/view";
+    }
+    // A cluster that exists but is not INSTALLED has an installer session to 
resume.
+    // With no cluster at all there is nothing to resume, so defer to the 
landing
+    // decision, which sends the user to the admin view to create one. 
Previously this
+    // whole branch required a cluster name, so a user with no cluster could 
sit in the
+    // main UI with nothing to show.
+    return clusterName ? "/installer/step0" : "/";
   }
   return null;
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to