Skip to content

Commit 8acadf7

Browse files
committed
refactor: dashboard
1 parent ddf4f2e commit 8acadf7

File tree

7 files changed

+112
-285
lines changed

7 files changed

+112
-285
lines changed

frontend/components.d.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ declare module 'vue' {
1111
ElAvatar: typeof import('element-plus/es')['ElAvatar']
1212
ElButton: typeof import('element-plus/es')['ElButton']
1313
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
14+
ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
15+
ElCol: typeof import('element-plus/es')['ElCol']
1416
ElDialog: typeof import('element-plus/es')['ElDialog']
15-
ElDrawer: typeof import('element-plus/es')['ElDrawer']
1617
ElDropdown: typeof import('element-plus/es')['ElDropdown']
1718
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
1819
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
@@ -23,13 +24,13 @@ declare module 'vue' {
2324
ElMenu: typeof import('element-plus/es')['ElMenu']
2425
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
2526
ElOption: typeof import('element-plus/es')['ElOption']
26-
ElPagination: typeof import('element-plus/es')['ElPagination']
2727
ElRow: typeof import('element-plus/es')['ElRow']
28+
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
2829
ElSelect: typeof import('element-plus/es')['ElSelect']
29-
ElSlider: typeof import('element-plus/es')['ElSlider']
30+
ElStep: typeof import('element-plus/es')['ElStep']
31+
ElSteps: typeof import('element-plus/es')['ElSteps']
3032
ElTable: typeof import('element-plus/es')['ElTable']
3133
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
32-
ElTableV2: typeof import('element-plus/es')['ElTableV2']
3334
ElTabPane: typeof import('element-plus/es')['ElTabPane']
3435
ElTabs: typeof import('element-plus/es')['ElTabs']
3536
ElTooltip: typeof import('element-plus/es')['ElTooltip']

frontend/src/router/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import login from '@/views/login/index.vue'
55
import chat from '@/views/chat/index.vue'
66
import ds from '@/views/ds/index.vue'
77
import dashboard from '@/views/dashboard/index.vue'
8+
import DashboardEditor from '@/views/dashboard/DashboardEditor.vue'
89
import setting from '@/views/setting/index.vue'
910
import { watchRouter } from './watch'
1011
const router = createRouter({
@@ -24,7 +25,7 @@ const router = createRouter({
2425
path: 'index',
2526
name: 'chat',
2627
component: chat,
27-
meta: { title: 'Data Q&A', icon: 'chat'}
28+
meta: { title: 'Data Q&A', icon: 'chat' }
2829
}
2930
]
3031
},
@@ -55,7 +56,7 @@ const router = createRouter({
5556
{
5657
path: 'index',
5758
name: 'dashboard',
58-
component: dashboard,
59+
component: DashboardEditor,
5960
meta: { title: 'Dashboard', icon: 'dashboard' }
6061
}
6162
]
Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
import { defineStore } from 'pinia'
1+
import {defineStore} from 'pinia'
2+
import {store} from "@/stores";
23

3-
export const useDashboardStore = defineStore('dashboardStore', {
4-
state: () => {
5-
return {
6-
curComponent: null
4+
export const dashboardStore = defineStore('dashboard', {
5+
state: () => {
6+
return {
7+
curComponent: null
8+
}
9+
},
10+
getters: {
11+
getCurComponent(): any {
12+
return this.curComponent
13+
}
14+
},
15+
actions: {
16+
setCurComponent(value: any) {
17+
this.curComponent = value
18+
}
719
}
8-
},
9-
getters: {
10-
getCurComponent(): any {
11-
return this.curComponent
12-
}
13-
},
14-
actions: {
15-
setCurComponent(value: any) {
16-
this.curComponent = value
17-
}
18-
}
1920
})
21+
22+
23+
export const dashboardStoreWithOut = () => {
24+
return dashboardStore(store)
25+
}

frontend/src/stores/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import type { App } from 'vue'
2+
import { createPinia } from 'pinia'
3+
4+
const store = createPinia()
5+
6+
export const setupStore = (app: App<Element>) => {
7+
app.use(store)
8+
}
9+
10+
export { store }
File renamed without changes.

0 commit comments

Comments
 (0)