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

fanng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new 132c07d93a [#8150] fix(web): support warehouse config for iceberberg 
catalog which catalog-backend is rest (#8172)
132c07d93a is described below

commit 132c07d93a84f69bdbf11e46f5cd9d32f015f976
Author: Qian Xia <[email protected]>
AuthorDate: Fri Aug 22 09:16:47 2025 +0800

    [#8150] fix(web): support warehouse config for iceberberg catalog which 
catalog-backend is rest (#8172)
    
    ### What changes were proposed in this pull request?
    RT
    <img width="611" height="889" alt="image"
    
src="https://github.com/user-attachments/assets/9e222920-8331-43d4-af1b-b22c95024078";
    />
    <img width="620" height="916" alt="image"
    
src="https://github.com/user-attachments/assets/1567cf39-0e8d-44b8-8b73-7063f0aad7a4";
    />
    <img width="664" height="859" alt="image"
    
src="https://github.com/user-attachments/assets/8c1c038c-f2bc-4912-bdad-0230043add12";
    />
    
    
    ### Why are the changes needed?
    N/A
    
    Fix: #8150
    
    ### Does this PR introduce _any_ user-facing change?
    N/A
    
    ### How was this patch tested?
    manually
---
 .../metalake/rightContent/CreateCatalogDialog.js   | 35 +++++++++++-----------
 web/web/src/lib/utils/initial.js                   |  3 --
 2 files changed, 18 insertions(+), 20 deletions(-)

diff --git 
a/web/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js 
b/web/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js
index b77caf9fc5..e86dd66110 100644
--- a/web/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js
+++ b/web/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js
@@ -121,6 +121,19 @@ const CreateCatalogDialog = props => {
 
   const providerSelect = watch('provider')
   const typeSelect = watch('type')
+  const catalogBackendSelect = watch('propItems').find(i => i.key === 
'catalog-backend')?.value
+
+  useEffect(() => {
+    const updateProps = innerProps.map(item => {
+      if (item.key === 'warehouse') {
+        return { ...item, required: ['hive', 
'jdbc'].includes(catalogBackendSelect) }
+      }
+
+      return item
+    })
+    setInnerProps(updateProps)
+    // eslint-disable-next-line react-hooks/exhaustive-deps
+  }, [catalogBackendSelect])
 
   const handleFormChange = ({ index, event }) => {
     let data = [...innerProps]
@@ -172,7 +185,7 @@ const CreateCatalogDialog = props => {
     const parentField = innerProps.find(i => i.key === field.parentField)
 
     const check =
-      (parentField && field.hide.includes(parentField.value)) ||
+      (parentField && field.hide?.includes(parentField.value)) ||
       (field.parentField === 'authentication.type' && parentField === 
undefined)
 
     return check
@@ -217,7 +230,7 @@ const CreateCatalogDialog = props => {
 
     if (
       propItems[0]?.key === 'catalog-backend' &&
-      propItems[0]?.value === 'hive' &&
+      ['hive', 'rest'].includes(propItems[0]?.value) &&
       ['lakehouse-iceberg', 'lakehouse-paimon'].includes(providerSelect)
     ) {
       nextProps = propItems.filter(item => !['jdbc-driver', 'jdbc-user', 
'jdbc-password'].includes(item.key))
@@ -227,14 +240,6 @@ const CreateCatalogDialog = props => {
       providerSelect === 'lakehouse-paimon'
     ) {
       nextProps = propItems.filter(item => !['jdbc-driver', 'jdbc-user', 
'jdbc-password', 'uri'].includes(item.key))
-    } else if (
-      propItems[0]?.key === 'catalog-backend' &&
-      propItems[0]?.value === 'rest' &&
-      providerSelect === 'lakehouse-iceberg'
-    ) {
-      nextProps = propItems.filter(
-        item => !['jdbc-driver', 'jdbc-user', 'jdbc-password', 
'warehouse'].includes(item.key)
-      )
     }
     const parentField = nextProps.find(i => i.key === 'authentication.type')
     if (!parentField || parentField?.value === 'simple') {
@@ -265,6 +270,7 @@ const CreateCatalogDialog = props => {
           'jdbc-driver': jdbcDriver,
           'jdbc-user': jdbcUser,
           'jdbc-password': jdbcPwd,
+          warehouse: warehouse,
           uri: uri,
           'authentication.type': authType,
           'authentication.kerberos.principal': kerberosPrincipal,
@@ -274,7 +280,7 @@ const CreateCatalogDialog = props => {
 
         if (
           catalogBackend &&
-          catalogBackend === 'hive' &&
+          ['rest', 'hive'].includes(catalogBackend) &&
           ['lakehouse-iceberg', 'lakehouse-paimon'].includes(providerSelect)
         ) {
           properties = {
@@ -282,18 +288,13 @@ const CreateCatalogDialog = props => {
             uri: uri,
             ...others
           }
+          warehouse && (properties['warehouse'] = warehouse)
         } else if (catalogBackend && catalogBackend === 'filesystem' && 
providerSelect === 'lakehouse-paimon') {
           properties = {
             'catalog-backend': catalogBackend,
             ...others
           }
           uri && (properties['uri'] = uri)
-        } else if (catalogBackend && catalogBackend === 'rest' && 
providerSelect === 'lakehouse-iceberg') {
-          properties = {
-            'catalog-backend': catalogBackend,
-            uri: uri,
-            ...others
-          }
         } else {
           properties = {
             uri: uri,
diff --git a/web/web/src/lib/utils/initial.js b/web/web/src/lib/utils/initial.js
index 78a1fabe51..e2da9dbe68 100644
--- a/web/web/src/lib/utils/initial.js
+++ b/web/web/src/lib/utils/initial.js
@@ -157,9 +157,6 @@ export const providers = [
       {
         key: 'warehouse',
         value: '',
-        required: true,
-        parentField: 'catalog-backend',
-        hide: ['rest'],
         description: 'Apache Iceberg catalog warehouse config'
       },
       {

Reply via email to