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

lauraxia pushed a commit to branch antdUI-gravitino-base1.1.0
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/antdUI-gravitino-base1.1.0 by 
this push:
     new 0d30fa8077 [#9609][#9607] fix new UI login issue and add apache header 
for script file
0d30fa8077 is described below

commit 0d30fa8077feb78fadf47a333bc7efd51f57ef74
Author: Qian Xia <[email protected]>
AuthorDate: Sun Jan 4 17:33:00 2026 +0800

    [#9609][#9607] fix new UI login issue and add apache header for script file
---
 web/web/scripts/select-build-target.js    | 20 +++++++++++++++++++-
 web/web/src/app/rootLayout/SiteHeader.js  | 20 ++++++++++++--------
 web/web/src/app/rootLayout/UserSetting.js |  6 ++++--
 3 files changed, 35 insertions(+), 11 deletions(-)

diff --git a/web/web/scripts/select-build-target.js 
b/web/web/scripts/select-build-target.js
index 0fc3cd3902..b0c9ad28bd 100644
--- a/web/web/scripts/select-build-target.js
+++ b/web/web/scripts/select-build-target.js
@@ -1,4 +1,22 @@
-#!/usr/bin/env node
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
 const fs = require('fs')
 const path = require('path')
 
diff --git a/web/web/src/app/rootLayout/SiteHeader.js 
b/web/web/src/app/rootLayout/SiteHeader.js
index d1dc212e44..eec6821a30 100644
--- a/web/web/src/app/rootLayout/SiteHeader.js
+++ b/web/web/src/app/rootLayout/SiteHeader.js
@@ -40,8 +40,10 @@ export function SiteHeader() {
   const store = useAppSelector(state => state.metalakes)
 
   useEffect(() => {
-    dispatch(fetchMetalakes())
-  }, [dispatch])
+    if (pathname && !['/', '/ui', '/login', '/ui/login'].includes(pathname)) {
+      dispatch(fetchMetalakes())
+    }
+  }, [dispatch, pathname])
 
   // Ensure URL has sensible defaults when missing:
   // - When not on `/metalakes` and `metalake` query is 
missing/empty/"undefined",
@@ -50,6 +52,10 @@ export function SiteHeader() {
   //   default to `relational`.
   useEffect(() => {
     try {
+      if (store.metalakes.length === 0) {
+        return
+      }
+
       const metalakeParam = searchParams.get('metalake')
       const catalogTypeParam = searchParams.get('catalogType')
 
@@ -63,9 +69,7 @@ export function SiteHeader() {
 
       // If we're not on the metalakes list page and metalake is missing, fill 
it
       if (!['/', '/ui', '/metalakes', '/ui/metalakes'].includes(pathname) && 
!metalakeParam) {
-        const first =
-          (store.metalakes && store.metalakes.length > 0 && 
store.metalakes[0].name) ||
-          (metalakes.length > 0 ? metalakes[0] : '')
+        const first = store.metalakes[0].name || ''
         if (first) {
           const qs = makeNewSearch({ metalake: first })
           router.replace(`${pathname}${qs ? `?${qs}` : ''}`)
@@ -100,7 +104,7 @@ export function SiteHeader() {
       className={cn(
         'sticky top-0 z-40 w-full border-b 
border-b-[color:theme(colors.borderWhite)] bg-slate-800 text-white',
         {
-          hidden: pathname === '/login'
+          hidden: pathname === '/login' || pathname === '/ui/login'
         }
       )}
     >
@@ -111,8 +115,8 @@ export function SiteHeader() {
             <GitHubInfo />
             <div
               className={cn('cursor-pointer rounded p-1.5 hover:bg-slate-700', 
{
-                'bg-gray-100 shadow-inner': pathname === '/metalakes',
-                'bg-slate-700': pathname === '/metalakes'
+                'bg-gray-100 shadow-inner': pathname === '/metalakes' || 
pathname === '/ui/metalakes',
+                'bg-slate-700': pathname === '/metalakes' || pathname === 
'/ui/metalakes'
               })}
             >
               <Tooltip title='System Mode'>
diff --git a/web/web/src/app/rootLayout/UserSetting.js 
b/web/web/src/app/rootLayout/UserSetting.js
index 85d835dffc..05b42a9e77 100644
--- a/web/web/src/app/rootLayout/UserSetting.js
+++ b/web/web/src/app/rootLayout/UserSetting.js
@@ -49,8 +49,10 @@ export default function UserSetting() {
   const store = useAppSelector(state => state.metalakes)
 
   useEffect(() => {
-    dispatch(fetchMetalakes())
-  }, [dispatch])
+    if (pathname && !['/', '/ui', '/login', '/ui/login'].includes(pathname)) {
+      dispatch(fetchMetalakes())
+    }
+  }, [dispatch, pathname])
 
   useEffect(() => {
     const checkAuthStatus = async () => {

Reply via email to