This is an automated email from the ASF dual-hosted git repository.
jshao 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 7c2c0f0ae [#5452] Improvement(web): add REST catalog backend for
Iceberg catalog (#5635)
7c2c0f0ae is described below
commit 7c2c0f0ae85dd0a69b664ef91bc62e27cd0fa681
Author: Chun-Hao Liu <[email protected]>
AuthorDate: Fri Nov 22 17:17:43 2024 +0800
[#5452] Improvement(web): add REST catalog backend for Iceberg catalog
(#5635)
### What changes were proposed in this pull request?
Modified:
- app/metalakes/metalake/rightContent/CreateCatalogDialog.js
- lib/utils/initial.js
### Why are the changes needed?
Iceberg catalog supports hive, jdbc catalog backend in WEB, we need to
support rest catalog backend too, it only supports uri properties.
1. Add select item 'rest' in the dropbox menu.
2. When select rest menu item, only show 'uri' properties edit needs to
input.
### Does this PR introduce _any_ user-facing change?
Yes, this PR introduces web UI changes :
1. Add a selectable item called 'rest' to the dropdown menu when
creating a new catalog.
2. Remove all other properties except 'uri.'
### How was this patch tested?
Visit the Gravitino web UI through the browser and click 'Create
Catalog' .
Then, check the menu items and the API call in debug mode.
You can see the HTTP payload sent as follows:
POST http://localhost:3000/api/metalakes/test/catalogs
```json
{
"name": "1",
"type": "relational",
"provider": "lakehouse-iceberg",
"comment": "",
"properties": {
"uri": "1",
"warehouse": "",
"catalog-backend": "rest",
"authType": "simple"
}
}
```
response:
```json
{
"code": 0,
"catalog": {
"name": "1",
"type": "relational",
"provider": "lakehouse-iceberg",
"comment": "",
"properties": {
"catalog-backend": "rest",
"warehouse": "",
"authType": "simple",
"uri": "1",
"in-use": "true"
},
"audit": {
"creator": "anonymous",
"createTime": "2024-11-19T15:16:07.054Z",
"lastModifier": "anonymous",
"lastModifiedTime": "2024-11-19T15:16:07.054Z"
}
}
}
```
---
.../metalakes/metalake/rightContent/CreateCatalogDialog.js | 14 ++++++++++++++
web/web/src/lib/utils/initial.js | 10 ++++++----
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git
a/web/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js
b/web/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js
index 34db30698..d422fd21e 100644
--- a/web/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js
+++ b/web/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js
@@ -241,6 +241,14 @@ 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') {
@@ -294,6 +302,12 @@ const CreateCatalogDialog = props => {
...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 6c599f9ee..6d633f765 100644
--- a/web/web/src/lib/utils/initial.js
+++ b/web/web/src/lib/utils/initial.js
@@ -70,7 +70,7 @@ export const providers = [
defaultValue: 'hive',
required: true,
description: 'Apache Iceberg catalog type choose properties',
- select: ['hive', 'jdbc']
+ select: ['hive', 'jdbc', 'rest']
},
{
key: 'uri',
@@ -82,6 +82,8 @@ export const providers = [
key: 'warehouse',
value: '',
required: true,
+ parentField: 'catalog-backend',
+ hide: ['rest'],
description: 'Apache Iceberg catalog warehouse config'
},
{
@@ -89,7 +91,7 @@ export const providers = [
value: '',
required: true,
parentField: 'catalog-backend',
- hide: ['hive'],
+ hide: ['hive', 'rest'],
description: `"com.mysql.jdbc.Driver" or "com.mysql.cj.jdbc.Driver"
for MySQL, "org.postgresql.Driver" for PostgreSQL`
},
{
@@ -97,14 +99,14 @@ export const providers = [
value: '',
required: true,
parentField: 'catalog-backend',
- hide: ['hive']
+ hide: ['hive', 'rest']
},
{
key: 'jdbc-password',
value: '',
required: true,
parentField: 'catalog-backend',
- hide: ['hive']
+ hide: ['hive', 'rest']
},
{
key: 'authentication.type',