This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch branch-1.8
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/branch-1.8 by this push:
     new 37a818e7a [KYUUBI #5259][UI] Web UI supports Swagger pages
37a818e7a is described below

commit 37a818e7a1abacc506e79b90f48c90c23dbb7b36
Author: zwangsheng <[email protected]>
AuthorDate: Mon Sep 11 11:23:31 2023 +0000

    [KYUUBI #5259][UI] Web UI supports Swagger pages
    
    ### _Why are the changes needed?_
    
    As title, add swagger ui into new kyuubi web ui.
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including 
negative and positive cases if possible
    
    - [x] Add screenshots for manual tests if appropriate
    
    - [ ] [Run 
test](https://kyuubi.readthedocs.io/en/master/contributing/code/testing.html#running-tests)
 locally before make a pull request
    
    ### _Was this patch authored or co-authored using generative AI tooling?_
    
    No
    
    Closes #5263 from zwangsheng/KYUUBI#5259.
    
    Closes #5259
    
    34c87797c [zwangsheng] keep static swagger ui in kyuubi server
    2efbae03f [zwangsheng] fix license
    21c8cae6e [zwangsheng] remove dup dependence and add swagger ui into notive
    c1bedcbe1 [Cheng Pan] Update 
kyuubi-server/web-ui/src/views/swagger/index.vue
    182042009 [Fu Chen] Update kyuubi-server/web-ui/src/views/swagger/index.vue
    05c3b87c4 [zwangsheng] fix style
    fc05bb82f [zwangsheng] Add License header
    e56252036 [zwangsheng] Try
    9c968005b [zwangsheng] Init swagger page
    
    Lead-authored-by: zwangsheng <[email protected]>
    Co-authored-by: Cheng Pan <[email protected]>
    Co-authored-by: Fu Chen <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
    (cherry picked from commit 60b7e8fb9a5824d3b1a3899f9a6785dd1d1d2ee1)
    Signed-off-by: Cheng Pan <[email protected]>
---
 LICENSE-binary                                     |  2 +
 kyuubi-server/web-ui/package-lock.json             | 24 ++++++++++++
 kyuubi-server/web-ui/package.json                  |  2 +
 kyuubi-server/web-ui/pnpm-lock.yaml                | 14 +++++++
 kyuubi-server/web-ui/src/router/index.ts           |  2 +
 .../web-ui/src/router/{ => swagger}/index.ts       | 37 ++----------------
 .../src/views/layout/components/aside/types.ts     |  5 +++
 kyuubi-server/web-ui/src/views/swagger/index.vue   | 45 ++++++++++++++++++++++
 8 files changed, 98 insertions(+), 33 deletions(-)

diff --git a/LICENSE-binary b/LICENSE-binary
index d51e52d43..4cad931d7 100644
--- a/LICENSE-binary
+++ b/LICENSE-binary
@@ -377,6 +377,8 @@ is auto-generated by `pnpm licenses list --prod`.
 ┌────────────────────────────────────┬──────────────┐
 │ Package                            │ License      │
 ├────────────────────────────────────┼──────────────┤
+│ swagger-ui-dist                    │ Apache-2.0   │
+├────────────────────────────────────┼──────────────┤
 │ typescript                         │ Apache-2.0   │
 ├────────────────────────────────────┼──────────────┤
 │ normalize-wheel-es                 │ BSD-3-Clause │
diff --git a/kyuubi-server/web-ui/package-lock.json 
b/kyuubi-server/web-ui/package-lock.json
index ed042d6da..6d8da8b23 100644
--- a/kyuubi-server/web-ui/package-lock.json
+++ b/kyuubi-server/web-ui/package-lock.json
@@ -14,6 +14,7 @@
         "element-plus": "^2.2.12",
         "pinia": "^2.0.18",
         "pinia-plugin-persistedstate": "^2.1.1",
+        "swagger-ui-dist": "^5.6.2",
         "vue": "^3.2.37",
         "vue-i18n": "^9.2.2",
         "vue-router": "^4.1.3"
@@ -21,6 +22,7 @@
       "devDependencies": {
         "@iconify-json/ep": "^1.1.6",
         "@types/node": "^18.7.1",
+        "@types/swagger-ui-dist": "^3.30.1",
         "@typescript-eslint/eslint-plugin": "^5.33.0",
         "@typescript-eslint/parser": "^5.33.0",
         "@vitejs/plugin-vue": "^4.2.3",
@@ -741,6 +743,12 @@
       "integrity": 
"sha512-EdxgKRXgYsNITy5mjjXjVE/CS8YENSdhiagGrLqjG0pvA2owgJ6i4l7wy/PFZGC0B1/H20lWKN7ONVDNYDZm7A==",
       "dev": true
     },
+    "node_modules/@types/swagger-ui-dist": {
+      "version": "3.30.1",
+      "resolved": 
"https://registry.npmjs.org/@types/swagger-ui-dist/-/swagger-ui-dist-3.30.1.tgz";,
+      "integrity": 
"sha512-wWojDensMF33dSrhak4iWSPOsWBbvf+rSJ6VWQ7ohQbGdKAiT2IwUexrDZkMvf3+vVAPVnNFDRDtxADFszbh+Q==",
+      "dev": true
+    },
     "node_modules/@types/web-bluetooth": {
       "version": "0.0.14",
       "resolved": 
"https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.14.tgz";,
@@ -3865,6 +3873,11 @@
         "node": ">=8"
       }
     },
+    "node_modules/swagger-ui-dist": {
+      "version": "5.6.2",
+      "resolved": 
"https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-5.6.2.tgz";,
+      "integrity": 
"sha512-2LKVuU2m6RHkemJloKiKJOTpN2RPmbsiad0OfSdtmFHOXJKAgYRZMwJcpT96RX6E9HUB5RkVOFC6vWqVjRgSOg=="
+    },
     "node_modules/symbol-tree": {
       "version": "3.2.4",
       "resolved": 
"https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz";,
@@ -4959,6 +4972,12 @@
       "integrity": 
"sha512-EdxgKRXgYsNITy5mjjXjVE/CS8YENSdhiagGrLqjG0pvA2owgJ6i4l7wy/PFZGC0B1/H20lWKN7ONVDNYDZm7A==",
       "dev": true
     },
+    "@types/swagger-ui-dist": {
+      "version": "3.30.1",
+      "resolved": 
"https://registry.npmjs.org/@types/swagger-ui-dist/-/swagger-ui-dist-3.30.1.tgz";,
+      "integrity": 
"sha512-wWojDensMF33dSrhak4iWSPOsWBbvf+rSJ6VWQ7ohQbGdKAiT2IwUexrDZkMvf3+vVAPVnNFDRDtxADFszbh+Q==",
+      "dev": true
+    },
     "@types/web-bluetooth": {
       "version": "0.0.14",
       "resolved": 
"https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.14.tgz";,
@@ -7203,6 +7222,11 @@
         "has-flag": "^4.0.0"
       }
     },
+    "swagger-ui-dist": {
+      "version": "5.6.2",
+      "resolved": 
"https://registry.npmjs.org/swagger-ui-dist/-/swagger-ui-dist-5.6.2.tgz";,
+      "integrity": 
"sha512-2LKVuU2m6RHkemJloKiKJOTpN2RPmbsiad0OfSdtmFHOXJKAgYRZMwJcpT96RX6E9HUB5RkVOFC6vWqVjRgSOg=="
+    },
     "symbol-tree": {
       "version": "3.2.4",
       "resolved": 
"https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz";,
diff --git a/kyuubi-server/web-ui/package.json 
b/kyuubi-server/web-ui/package.json
index ad2e00c3b..b1f5d88fd 100644
--- a/kyuubi-server/web-ui/package.json
+++ b/kyuubi-server/web-ui/package.json
@@ -21,6 +21,7 @@
     "element-plus": "^2.2.12",
     "pinia": "^2.0.18",
     "pinia-plugin-persistedstate": "^2.1.1",
+    "swagger-ui-dist": "^4.9.1",
     "vue": "^3.2.37",
     "vue-i18n": "^9.2.2",
     "vue-router": "^4.1.3"
@@ -28,6 +29,7 @@
   "devDependencies": {
     "@iconify-json/ep": "^1.1.6",
     "@types/node": "^18.7.1",
+    "@types/swagger-ui-dist": "^3.30.1",
     "@typescript-eslint/eslint-plugin": "^5.33.0",
     "@typescript-eslint/parser": "^5.33.0",
     "@vitejs/plugin-vue": "^4.2.3",
diff --git a/kyuubi-server/web-ui/pnpm-lock.yaml 
b/kyuubi-server/web-ui/pnpm-lock.yaml
index 920182f01..83754291b 100644
--- a/kyuubi-server/web-ui/pnpm-lock.yaml
+++ b/kyuubi-server/web-ui/pnpm-lock.yaml
@@ -23,6 +23,9 @@ dependencies:
   pinia-plugin-persistedstate:
     specifier: ^2.1.1
     version: 2.1.1([email protected])
+  swagger-ui-dist:
+    specifier: ^4.9.1
+    version: 4.19.1
   vue:
     specifier: ^3.2.37
     version: 3.2.37
@@ -40,6 +43,9 @@ devDependencies:
   '@types/node':
     specifier: ^18.7.1
     version: 18.7.6
+  '@types/swagger-ui-dist':
+    specifier: ^3.30.1
+    version: 3.30.1
   '@typescript-eslint/eslint-plugin':
     specifier: ^5.33.0
     version: 
5.33.1(@typescript-eslint/[email protected])([email protected])([email protected])
@@ -531,6 +537,10 @@ packages:
     resolution: {integrity: 
sha512-EdxgKRXgYsNITy5mjjXjVE/CS8YENSdhiagGrLqjG0pvA2owgJ6i4l7wy/PFZGC0B1/H20lWKN7ONVDNYDZm7A==}
     dev: true
 
+  /@types/[email protected]:
+    resolution: {integrity: 
sha512-wWojDensMF33dSrhak4iWSPOsWBbvf+rSJ6VWQ7ohQbGdKAiT2IwUexrDZkMvf3+vVAPVnNFDRDtxADFszbh+Q==}
+    dev: true
+
   /@types/[email protected]:
     resolution: {integrity: 
sha512-5d2RhCard1nQUC3aHcq/gHzWYO6K0WJmAbjO7mQJgCQKtZpgXxv1rOM6O/dBDhDYYVutk1sciOgNSe+5YyfM8A==}
     dev: false
@@ -2466,6 +2476,10 @@ packages:
     engines: {node: '>= 0.4'}
     dev: true
 
+  /[email protected]:
+    resolution: {integrity: 
sha512-n/gFn+R7G/BXWwl5UZLw6F1YgWOlf3zkwGlsPhTMhNtAAolBGKg0JS5b2RKt5NI6/hSopVaSrki2wTIMUDDy2w==}
+    dev: false
+
   /[email protected]:
     resolution: {integrity: 
sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==}
     dev: true
diff --git a/kyuubi-server/web-ui/src/router/index.ts 
b/kyuubi-server/web-ui/src/router/index.ts
index 0b80aea17..797350bf2 100644
--- a/kyuubi-server/web-ui/src/router/index.ts
+++ b/kyuubi-server/web-ui/src/router/index.ts
@@ -22,6 +22,7 @@ import operationRoutes from './operation'
 import contactRoutes from './contact'
 import managementRoutes from './management'
 import detailRoutes from './detail'
+import swaggerRoutes from './swagger'
 
 const routes = [
   {
@@ -42,6 +43,7 @@ const routes = [
       ...operationRoutes,
       ...managementRoutes,
       ...detailRoutes,
+      ...swaggerRoutes,
       ...contactRoutes
     ]
   }
diff --git a/kyuubi-server/web-ui/src/router/index.ts 
b/kyuubi-server/web-ui/src/router/swagger/index.ts
similarity index 51%
copy from kyuubi-server/web-ui/src/router/index.ts
copy to kyuubi-server/web-ui/src/router/swagger/index.ts
index 0b80aea17..a2b5fa306 100644
--- a/kyuubi-server/web-ui/src/router/index.ts
+++ b/kyuubi-server/web-ui/src/router/swagger/index.ts
@@ -15,41 +15,12 @@
  * limitations under the License.
  */
 
-import { createRouter, createWebHistory } from 'vue-router'
-import overviewRoutes from './overview'
-import workloadRoutes from './workload'
-import operationRoutes from './operation'
-import contactRoutes from './contact'
-import managementRoutes from './management'
-import detailRoutes from './detail'
-
 const routes = [
   {
-    path: '/',
-    name: 'main',
-    redirect: {
-      name: 'layout'
-    }
-  },
-  {
-    path: '/layout',
-    name: 'layout',
-    component: () => import('@/views/layout/index.vue'),
-    redirect: 'overview',
-    children: [
-      ...overviewRoutes,
-      ...workloadRoutes,
-      ...operationRoutes,
-      ...managementRoutes,
-      ...detailRoutes,
-      ...contactRoutes
-    ]
+    path: '/swagger',
+    name: 'swagger',
+    component: () => import('@/views/swagger/index.vue')
   }
 ]
 
-const router = createRouter({
-  history: createWebHistory('/ui'),
-  routes
-})
-
-export default router
+export default routes
diff --git a/kyuubi-server/web-ui/src/views/layout/components/aside/types.ts 
b/kyuubi-server/web-ui/src/views/layout/components/aside/types.ts
index 697ee40cf..728ee326d 100644
--- a/kyuubi-server/web-ui/src/views/layout/components/aside/types.ts
+++ b/kyuubi-server/web-ui/src/views/layout/components/aside/types.ts
@@ -85,6 +85,11 @@ export const MENUS = [
       }
     ]
   },
+  {
+    label: 'Swagger',
+    icon: 'List',
+    router: '/swagger'
+  },
   {
     label: 'Contact Us',
     icon: 'PhoneFilled',
diff --git a/kyuubi-server/web-ui/src/views/swagger/index.vue 
b/kyuubi-server/web-ui/src/views/swagger/index.vue
new file mode 100644
index 000000000..7f8fb7f99
--- /dev/null
+++ b/kyuubi-server/web-ui/src/views/swagger/index.vue
@@ -0,0 +1,45 @@
+<!--
+* 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.
+-->
+
+<template>
+  <main>
+    Swagger
+    <div id="swagger-ui" class="swagger-ui"> </div>
+  </main>
+</template>
+<script lang="ts">
+  import 'swagger-ui-dist/swagger-ui.css'
+  import { SwaggerUIBundle, SwaggerUIStandalonePreset } from 'swagger-ui-dist'
+
+  export default {
+    name: 'ImportSwagger',
+    data() {
+      return {}
+    },
+    created() {},
+    mounted() {
+      SwaggerUIBundle({
+        url: '/api/openapi.json',
+        dom_id: '#swagger-ui',
+        presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],
+        layout: 'StandaloneLayout'
+      })
+    }
+  }
+</script>
+<style scoped></style>

Reply via email to