You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "zhangmo8 (via GitHub)" <gi...@apache.org> on 2023/10/26 10:34:27 UTC

[PR] [Feature] Metadata get all catalog api fetch [incubator-paimon-webui]

zhangmo8 opened a new pull request, #81:
URL: https://github.com/apache/incubator-paimon-webui/pull/81

   <!-- Please specify the module before the PR name: [core] ... or [flink] ... -->
   
   ### Purpose
   
   Metadata get all catalog api fetch & render menu
   
   <img width="1123" alt="image" src="https://github.com/apache/incubator-paimon-webui/assets/43628500/547644b7-636e-4756-8bf8-2426a0d8a9e8">
   
   
   <!-- What is the purpose of the change, or the associated issue -->
   
   ### Tests
   
   <!-- List UT and IT cases to verify this change -->
   
   ### API and Format
   
   <!-- Does this change affect API or storage format -->
   
   ### Documentation
   
   <!-- Does this change introduce a new feature -->
   


-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature] Metadata get all catalog api fetch [incubator-paimon-webui]

Posted by "SteNicholas (via GitHub)" <gi...@apache.org>.
SteNicholas commented on code in PR #81:
URL: https://github.com/apache/incubator-paimon-webui/pull/81#discussion_r1374390211


##########
paimon-web-ui-new/src/store/catalog/index.ts:
##########
@@ -0,0 +1,67 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License. */
+
+import { NIcon, type TreeOption } from 'naive-ui'
+import { FolderOpenOutline } from '@vicons/ionicons5'
+
+
+import { getAllCatalogApi, type Catalog } from "@/api/models/catalog"
+
+export interface CatalogState {
+  _catalogs: Catalog[];
+  _catalogLoading: boolean;
+}
+
+export const useCatalogStore = defineStore('catalog', {

Review Comment:
   ```suggestion
   export const catalogStore = defineStore('catalog', {
   ```



-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature] Metadata get all catalog api fetch [incubator-paimon-webui]

Posted by "SteNicholas (via GitHub)" <gi...@apache.org>.
SteNicholas commented on code in PR #81:
URL: https://github.com/apache/incubator-paimon-webui/pull/81#discussion_r1374388865


##########
paimon-web-ui-new/src/api/models/catalog/index.ts:
##########
@@ -0,0 +1,32 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License. */
+
+import httpRequest from '@/api/request'
+import type { CatalogType } from './interface'
+
+export * from './interface'
+
+// #region catalog-controller
+
+/**
+ * # Get all catalog
+ */
+export const getAllCatalogApi = () => {

Review Comment:
   ```suggestion
   export const getAllCatalogs = () => {
   ```



-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature] Metadata get all catalog api fetch [incubator-paimon-webui]

Posted by "SteNicholas (via GitHub)" <gi...@apache.org>.
SteNicholas commented on code in PR #81:
URL: https://github.com/apache/incubator-paimon-webui/pull/81#discussion_r1374390211


##########
paimon-web-ui-new/src/store/catalog/index.ts:
##########
@@ -0,0 +1,67 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License. */
+
+import { NIcon, type TreeOption } from 'naive-ui'
+import { FolderOpenOutline } from '@vicons/ionicons5'
+
+
+import { getAllCatalogApi, type Catalog } from "@/api/models/catalog"
+
+export interface CatalogState {
+  _catalogs: Catalog[];
+  _catalogLoading: boolean;
+}
+
+export const useCatalogStore = defineStore('catalog', {

Review Comment:
   ```suggestion
   export const catalogStore = defineStore('catalog', {
   ```



-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature] Metadata get all catalog api fetch [incubator-paimon-webui]

Posted by "SteNicholas (via GitHub)" <gi...@apache.org>.
SteNicholas commented on code in PR #81:
URL: https://github.com/apache/incubator-paimon-webui/pull/81#discussion_r1374381336


##########
paimon-web-ui-new/src/store/catalog/index.ts:
##########
@@ -0,0 +1,67 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License. */
+
+import { NIcon, type TreeOption } from 'naive-ui'
+import { FolderOpenOutline } from '@vicons/ionicons5'
+
+
+import { getAllCatalogApi, type CatalogType } from "@/api/models/catalog"
+
+export interface CatalogStateType {

Review Comment:
   ```suggestion
   export interface CatalogState {
   ```



##########
paimon-web-ui-new/src/api/models/catalog/interface.ts:
##########
@@ -0,0 +1,29 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License. */
+
+export interface CatalogType {

Review Comment:
   ```suggestion
   export interface Catalog {
   ```



##########
paimon-web-ui-new/src/store/catalog/index.ts:
##########
@@ -0,0 +1,67 @@
+/* Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License. */
+
+import { NIcon, type TreeOption } from 'naive-ui'
+import { FolderOpenOutline } from '@vicons/ionicons5'
+
+
+import { getAllCatalogApi, type CatalogType } from "@/api/models/catalog"
+
+export interface CatalogStateType {
+  _catalogs: CatalogType[];
+  _catalogLoading: boolean;
+}
+
+export const useCatalogStore = defineStore('catalog', {
+  state: (): CatalogStateType => ({
+    _catalogs: [],
+    _catalogLoading: false
+  }),
+  persist: true,
+  getters: {
+    catalogs: (state): TreeOption[] => {
+      return transformCatalog(state._catalogs)
+    },
+    catalogLoading: (state): boolean => {
+      return state._catalogLoading
+    }
+  },
+  actions: {
+    async getAllCatalog(): Promise<void> {
+      const [, useAllCatalog] = getAllCatalogApi()
+
+      this._catalogLoading = true
+      const res = await useAllCatalog()
+      this._catalogs = res.data
+      this._catalogLoading = false
+    }
+  }
+})
+
+const transformCatalog = (catalogs: CatalogType[]): TreeOption[] => {
+  return catalogs.map(catalog => ({
+    label: catalog.catalogName,
+    type: catalog.catalogType,
+    key: catalog.id,
+    isLeaf: false,
+    children: [],
+    prefix: () =>
+      h(NIcon, null, {
+        default: () => h(FolderOpenOutline)
+      }),
+  }))
+}

Review Comment:
   Add the new line at the end of file.



-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature] Fetch metadata with getAllCatalogs API [incubator-paimon-webui]

Posted by "SteNicholas (via GitHub)" <gi...@apache.org>.
SteNicholas merged PR #81:
URL: https://github.com/apache/incubator-paimon-webui/pull/81


-- 
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: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org