Skip to content

Commit 60b7e8f

Browse files
zwangshengpan3793cfmcgrady
committed
[KYUUBI apache#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 apache#5263 from zwangsheng/KYUUBI#5259. Closes apache#5259 34c8779 [zwangsheng] keep static swagger ui in kyuubi server 2efbae0 [zwangsheng] fix license 21c8cae [zwangsheng] remove dup dependence and add swagger ui into notive c1bedcb [Cheng Pan] Update kyuubi-server/web-ui/src/views/swagger/index.vue 1820420 [Fu Chen] Update kyuubi-server/web-ui/src/views/swagger/index.vue 05c3b87 [zwangsheng] fix style fc05bb8 [zwangsheng] Add License header e562520 [zwangsheng] Try 9c96800 [zwangsheng] Init swagger page Lead-authored-by: zwangsheng <binjieyang@apache.org> Co-authored-by: Cheng Pan <pan3793@gmail.com> Co-authored-by: Fu Chen <cfmcgrady@gmail.com> Signed-off-by: Cheng Pan <chengpan@apache.org>
1 parent 8c5fadf commit 60b7e8f

File tree

8 files changed

+120
-0
lines changed

8 files changed

+120
-0
lines changed

LICENSE-binary

+2
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@ is auto-generated by `pnpm licenses list --prod`.
377377
┌────────────────────────────────────┬──────────────┐
378378
│ Package │ License │
379379
├────────────────────────────────────┼──────────────┤
380+
│ swagger-ui-dist │ Apache-2.0 │
381+
├────────────────────────────────────┼──────────────┤
380382
│ typescript │ Apache-2.0 │
381383
├────────────────────────────────────┼──────────────┤
382384
│ normalize-wheel-es │ BSD-3-Clause │

kyuubi-server/web-ui/package-lock.json

+24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kyuubi-server/web-ui/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@
2121
"element-plus": "^2.2.12",
2222
"pinia": "^2.0.18",
2323
"pinia-plugin-persistedstate": "^2.1.1",
24+
"swagger-ui-dist": "^4.9.1",
2425
"vue": "^3.2.37",
2526
"vue-i18n": "^9.2.2",
2627
"vue-router": "^4.1.3"
2728
},
2829
"devDependencies": {
2930
"@iconify-json/ep": "^1.1.6",
3031
"@types/node": "^18.7.1",
32+
"@types/swagger-ui-dist": "^3.30.1",
3133
"@typescript-eslint/eslint-plugin": "^5.33.0",
3234
"@typescript-eslint/parser": "^5.33.0",
3335
"@vitejs/plugin-vue": "^4.2.3",

kyuubi-server/web-ui/pnpm-lock.yaml

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kyuubi-server/web-ui/src/router/index.ts

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import operationRoutes from './operation'
2222
import contactRoutes from './contact'
2323
import managementRoutes from './management'
2424
import detailRoutes from './detail'
25+
import swaggerRoutes from './swagger'
2526

2627
const routes = [
2728
{
@@ -42,6 +43,7 @@ const routes = [
4243
...operationRoutes,
4344
...managementRoutes,
4445
...detailRoutes,
46+
...swaggerRoutes,
4547
...contactRoutes
4648
]
4749
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
const routes = [
19+
{
20+
path: '/swagger',
21+
name: 'swagger',
22+
component: () => import('@/views/swagger/index.vue')
23+
}
24+
]
25+
26+
export default routes

kyuubi-server/web-ui/src/views/layout/components/aside/types.ts

+5
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ export const MENUS = [
8585
}
8686
]
8787
},
88+
{
89+
label: 'Swagger',
90+
icon: 'List',
91+
router: '/swagger'
92+
},
8893
{
8994
label: 'Contact Us',
9095
icon: 'PhoneFilled',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<!--
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
-->
18+
19+
<template>
20+
<main>
21+
Swagger
22+
<div id="swagger-ui" class="swagger-ui"> </div>
23+
</main>
24+
</template>
25+
<script lang="ts">
26+
import 'swagger-ui-dist/swagger-ui.css'
27+
import { SwaggerUIBundle, SwaggerUIStandalonePreset } from 'swagger-ui-dist'
28+
29+
export default {
30+
name: 'ImportSwagger',
31+
data() {
32+
return {}
33+
},
34+
created() {},
35+
mounted() {
36+
SwaggerUIBundle({
37+
url: '/api/openapi.json',
38+
dom_id: '#swagger-ui',
39+
presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],
40+
layout: 'StandaloneLayout'
41+
})
42+
}
43+
}
44+
</script>
45+
<style scoped></style>

0 commit comments

Comments
 (0)