Skip to content

Commit 6f61c18

Browse files
authored
feat: application ui overview (#3237)
1 parent 25cc01d commit 6f61c18

File tree

3 files changed

+38
-31
lines changed

3 files changed

+38
-31
lines changed

ui/src/api/application/application.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ const getStatistics: (
138138
data: any,
139139
loading?: Ref<boolean>,
140140
) => Promise<Result<any>> = (application_id, data, loading) => {
141-
return get(`${prefix}/${application_id}/application-stats`, data, loading)
141+
return get(`${prefix}/${application_id}/application_stats`, data, loading)
142142
}
143143

144144
export default {

ui/src/stores/modules/user.ts

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
import {defineStore} from 'pinia'
2-
import {type Ref} from 'vue'
3-
import type {User} from '@/api/type/user'
1+
import { defineStore } from 'pinia'
2+
import { type Ref } from 'vue'
3+
import type { User } from '@/api/type/user'
44
import UserApi from '@/api/user/user'
55
import LoginApi from '@/api/user/login'
6-
import {cloneDeep} from 'lodash'
6+
import { cloneDeep } from 'lodash'
77
import ThemeApi from '@/api/systemSettings/theme'
88
// import { defaultPlatformSetting } from '@/utils/theme'
9-
import {useLocalStorage} from '@vueuse/core'
10-
import {localeConfigKey, getBrowserLang} from '@/locales/index'
9+
import { useLocalStorage } from '@vueuse/core'
10+
import { localeConfigKey, getBrowserLang } from '@/locales/index'
1111
import useThemeStore from './theme'
12-
import {useElementPlusTheme} from "use-element-plus-theme";
13-
import {defaultPlatformSetting} from "@/utils/theme.ts";
12+
import { useElementPlusTheme } from 'use-element-plus-theme'
13+
import { defaultPlatformSetting } from '@/utils/theme.ts'
1414

1515
export interface userStateTypes {
1616
userType: number // 1 系统操作者 2 对话用户
1717
userInfo: User | null
1818
version?: string
19-
XPACK_LICENSE_IS_VALID: true
20-
isXPack: true
19+
license_is_valid: boolean
20+
edition: 'CE' | 'PE' | 'EE'
2121
themeInfo: any
2222
token: any
2323
}
@@ -27,10 +27,10 @@ const useLoginStore = defineStore('user', {
2727
userType: 1, // 1 系统操作者 2 对话用户
2828
userInfo: null,
2929
version: '',
30-
XPACK_LICENSE_IS_VALID: false,
31-
isXPack: false,
30+
license_is_valid: false,
31+
edition: 'CE',
3232
themeInfo: null,
33-
token: ''
33+
token: '',
3434
}),
3535
actions: {
3636
getLanguage() {
@@ -42,7 +42,7 @@ const useLoginStore = defineStore('user', {
4242
return !this.themeInfo?.theme || this.themeInfo?.theme === '#3370FF'
4343
},
4444
setTheme(data: any) {
45-
const {changeTheme} = useElementPlusTheme(this.themeInfo?.theme)
45+
const { changeTheme } = useElementPlusTheme(this.themeInfo?.theme)
4646
changeTheme(data?.['theme'])
4747
this.themeInfo = cloneDeep(data)
4848
},
@@ -61,14 +61,15 @@ const useLoginStore = defineStore('user', {
6161
UserApi.getProfile()
6262
.then(async (ok) => {
6363
// this.version = ok.data?.version || '-'
64-
this.isXPack = true
65-
this.XPACK_LICENSE_IS_VALID = true
64+
console.log(ok)
65+
this.license_is_valid = ok.data.license_is_valid
66+
this.edition = ok.data.edition
6667

67-
if (this.isEnterprise()) {
68-
// await this.theme()
68+
if (this.isEE() || this.isPE()) {
69+
// await this.theme()
6970
} else {
7071
this.themeInfo = {
71-
...defaultPlatformSetting
72+
...defaultPlatformSetting,
7273
}
7374
}
7475
resolve(ok)
@@ -106,22 +107,28 @@ const useLoginStore = defineStore('user', {
106107
})
107108
},
108109
showXpack() {
109-
return this.isXPack
110+
return this.edition != 'CE'
111+
},
112+
isEnterprise() {
113+
return this.edition != 'CE' && !this.license_is_valid
110114
},
111-
112115
isExpire() {
113-
return this.isXPack && !this.XPACK_LICENSE_IS_VALID
116+
return this.edition != 'CE' && !this.license_is_valid
114117
},
115-
isEnterprise() {
116-
return this.isXPack && this.XPACK_LICENSE_IS_VALID
118+
isCE() {
119+
return this.edition == 'CE' && this.license_is_valid
120+
},
121+
isPE() {
122+
return this.edition == 'PE' && this.license_is_valid
123+
},
124+
isEE() {
125+
return this.edition == 'EE' && this.license_is_valid
117126
},
118-
119127
// changeUserType(num: number, token?: string) {
120128
// this.userType = num
121129
// this.userAccessToken = token
122130
// },
123131

124-
125132
async dingCallback(code: string) {
126133
return LoginApi.getDingCallback(code).then((ok) => {
127134
this.token = ok.data
@@ -184,7 +191,7 @@ const useLoginStore = defineStore('user', {
184191
reject(error)
185192
})
186193
})
187-
}
194+
},
188195
},
189196
})
190197

ui/src/views/application-overview/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,9 @@ function mapToUrlParams(map: any[]) {
424424
}
425425
426426
onMounted(() => {
427-
// getDetail()
428-
// getAccessToken()
429-
// changeDayHandle(history_day.value)
427+
getDetail()
428+
getAccessToken()
429+
changeDayHandle(history_day.value)
430430
})
431431
</script>
432432
<style lang="scss" scoped>

0 commit comments

Comments
 (0)