Skip to content

Commit

Permalink
[#1428] improvement(UI): Filtering empty keys when create or update (#…
Browse files Browse the repository at this point in the history
…1412)

### What changes were proposed in this pull request?

Filtering empty keys when operating create or update.

<img width="480" alt="image"
src="https://github.com/datastrato/gravitino/assets/17310559/c2bbf850-dfe9-4419-9f6d-6d9cd2fbe0f1">

After adding an empty key, the API will prompt an error message, so we
need to prevent this from happening at the frontend level.

### Why are the changes needed?

Fix: #1428 

### Does this PR introduce _any_ user-facing change?

N/A

### How was this patch tested?

N/A
  • Loading branch information
ch3yne authored Jan 10, 2024
1 parent c62aa87 commit fbd19c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
10 changes: 6 additions & 4 deletions web/app/(home)/CreateMetalakeDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,13 @@ const CreateMetalakeDialog = props => {
}

const onSubmit = data => {
const properties = innerProps.reduce((acc, item) => {
acc[item.key] = item.value
const properties = innerProps
.filter(i => i.key.trim() !== '')
.reduce((acc, item) => {
acc[item.key] = item.value

return acc
}, {})
return acc
}, {})

const metalakeData = {
...data,
Expand Down
10 changes: 6 additions & 4 deletions web/app/metalakes/CreateCatalogDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,13 @@ const CreateCatalogDialog = props => {
.then(() => {
let properties = {}

const prevProperties = innerProps.reduce((acc, item) => {
acc[item.key] = item.value
const prevProperties = innerProps
.filter(i => i.key.trim() !== '')
.reduce((acc, item) => {
acc[item.key] = item.value

return acc
}, {})
return acc
}, {})

const {
'catalog-backend': catalogBackend,
Expand Down

0 comments on commit fbd19c8

Please sign in to comment.