From 13ff4c9728c6476a6a7e23c50c14a6cf191cb255 Mon Sep 17 00:00:00 2001 From: Jerry Shao Date: Tue, 9 Jan 2024 20:52:31 +0800 Subject: [PATCH] [#1403] fix(UI): Remove unnecessary fields when creating a catalog in the web UI (#1407) ### What changes were proposed in this pull request? Fix submitted the unnecessary fields when create a catalog. if `provider` is `iceberg`, and `catalog-backend` is `hive`, the properties payload should not includes `jdbc-*` 1. request payload image 2. response data image ### Why are the changes needed? Fix: #1403 ### Does this PR introduce _any_ user-facing change? N/A ### How was this patch tested? N/A Co-authored-by: CHEYNE --- web/app/metalakes/CreateCatalogDialog.js | 21 ++++++++++++++++++++- web/lib/provider/session.js | 1 - web/lib/utils/axios/index.ts | 5 ++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/web/app/metalakes/CreateCatalogDialog.js b/web/app/metalakes/CreateCatalogDialog.js index 2db4916055d..e2d9243854d 100644 --- a/web/app/metalakes/CreateCatalogDialog.js +++ b/web/app/metalakes/CreateCatalogDialog.js @@ -172,12 +172,31 @@ const CreateCatalogDialog = props => { schema .validate(validData) .then(() => { - const properties = innerProps.reduce((acc, item) => { + let properties = {} + + const prevProperties = innerProps.reduce((acc, item) => { acc[item.key] = item.value return acc }, {}) + const { + 'catalog-backend': catalogBackend, + 'jdbc-driver': jdbcDriver, + 'jdbc-user': jdbcUser, + 'jdbc-password': jdbcPwd, + ...others + } = prevProperties + + if (catalogBackend && catalogBackend === 'hive') { + properties = { + 'catalog-backend': catalogBackend, + ...others + } + } else { + properties = prevProperties + } + const catalogData = { ...mainData, properties diff --git a/web/lib/provider/session.js b/web/lib/provider/session.js index d60fdf0ee09..6c88623e3e9 100644 --- a/web/lib/provider/session.js +++ b/web/lib/provider/session.js @@ -58,7 +58,6 @@ const AuthProvider = ({ children }) => { if (authType === 'simple') { dispatch(initialVersion()) - router.replace('/') } else { if (token) { dispatch(setIntervalId()) diff --git a/web/lib/utils/axios/index.ts b/web/lib/utils/axios/index.ts index 4c27ce63659..a9d91abb597 100644 --- a/web/lib/utils/axios/index.ts +++ b/web/lib/utils/axios/index.ts @@ -240,7 +240,10 @@ function createAxios(opt?: Partial) { // ** authentication schemes, e.g: Bearer authenticationScheme: 'Bearer', timeout: 0, - headers: { 'Content-Type': ContentTypeEnum.JSON }, + headers: { + 'Content-Type': ContentTypeEnum.JSON, + Accept: 'application/vnd.gravitino.v1+json' + }, transform: clone(transform), // ** request configuration settings