Skip to content

Commit

Permalink
[#1403] fix(UI): Remove unnecessary fields when creating a catalog in…
Browse files Browse the repository at this point in the history
… 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
<img width="270" alt="image"
src="https://github.com/datastrato/gravitino/assets/17310559/6b7a2947-0be9-49eb-8972-a302eea31d7f">

2. response data
<img width="269" alt="image"
src="https://github.com/datastrato/gravitino/assets/17310559/c2b2880e-fd4e-417e-9fe9-e3dc41beef0a">


### 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 <contact@ch3yne.com>
  • Loading branch information
jerryshao and ch3yne authored Jan 9, 2024
1 parent 5ae3302 commit 13ff4c9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
21 changes: 20 additions & 1 deletion web/app/metalakes/CreateCatalogDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion web/lib/provider/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const AuthProvider = ({ children }) => {

if (authType === 'simple') {
dispatch(initialVersion())
router.replace('/')
} else {
if (token) {
dispatch(setIntervalId())
Expand Down
5 changes: 4 additions & 1 deletion web/lib/utils/axios/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,10 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) {
// ** 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
Expand Down

0 comments on commit 13ff4c9

Please sign in to comment.