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

jshao pushed a commit to branch branch-0.6
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/branch-0.6 by this push:
     new b34e3e83a [#4742] Improvement(ui): support creating paimon catalog 
(#4931)
b34e3e83a is described below

commit b34e3e83abb2eeefcd906ab2fc1db15fa9255601
Author: Qian Xia <[email protected]>
AuthorDate: Fri Sep 13 12:24:15 2024 +0800

    [#4742] Improvement(ui): support creating paimon catalog (#4931)
    
    ### What changes were proposed in this pull request?
    support creating paimon catalog
    <img width="606" alt="image"
    
src="https://github.com/user-attachments/assets/e60ee53b-018d-4f0d-a49b-4e5145c74f8e";>
    <img width="641" alt="image"
    
src="https://github.com/user-attachments/assets/3bf2a40c-d5a0-41f1-8b4d-a7fbde221fee";>
    
    
    ### Why are the changes needed?
    support paimon by 0.6.0 version
    
    Fix: #4742
    
    ### Does this PR introduce _any_ user-facing change?
    N/A
    
    ### How was this patch tested?
    N/A
---
 web/src/app/metalakes/metalake/MetalakeTree.js     |  2 +
 .../metalake/rightContent/CreateCatalogDialog.js   | 60 ++++++++++++----
 web/src/lib/icons/iconify-icons.css                |  7 +-
 web/src/lib/icons/svg/paimon.svg                   | 21 ++++++
 web/src/lib/utils/initial.js                       | 82 ++++++++++++++++++++++
 5 files changed, 159 insertions(+), 13 deletions(-)

diff --git a/web/src/app/metalakes/metalake/MetalakeTree.js 
b/web/src/app/metalakes/metalake/MetalakeTree.js
index d0d8da646..cf1cca7ee 100644
--- a/web/src/app/metalakes/metalake/MetalakeTree.js
+++ b/web/src/app/metalakes/metalake/MetalakeTree.js
@@ -68,6 +68,8 @@ const MetalakeTree = props => {
             return 'devicon:postgresql-wordmark'
           case 'jdbc-doris':
             return 'custom-icons-doris'
+          case 'lakehouse-paimon':
+            return 'custom-icons-paimon'
           default:
             return 'bx:book'
         }
diff --git a/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js 
b/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js
index 86e7e3b07..95a5d6450 100644
--- a/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js
+++ b/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js
@@ -176,8 +176,11 @@ const CreateCatalogDialog = props => {
     if (!field) {
       return true
     }
-    const parentField = innerProps.find(i => i.key === 'catalog-backend')
-    const check = parentField && parentField.value === field.hide
+    const parentField = innerProps.find(i => i.key === field.parentField)
+
+    const check =
+      (parentField && parentField.value === field.hide) ||
+      (field.parentField === 'authentication.type' && parentField === 
undefined)
 
     return check
   }
@@ -189,9 +192,7 @@ const CreateCatalogDialog = props => {
   const resetPropsFields = (providers = [], index = -1) => {
     if (index !== -1) {
       providers[index].defaultProps.forEach((item, index) => {
-        if (item.key !== 'catalog-backend') {
-          item.value = ''
-        }
+        item.value = item.defaultValue || ''
       })
     }
   }
@@ -226,12 +227,26 @@ const CreateCatalogDialog = props => {
 
     const { propItems, ...mainData } = data
 
-    let nextProps = []
-
-    if (propItems[0]?.key === 'catalog-backend' && propItems[0]?.value === 
'hive') {
-      nextProps = propItems.slice(0, 3)
-    } else {
-      nextProps = propItems
+    let nextProps = propItems
+
+    if (
+      propItems[0]?.key === 'catalog-backend' &&
+      propItems[0]?.value === 'hive' &&
+      providerSelect === 'lakehouse-iceberg'
+    ) {
+      nextProps = propItems.filter(item => !['jdbc-driver', 'jdbc-user', 
'jdbc-password'].includes(item.key))
+    } else if (
+      propItems[0]?.key === 'catalog-backend' &&
+      propItems[0]?.value === 'filesystem' &&
+      providerSelect === 'lakehouse-paimon'
+    ) {
+      nextProps = propItems.filter(item => item.key !== 'uri')
+    }
+    const parentField = nextProps.find(i => i.key === 'authentication.type')
+    if (parentField && parentField.value === 'simple') {
+      nextProps = nextProps.filter(
+        item => item.key !== 'authentication.kerberos.principal' && item.key 
!== 'authentication.kerberos.keytab-uri'
+      )
     }
 
     trigger()
@@ -256,14 +271,35 @@ const CreateCatalogDialog = props => {
           'jdbc-driver': jdbcDriver,
           'jdbc-user': jdbcUser,
           'jdbc-password': jdbcPwd,
+          uri: uri,
+          'authentication.type': authType,
+          'authentication.kerberos.principal': kerberosPrincipal,
+          'authentication.kerberos.keytab-uri': kerberosKeytabUri,
           ...others
         } = prevProperties
 
-        if (catalogBackend && catalogBackend === 'hive') {
+        if (catalogBackend && catalogBackend === 'hive' && providerSelect === 
'lakehouse-iceberg') {
+          properties = {
+            'catalog-backend': catalogBackend,
+            uri: uri,
+            ...others
+          }
+        } else if (catalogBackend && catalogBackend === 'filesystem' && 
providerSelect === 'lakehouse-paimon') {
+          properties = {
+            'catalog-backend': catalogBackend,
+            ...others
+          }
+          uri && (properties['uri'] = uri)
+        } else if (
+          (!authType || authType === 'simple') &&
+          ['lakehouse-iceberg', 'lakehouse-paimon'].includes(providerSelect)
+        ) {
           properties = {
             'catalog-backend': catalogBackend,
             ...others
           }
+          uri && (properties['uri'] = uri)
+          authType && (properties['authType'] = authType)
         } else {
           properties = prevProperties
         }
diff --git a/web/src/lib/icons/iconify-icons.css 
b/web/src/lib/icons/iconify-icons.css
index cb0d435ee..9fbd7ad75 100644
--- a/web/src/lib/icons/iconify-icons.css
+++ b/web/src/lib/icons/iconify-icons.css
@@ -18,7 +18,8 @@
  */
 
 .custom-icons-doris,
-.custom-icons-hive {
+.custom-icons-hive,
+.custom-icons-paimon {
   display: inline-block;
   width: 1em;
   height: 1em;
@@ -34,3 +35,7 @@
   width: 1.12em;
   background-image: url("data:image/svg+xml,%3Csvg 
xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 900' width='1000' 
height='900'%3E%3Cpath fill-rule='evenodd' stroke='%23fdee21' 
stroke-width='5.129' d='M596.797 
704.59v192.85h47.346v-88.632l9.767.183v88.45h47.881V704.59h-47.88v71.552h-9.768V704.59zm163.92
 0h-46.116v192.85h46.116zm7.55 0 36.429 
192.85h54.984l36.429-192.85h-48.951l-12.067 82.517c-1.006 3.16-4.402 3.16-5.009 
0l-12.06-82.52zm229.17 0h-91.538v192.85h91.538v-50.569l-50.89 [...]
 }
+
+.custom-icons-paimon {
+  background-image: url("data:image/svg+xml,%3Csvg 
xmlns='http://www.w3.org/2000/svg' viewBox='0 0 218.61 218.61' width='218.61' 
height='218.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-2{fill:%230163e1}%3C/style%3E%3C/defs%3E%3Cg
 id='svgID0'%3E%3Cpath d='M55.63 111.28a35.01 35.01 0 
00-21.95-21.65l-12.74-4.26h80.4c19.85-7.47 43.6-13.02 72.56-17.39l19.6-3.48 
13.7-3.85C189.3 24.7 152.19 0 109.3 0 48.94 0 0 48.94 0 109.3c0 20.41 2.93 
39.59 17.2 58.79 8.15-17.84 23.42-40.44 38.43-56.82Z' class='cls-2'/%3 [...]
+}
diff --git a/web/src/lib/icons/svg/paimon.svg b/web/src/lib/icons/svg/paimon.svg
new file mode 100644
index 000000000..f91bc6e44
--- /dev/null
+++ b/web/src/lib/icons/svg/paimon.svg
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg id="_图层_2" data-name="图层 2" xmlns="http://www.w3.org/2000/svg"; viewBox="0 
0 218.61 218.61">
+  <defs>
+    <style>
+      .cls-1 {
+        fill: #e7e7e7;
+      }
+
+      .cls-2 {
+        fill: #0163e1;
+      }
+    </style>
+  </defs>
+  <g id="_图层_1-2" data-name="图层 1">
+    <g>
+      <path class="cls-2" 
d="m55.63,111.28c-3.51-10.04-11.49-18.15-21.95-21.65l-12.74-4.26h80.4c19.85-7.47,43.6-13.02,72.56-17.39l19.6-3.48,13.7-3.85C189.3,24.7,152.19,0,109.3,0,48.94,0,0,48.94,0,109.3c0,20.41,2.93,39.59,17.2,58.79,8.15-17.84,23.42-40.44,38.43-56.82Z"/>
+      <path class="cls-2" 
d="m182.4,72.57c-60.11,22.53-114.4,58.22-158.92,104.43,20.02,25.34,51.02,41.61,85.82,41.61,60.37,0,109.3-48.94,109.3-109.3,0-16.36-3.6-31.88-10.04-45.81l-26.17,9.08Z"/>
+      <path class="cls-1" 
d="m182.4,72.57l26.17-9.08c-.44-.95-.9-1.9-1.36-2.84l-13.7,3.85-17.66,1.02c-29.79,2.42-54.8,8.05-86.19,19.85H20.94l9,3.87c9.89,3.88,22.18,12,25.69,22.04-16.77,16.69-30.7,39.55-38.43,56.82,2.46,4.13,5.32,7.62,8.29,11.37,48.68-53.33,96.8-84.37,156.91-106.89Z"/>
+    </g>
+  </g>
+</svg>
\ No newline at end of file
diff --git a/web/src/lib/utils/initial.js b/web/src/lib/utils/initial.js
index e3af62274..8d85779ab 100644
--- a/web/src/lib/utils/initial.js
+++ b/web/src/lib/utils/initial.js
@@ -67,6 +67,7 @@ export const providers = [
       {
         key: 'catalog-backend',
         value: 'hive',
+        defaultValue: 'hive',
         required: true,
         description: 'Apache Iceberg catalog type choose properties',
         select: ['hive', 'jdbc']
@@ -87,6 +88,7 @@ export const providers = [
         key: 'jdbc-driver',
         value: '',
         required: true,
+        parentField: 'catalog-backend',
         hide: 'hive',
         description: `"com.mysql.jdbc.Driver" or "com.mysql.cj.jdbc.Driver" 
for MySQL, "org.postgresql.Driver" for PostgreSQL`
       },
@@ -94,13 +96,40 @@ export const providers = [
         key: 'jdbc-user',
         value: '',
         required: true,
+        parentField: 'catalog-backend',
         hide: 'hive'
       },
       {
         key: 'jdbc-password',
         value: '',
         required: true,
+        parentField: 'catalog-backend',
         hide: 'hive'
+      },
+      {
+        key: 'authentication.type',
+        value: 'simple',
+        defaultValue: 'simple',
+        required: false,
+        description:
+          'The type of authentication for Paimon catalog backend, currently 
Gravitino only supports Kerberos and simple',
+        select: ['simple', 'Kerberos']
+      },
+      {
+        key: 'authentication.kerberos.principal',
+        value: '',
+        required: true,
+        description: 'The principal of the Kerberos authentication.',
+        parentField: 'authentication.type',
+        hide: 'simple'
+      },
+      {
+        key: 'authentication.kerberos.keytab-uri',
+        value: '',
+        required: true,
+        description: 'The URI of The keytab for the Kerberos authentication.',
+        parentField: 'authentication.type',
+        hide: 'simple'
       }
     ]
   },
@@ -192,5 +221,58 @@ export const providers = [
         required: true
       }
     ]
+  },
+  {
+    label: 'Apache Paimon',
+    value: 'lakehouse-paimon',
+    defaultProps: [
+      {
+        key: 'catalog-backend',
+        value: 'filesystem',
+        defaultValue: 'filesystem',
+        required: true,
+        description: 'Only supports "filesystem" now.'
+      },
+      {
+        key: 'uri',
+        value: '',
+        required: true,
+        description:
+          'e.g. thrift://127.0.0.1:9083 or 
jdbc:postgresql://127.0.0.1:5432/db_name or 
jdbc:mysql://127.0.0.1:3306/metastore_db',
+        parentField: 'catalog-backend',
+        hide: 'filesystem'
+      },
+      {
+        key: 'warehouse',
+        value: '',
+        required: true,
+        description: 'e.g. file:///user/hive/warehouse-paimon/ or 
hdfs://namespace/hdfs/path'
+      },
+      {
+        key: 'authentication.type',
+        value: 'simple',
+        defaultValue: 'simple',
+        required: false,
+        description:
+          'The type of authentication for Paimon catalog backend, currently 
Gravitino only supports Kerberos and simple',
+        select: ['simple', 'Kerberos']
+      },
+      {
+        key: 'authentication.kerberos.principal',
+        value: '',
+        required: true,
+        description: 'The principal of the Kerberos authentication.',
+        parentField: 'authentication.type',
+        hide: 'simple'
+      },
+      {
+        key: 'authentication.kerberos.keytab-uri',
+        value: '',
+        required: true,
+        description: 'The URI of The keytab for the Kerberos authentication.',
+        parentField: 'authentication.type',
+        hide: 'simple'
+      }
+    ]
   }
 ]

Reply via email to