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 28a0bcc72 [KYUUBI #5463] [UI] Adjust the file directory structure
28a0bcc72 is described below
commit 28a0bcc72975fb91ed9acef63d35f4b168e39197
Author: labbomb <[email protected]>
AuthorDate: Wed Oct 18 20:26:45 2023 +0800
[KYUUBI #5463] [UI] Adjust the file directory structure
### _Why are the changes needed?_
1. Some of the code was duplicated, so it was removed.
2. The current front-end directory is not very reasonable, and some common
methods and layout structures are placed under views, which can look strange,
so I adjusted the directory structure to make it reasonable
### _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
<img width="1674" alt="image"
src="https://github.com/apache/kyuubi/assets/15062456/e4a66198-cbaa-48b4-9055-4d36399ea228">
- [ ] [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 #5463 from labbomb/dev.
Closes #5463
a1ca90a8b [labbomb] fix: fix test error
b1a73c090 [labbomb] Merge branch 'dev' of github.com:labbomb/kyuubi into dev
f91b7d08c [labbomb] feat: adjust the file directory structure
Authored-by: labbomb <[email protected]>
Signed-off-by: Cheng Pan <[email protected]>
(cherry picked from commit c5fed9f2e1368e7f4046c4f1f71a9e19ea8611c0)
Signed-off-by: Cheng Pan <[email protected]>
---
.../src/{ => assets}/styles/element/index.scss | 0
.../web-ui/src/{ => assets}/styles/index.scss | 0
kyuubi-server/web-ui/src/components/menu/index.vue | 2 +-
.../{views => }/layout/components/aside/index.vue | 0
.../{views => }/layout/components/aside/types.ts | 0
.../{views => }/layout/components/header/index.vue | 0
.../{views => }/layout/components/header/types.ts | 0
.../layout/components/header/use-locales.ts | 0
.../web-ui/src/{views => }/layout/index.vue | 0
kyuubi-server/web-ui/src/main.ts | 4 +--
kyuubi-server/web-ui/src/pinia/modules/layout.ts | 32 ----------------------
kyuubi-server/web-ui/src/router/index.ts | 2 +-
.../src/test/unit/views/layout/aside.spec.ts | 2 +-
.../src/test/unit/views/layout/header.spec.ts | 2 +-
.../src/test/unit/views/layout/layout.spec.ts | 2 +-
.../src/{views/common => utils}/use-table.ts | 0
.../web-ui/src/views/detail/session/index.vue | 2 +-
.../web-ui/src/views/management/engine/index.vue | 2 +-
.../src/views/management/operation/index.vue | 2 +-
.../web-ui/src/views/management/server/index.vue | 2 +-
.../web-ui/src/views/management/session/index.vue | 2 +-
21 files changed, 12 insertions(+), 44 deletions(-)
diff --git a/kyuubi-server/web-ui/src/styles/element/index.scss
b/kyuubi-server/web-ui/src/assets/styles/element/index.scss
similarity index 100%
rename from kyuubi-server/web-ui/src/styles/element/index.scss
rename to kyuubi-server/web-ui/src/assets/styles/element/index.scss
diff --git a/kyuubi-server/web-ui/src/styles/index.scss
b/kyuubi-server/web-ui/src/assets/styles/index.scss
similarity index 100%
rename from kyuubi-server/web-ui/src/styles/index.scss
rename to kyuubi-server/web-ui/src/assets/styles/index.scss
diff --git a/kyuubi-server/web-ui/src/components/menu/index.vue
b/kyuubi-server/web-ui/src/components/menu/index.vue
index d6d4d1b56..41a641273 100644
--- a/kyuubi-server/web-ui/src/components/menu/index.vue
+++ b/kyuubi-server/web-ui/src/components/menu/index.vue
@@ -22,7 +22,7 @@
:collapse="isCollapse"
:default-active="activePath"
:router="true">
- <template v-for="(menu, index) in menus">
+ <template v-for="(menu, index) in (menus as any)">
<el-menu-item
v-if="!menu.children || menu.children.length === 0"
:key="index + '-1'"
diff --git a/kyuubi-server/web-ui/src/views/layout/components/aside/index.vue
b/kyuubi-server/web-ui/src/layout/components/aside/index.vue
similarity index 100%
rename from kyuubi-server/web-ui/src/views/layout/components/aside/index.vue
rename to kyuubi-server/web-ui/src/layout/components/aside/index.vue
diff --git a/kyuubi-server/web-ui/src/views/layout/components/aside/types.ts
b/kyuubi-server/web-ui/src/layout/components/aside/types.ts
similarity index 100%
rename from kyuubi-server/web-ui/src/views/layout/components/aside/types.ts
rename to kyuubi-server/web-ui/src/layout/components/aside/types.ts
diff --git a/kyuubi-server/web-ui/src/views/layout/components/header/index.vue
b/kyuubi-server/web-ui/src/layout/components/header/index.vue
similarity index 100%
rename from kyuubi-server/web-ui/src/views/layout/components/header/index.vue
rename to kyuubi-server/web-ui/src/layout/components/header/index.vue
diff --git a/kyuubi-server/web-ui/src/views/layout/components/header/types.ts
b/kyuubi-server/web-ui/src/layout/components/header/types.ts
similarity index 100%
rename from kyuubi-server/web-ui/src/views/layout/components/header/types.ts
rename to kyuubi-server/web-ui/src/layout/components/header/types.ts
diff --git
a/kyuubi-server/web-ui/src/views/layout/components/header/use-locales.ts
b/kyuubi-server/web-ui/src/layout/components/header/use-locales.ts
similarity index 100%
rename from
kyuubi-server/web-ui/src/views/layout/components/header/use-locales.ts
rename to kyuubi-server/web-ui/src/layout/components/header/use-locales.ts
diff --git a/kyuubi-server/web-ui/src/views/layout/index.vue
b/kyuubi-server/web-ui/src/layout/index.vue
similarity index 100%
rename from kyuubi-server/web-ui/src/views/layout/index.vue
rename to kyuubi-server/web-ui/src/layout/index.vue
diff --git a/kyuubi-server/web-ui/src/main.ts b/kyuubi-server/web-ui/src/main.ts
index 7554bc417..7e7d4d354 100644
--- a/kyuubi-server/web-ui/src/main.ts
+++ b/kyuubi-server/web-ui/src/main.ts
@@ -20,8 +20,8 @@ import router from '@/router'
import { store } from '@/pinia'
import i18n from '@/locales'
import ElementPlus from 'element-plus'
-import '@/styles/element/index.scss'
-import './styles/index.scss'
+import '@/assets/styles/element/index.scss'
+import '@/assets/styles/index.scss'
import App from './App.vue'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
diff --git a/kyuubi-server/web-ui/src/pinia/modules/layout.ts
b/kyuubi-server/web-ui/src/pinia/modules/layout.ts
deleted file mode 100644
index b8743a86e..000000000
--- a/kyuubi-server/web-ui/src/pinia/modules/layout.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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 { defineStore } from 'pinia'
-import { ref } from 'vue'
-
-export const useStore = defineStore('aside', () => {
- const isCollapse = ref(false)
-
- function changeCollapse() {
- isCollapse.value = !isCollapse.value
- }
-
- return {
- isCollapse,
- changeCollapse
- }
-})
diff --git a/kyuubi-server/web-ui/src/router/index.ts
b/kyuubi-server/web-ui/src/router/index.ts
index 797350bf2..423715661 100644
--- a/kyuubi-server/web-ui/src/router/index.ts
+++ b/kyuubi-server/web-ui/src/router/index.ts
@@ -35,7 +35,7 @@ const routes = [
{
path: '/layout',
name: 'layout',
- component: () => import('@/views/layout/index.vue'),
+ component: () => import('@/layout/index.vue'),
redirect: 'overview',
children: [
...overviewRoutes,
diff --git a/kyuubi-server/web-ui/src/test/unit/views/layout/aside.spec.ts
b/kyuubi-server/web-ui/src/test/unit/views/layout/aside.spec.ts
index 788ccee0c..3e31535ae 100644
--- a/kyuubi-server/web-ui/src/test/unit/views/layout/aside.spec.ts
+++ b/kyuubi-server/web-ui/src/test/unit/views/layout/aside.spec.ts
@@ -16,7 +16,7 @@
*/
import { mount } from '@vue/test-utils'
-import Aside from '@/views/layout/components/aside/index.vue'
+import Aside from '@/layout/components/aside/index.vue'
import { expect, test } from 'vitest'
import { getStore } from '@/test/unit/utils'
import { createRouter, createWebHistory } from 'vue-router'
diff --git a/kyuubi-server/web-ui/src/test/unit/views/layout/header.spec.ts
b/kyuubi-server/web-ui/src/test/unit/views/layout/header.spec.ts
index 0418ce739..1341258fa 100644
--- a/kyuubi-server/web-ui/src/test/unit/views/layout/header.spec.ts
+++ b/kyuubi-server/web-ui/src/test/unit/views/layout/header.spec.ts
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import Header from '@/views/layout/components/header/index.vue'
+import Header from '@/layout/components/header/index.vue'
import { expect, test } from 'vitest'
import { mount } from '@vue/test-utils'
import { createI18n, getStore } from '@/test/unit/utils'
diff --git a/kyuubi-server/web-ui/src/test/unit/views/layout/layout.spec.ts
b/kyuubi-server/web-ui/src/test/unit/views/layout/layout.spec.ts
index be742d5bf..cfbdbd711 100644
--- a/kyuubi-server/web-ui/src/test/unit/views/layout/layout.spec.ts
+++ b/kyuubi-server/web-ui/src/test/unit/views/layout/layout.spec.ts
@@ -16,7 +16,7 @@
*/
import { mount } from '@vue/test-utils'
-import Layout from '@/views/layout/index.vue'
+import Layout from '@/layout/index.vue'
import { expect, test } from 'vitest'
import { createI18n, getStore } from '@/test/unit/utils'
diff --git a/kyuubi-server/web-ui/src/views/common/use-table.ts
b/kyuubi-server/web-ui/src/utils/use-table.ts
similarity index 100%
rename from kyuubi-server/web-ui/src/views/common/use-table.ts
rename to kyuubi-server/web-ui/src/utils/use-table.ts
diff --git a/kyuubi-server/web-ui/src/views/detail/session/index.vue
b/kyuubi-server/web-ui/src/views/detail/session/index.vue
index 4a77b2a66..06626073f 100644
--- a/kyuubi-server/web-ui/src/views/detail/session/index.vue
+++ b/kyuubi-server/web-ui/src/views/detail/session/index.vue
@@ -100,7 +100,7 @@
import { useRoute } from 'vue-router'
import { format } from 'date-fns'
import { secondTransfer } from '@/utils/unit'
- import { useTable } from '@/views/common/use-table'
+ import { useTable } from '@/utils/use-table'
const route = useRoute()
const sessionProperties: Ref<any> = ref({})
const sessionPropertiesLoading = ref(false)
diff --git a/kyuubi-server/web-ui/src/views/management/engine/index.vue
b/kyuubi-server/web-ui/src/views/management/engine/index.vue
index 430482cdd..8ea305754 100644
--- a/kyuubi-server/web-ui/src/views/management/engine/index.vue
+++ b/kyuubi-server/web-ui/src/views/management/engine/index.vue
@@ -124,7 +124,7 @@
import { reactive } from 'vue'
import { getAllEngines, deleteEngine } from '@/api/engine'
import { IEngineSearch } from '@/api/engine/types'
- import { useTable } from '@/views/common/use-table'
+ import { useTable } from '@/utils/use-table'
import { ElMessage } from 'element-plus'
import { useI18n } from 'vue-i18n'
import { getEngineType, getShareLevel } from '@/utils/engine'
diff --git a/kyuubi-server/web-ui/src/views/management/operation/index.vue
b/kyuubi-server/web-ui/src/views/management/operation/index.vue
index 992257eb8..c5d673c8c 100644
--- a/kyuubi-server/web-ui/src/views/management/operation/index.vue
+++ b/kyuubi-server/web-ui/src/views/management/operation/index.vue
@@ -103,7 +103,7 @@
import { format } from 'date-fns'
import { useI18n } from 'vue-i18n'
import { ElMessage } from 'element-plus'
- import { useTable } from '@/views/common/use-table'
+ import { useTable } from '@/utils/use-table'
const { t } = useI18n()
const { tableData, loading, getList: _getList } = useTable()
diff --git a/kyuubi-server/web-ui/src/views/management/server/index.vue
b/kyuubi-server/web-ui/src/views/management/server/index.vue
index 266c833d7..1c2f7987b 100644
--- a/kyuubi-server/web-ui/src/views/management/server/index.vue
+++ b/kyuubi-server/web-ui/src/views/management/server/index.vue
@@ -35,7 +35,7 @@
<script lang="ts" setup>
import { getAllServer } from '@/api/server'
- import { useTable } from '@/views/common/use-table'
+ import { useTable } from '@/utils/use-table'
const { tableData, loading, getList: _getList } = useTable()
const getList = () => {
diff --git a/kyuubi-server/web-ui/src/views/management/session/index.vue
b/kyuubi-server/web-ui/src/views/management/session/index.vue
index 0465c1a4a..aca436da5 100644
--- a/kyuubi-server/web-ui/src/views/management/session/index.vue
+++ b/kyuubi-server/web-ui/src/views/management/session/index.vue
@@ -78,7 +78,7 @@
import { getAllSessions, deleteSession } from '@/api/session'
import { ElMessage } from 'element-plus'
import { useI18n } from 'vue-i18n'
- import { useTable } from '@/views/common/use-table'
+ import { useTable } from '@/utils/use-table'
import { Router, useRouter } from 'vue-router'
const { t } = useI18n()
const { tableData, loading, getList: _getList } = useTable()