From 0c9c0d03646575cb1b420b4045e007397d5e7ce3 Mon Sep 17 00:00:00 2001 From: Qian Xia Date: Fri, 6 Dec 2024 19:32:33 +0800 Subject: [PATCH] [#5447][#5720][#5727] create topic, disable create table for hudi, enable schema properties and comment for partial paimon (#5771) ### What changes were proposed in this pull request? 1. Support creating topic/editing topic/deleting topic/viewing topic image 2. Fix issue with creating a table for hudi image 3. [Improvement] Paimon catalog, schema properties can be set when backend is jdbc and hive image image ### Why are the changes needed? N/A Fix: #5447, #5720, #5727 ### Does this PR introduce _any_ user-facing change? N/A ### How was this patch tested? manually --------- Co-authored-by: Qiming Teng --- .../src/app/metalakes/CreateMetalakeDialog.js | 4 +- .../rightContent/CreateCatalogDialog.js | 6 +- .../rightContent/CreateFilesetDialog.js | 6 +- .../rightContent/CreateSchemaDialog.js | 40 +- .../rightContent/CreateTableDialog.js | 6 +- .../rightContent/CreateTopicDialog.js | 435 ++++++++++++++++++ .../metalake/rightContent/RightContent.js | 50 +- .../tabsContent/tableView/TableView.js | 58 ++- web/web/src/lib/api/topics/index.js | 20 +- web/web/src/lib/store/metalakes/index.js | 108 ++++- 10 files changed, 687 insertions(+), 46 deletions(-) create mode 100644 web/web/src/app/metalakes/metalake/rightContent/CreateTopicDialog.js diff --git a/web/web/src/app/metalakes/CreateMetalakeDialog.js b/web/web/src/app/metalakes/CreateMetalakeDialog.js index 8b8daaadb05..2fb70ff3823 100644 --- a/web/web/src/app/metalakes/CreateMetalakeDialog.js +++ b/web/web/src/app/metalakes/CreateMetalakeDialog.js @@ -316,8 +316,8 @@ const CreateMetalakeDialog = props => { )} {item.invalid && ( - Invalid key, matches strings starting with a letter/underscore, followed by alphanumeric - characters, underscores, hyphens, or dots. + Valid key must starts with a letter/underscore, followed by alphanumeric characters, + underscores, hyphens, or dots. )} diff --git a/web/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js b/web/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js index a4cf85623fb..cd9c101f762 100644 --- a/web/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js +++ b/web/web/src/app/metalakes/metalake/rightContent/CreateCatalogDialog.js @@ -680,12 +680,12 @@ const CreateCatalogDialog = props => { )} {item.key && item.invalid && ( - Invalid key, matches strings starting with a letter/underscore, followed by alphanumeric - characters, underscores, hyphens, or dots. + Valid key must starts with a letter/underscore, followed by alphanumeric characters, + underscores, hyphens, or dots. )} {!item.key.trim() && ( - Key is required field + Key is required )} diff --git a/web/web/src/app/metalakes/metalake/rightContent/CreateFilesetDialog.js b/web/web/src/app/metalakes/metalake/rightContent/CreateFilesetDialog.js index cb19015458b..6a69d82f879 100644 --- a/web/web/src/app/metalakes/metalake/rightContent/CreateFilesetDialog.js +++ b/web/web/src/app/metalakes/metalake/rightContent/CreateFilesetDialog.js @@ -461,12 +461,12 @@ const CreateFilesetDialog = props => { )} {item.key && item.invalid && ( - Invalid key, matches strings starting with a letter/underscore, followed by alphanumeric - characters, underscores, hyphens, or dots. + Valid key must starts with a letter/underscore, followed by alphanumeric characters, + underscores, hyphens, or dots. )} {!item.key.trim() && ( - Key is required field + Key is required )} diff --git a/web/web/src/app/metalakes/metalake/rightContent/CreateSchemaDialog.js b/web/web/src/app/metalakes/metalake/rightContent/CreateSchemaDialog.js index 08efd4036db..ce893802a19 100644 --- a/web/web/src/app/metalakes/metalake/rightContent/CreateSchemaDialog.js +++ b/web/web/src/app/metalakes/metalake/rightContent/CreateSchemaDialog.js @@ -23,20 +23,18 @@ import { useState, forwardRef, useEffect, Fragment } from 'react' import { Box, - Grid, Button, Dialog, - TextField, - Typography, - DialogContent, DialogActions, - IconButton, + DialogContent, Fade, - Select, - MenuItem, - InputLabel, FormControl, - FormHelperText + FormHelperText, + Grid, + IconButton, + InputLabel, + TextField, + Typography } from '@mui/material' import Icon from '@/components/Icon' @@ -90,6 +88,10 @@ const CreateSchemaDialog = props => { const activatedCatalogDetail = store.activatedDetails const [cacheData, setCacheData] = useState() + const paimonCatalogBackend = + activatedCatalogDetail?.provider === 'lakehouse-paimon' && + ['hive', 'jdbc'].includes(activatedCatalogDetail?.properties['catalog-backend']) + const { control, reset, @@ -293,7 +295,8 @@ const CreateSchemaDialog = props => { - {!['jdbc-mysql', 'lakehouse-paimon', 'jdbc-oceanbase'].includes(activatedCatalogDetail?.provider) && ( + {(!['jdbc-mysql', 'lakehouse-paimon', 'jdbc-oceanbase'].includes(activatedCatalogDetail?.provider) || + paimonCatalogBackend) && ( { )} /> + {activatedCatalogDetail?.properties['catalog-backend']} )} - {!['jdbc-postgresql', 'lakehouse-paimon', 'kafka', 'jdbc-mysql', 'jdbc-oceanbase'].includes( + {(!['jdbc-postgresql', 'lakehouse-paimon', 'kafka', 'jdbc-mysql', 'jdbc-oceanbase'].includes( activatedCatalogDetail?.provider - ) && ( + ) || + paimonCatalogBackend) && ( Properties @@ -385,12 +390,12 @@ const CreateSchemaDialog = props => { )} {item.key && item.invalid && ( - Invalid key, matches strings starting with a letter/underscore, followed by alphanumeric - characters, underscores, hyphens, or dots. + Valid key must starts with a letter/underscore, followed by alphanumeric characters, + underscores, hyphens, or dots. )} {!item.key.trim() && ( - Key is required field + Key is required )} @@ -400,9 +405,10 @@ const CreateSchemaDialog = props => { )} - {!['jdbc-postgresql', 'lakehouse-paimon', 'kafka', 'jdbc-mysql', 'jdbc-oceanbase'].includes( + {(!['jdbc-postgresql', 'lakehouse-paimon', 'kafka', 'jdbc-mysql', 'jdbc-oceanbase'].includes( activatedCatalogDetail?.provider - ) && ( + ) || + paimonCatalogBackend) && ( + + + + [`${theme.spacing(5)} !important`, `${theme.spacing(15)} !important`], + pb: theme => [`${theme.spacing(5)} !important`, `${theme.spacing(12.5)} !important`] + }} + > + + + + + + ) +} + +export default CreateTopicDialog diff --git a/web/web/src/app/metalakes/metalake/rightContent/RightContent.js b/web/web/src/app/metalakes/metalake/rightContent/RightContent.js index a4a59099fe4..8e061f97ac6 100644 --- a/web/web/src/app/metalakes/metalake/rightContent/RightContent.js +++ b/web/web/src/app/metalakes/metalake/rightContent/RightContent.js @@ -27,6 +27,7 @@ import MetalakePath from './MetalakePath' import CreateCatalogDialog from './CreateCatalogDialog' import CreateSchemaDialog from './CreateSchemaDialog' import CreateFilesetDialog from './CreateFilesetDialog' +import CreateTopicDialog from './CreateTopicDialog' import CreateTableDialog from './CreateTableDialog' import TabsContent from './tabsContent/TabsContent' import { useSearchParams } from 'next/navigation' @@ -36,11 +37,13 @@ const RightContent = () => { const [open, setOpen] = useState(false) const [openSchema, setOpenSchema] = useState(false) const [openFileset, setOpenFileset] = useState(false) + const [openTopic, setOpenTopic] = useState(false) const [openTable, setOpenTable] = useState(false) const searchParams = useSearchParams() const [isShowBtn, setBtnVisible] = useState(true) const [isShowSchemaBtn, setSchemaBtnVisible] = useState(false) const [isShowFilesetBtn, setFilesetBtnVisible] = useState(false) + const [isShowTopicBtn, setTopicBtnVisible] = useState(false) const [isShowTableBtn, setTableBtnVisible] = useState(false) const store = useAppSelector(state => state.metalakes) @@ -56,6 +59,10 @@ const RightContent = () => { setOpenFileset(true) } + const handleCreateTopic = () => { + setOpenTopic(true) + } + const handleCreateTable = () => { setOpenTable(true) } @@ -69,10 +76,18 @@ const RightContent = () => { paramsSize == 4 && searchParams.has('metalake') && searchParams.has('catalog') && - searchParams.get('type') === 'fileset' - searchParams.has('schema') + searchParams.get('type') === 'fileset' && + searchParams.has('schema') setFilesetBtnVisible(isFilesetList) + const isTopicList = + paramsSize == 4 && + searchParams.has('metalake') && + searchParams.has('catalog') && + searchParams.get('type') === 'messaging' && + searchParams.has('schema') + setTopicBtnVisible(isTopicList) + if (store.catalogs.length) { const currentCatalog = store.catalogs.filter(ca => ca.name === searchParams.get('catalog'))[0] @@ -83,15 +98,16 @@ const RightContent = () => { searchParams.has('type') && !['lakehouse-hudi', 'kafka'].includes(currentCatalog?.provider) setSchemaBtnVisible(isSchemaList) - } - const isTableList = - paramsSize == 4 && - searchParams.has('metalake') && - searchParams.has('catalog') && - searchParams.get('type') === 'relational' && - searchParams.has('schema') - setTableBtnVisible(isTableList) + const isTableList = + paramsSize == 4 && + searchParams.has('metalake') && + searchParams.has('catalog') && + searchParams.get('type') === 'relational' && + searchParams.has('schema') && + 'lakehouse-hudi' !== currentCatalog?.provider + setTableBtnVisible(isTableList) + } }, [searchParams, store.catalogs, store.catalogs.length]) return ( @@ -155,6 +171,20 @@ const RightContent = () => { )} + {isShowTopicBtn && ( + + + + + )} {isShowTableBtn && (