perf: 修改 sql query counter

This commit is contained in:
ibuler
2024-02-21 15:22:30 +08:00
parent f425da1555
commit 2f7d5336e2
6 changed files with 24 additions and 9 deletions

View File

@@ -10,8 +10,9 @@ import store from '@/store'
Vue.use(VueI18n)
const cookieLang = VueCookie.get('django_language')
const storeLang = VueCookie.get('lang')
const browserLang = navigator.systemLanguage || navigator.language
let lang = cookieLang || browserLang || 'zh'
let lang = cookieLang || storeLang || browserLang || 'zh'
lang = lang.slice(0, 2)
const i18n = new VueI18n({
locale: lang,

View File

@@ -1,5 +1,5 @@
<template>
<div class="container">
<el-alert v-show="showSqlQueryCounter" class="container" type="info" @close="handleClose">
<el-tag
v-for="item in sqlQueryCounter || []"
:key="item.url"
@@ -9,7 +9,7 @@
>
{{ item.url }}: <b>{{ item.count }}</b>
</el-tag>
</div>
</el-alert>
</template>
<script>
@@ -20,15 +20,18 @@ export default {
data() {
return {
loading: true,
licenseData: {}
licenseData: {},
show: true
}
},
computed: {
...mapGetters([
'sqlQueryCounter'
'sqlQueryCounter',
'showSqlQueryCounter'
])
},
mounted() {
console.log('showSqlQueryCounter', this.showSqlQueryCounter)
},
methods: {
getType(item) {
@@ -39,6 +42,9 @@ export default {
} else {
return 'success'
}
},
handleClose() {
this.$store.dispatch('common/showSqlQueryCounter', false)
}
}
}
@@ -49,6 +55,8 @@ export default {
padding: 5px;
width: 100%;
overflow: hidden;
background-color: #f3f3f4 !important;
border: none !important;
}
</style>

View File

@@ -58,7 +58,8 @@ export default {
meta: {
title: i18n.t('OrganizationCreate'),
action: 'create',
permissions: ['orgs.add_organization']
permissions: ['orgs.add_organization'],
activeMenu: '/settings/orgs'
}
},
{
@@ -69,7 +70,8 @@ export default {
meta: {
title: i18n.t('OrganizationUpdate'),
action: 'update',
permissions: ['orgs.change_organization']
permissions: ['orgs.change_organization'],
activeMenu: '/settings/orgs'
}
},
{

View File

@@ -30,6 +30,7 @@ const getters = {
currentUserIsAdmin: state => state.users.isAdmin,
hasValidLicense: state => state.settings.hasValidLicense,
isSystemAdmin: state => state.users.profile.system_roles.some(i => (i?.id === '00000000-0000-0000-0000-000000000001')),
sqlQueryCounter: state => state.common.sqlQueryCounter
sqlQueryCounter: state => state.common.sqlQueryCounter,
showSqlQueryCounter: state => state.common.showSqlQueryCounter
}
export default getters

View File

@@ -6,6 +6,7 @@ const getDefaultState = () => {
metaPromiseMap: {},
isRouterAlive: true,
sqlQueryCounter: [],
showSqlQueryCounter: true,
confirmDialogVisible: false
}
}
@@ -81,6 +82,9 @@ const actions = {
},
showConfirmDialog({ commit, state }, show) {
commit('setConfirmDialogVisible', show)
},
showSqlQueryCounter({ commit, state }, show) {
state.showSqlQueryCounter = show
}
}

View File

@@ -323,7 +323,6 @@ input[type=file] {
.el-button.el-button--mini, .el-button--mini.is-round {
font-size: 0.7rem;
padding: 0.2rem 0.4rem;
font-weight: 400;
}