SteNicholas commented on code in PR #92:
URL:
https://github.com/apache/incubator-paimon-webui/pull/92#discussion_r1382740028
##########
paimon-web-ui-new/src/api/models/catalog/index.ts:
##########
@@ -29,4 +29,11 @@ export const getAllCatalogs = () => {
return httpRequest.get<any, Catalog[]>('/catalog/getAllCatalogs')
}
+/**
+ * # Get database by catalog id
+ */
+export const getDatabaseByCatalogId = (id: number) => {
Review Comment:
```suggestion
export const getDatabasesByCatalogId = (id: number) => {
```
##########
paimon-web-ui-new/src/views/metadata/components/menu-tree/index.tsx:
##########
@@ -42,29 +43,79 @@ export default defineComponent({
},
]
- const nodeProps = () => {
- return {
- onClick () {
- },
+ const updatePrefixWithExpanded = (
+ _keys: Array<string | number>,
+ _option: Array<TreeOption | null>,
+ meta: {
+ node: TreeOption | null
+ action: 'expand' | 'collapse' | 'filter'
}
+ ) => {
+ if (!meta.node) return
+ switch (meta.action) {
+ case 'expand':
+ meta.node.prefix = () =>
+ h(NIcon, null, {
+ default: () => h(FolderOpenOutline)
+ })
+ break
+ case 'collapse':
+ meta.node.prefix = () =>
+ h(NIcon, null, {
+ default: () => h(FolderOutline)
+ })
+ break
+ }
+ }
+
+ const renderSuffix = ({ option }: { option: TreeOption }) => {
+ return option.type !== 'table' ? h(NButton, {
+ quaternary: true,
+ circle: true,
+ size: 'tiny',
+ onClick: (e) => {
+ e.stopPropagation()
+ }
+ }, {
+ default: () => h(NIcon, null, {
+ default: () => h(Add)
+ })
+ }) : undefined
}
onMounted(catalogStore.getAllCatalogs)
+ const onLoadMenu = async (node: TreeOption) => {
+ const loadFn = node.type === 'catalog' ?
catalogStore.getDatabaseByCatalogId : catalogStore.getTableByDataBaseId
Review Comment:
```suggestion
const loadFn = node.type === 'catalog' ?
catalogStore.getDatabaseByCatalogId : catalogStore.getTablesByDataBaseId
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]