mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-02 07:27:01 +00:00
perf: Pam dashboard
This commit is contained in:
parent
d8980e66e3
commit
29f35d590e
@ -204,13 +204,13 @@ export default {
|
||||
label: '风险账号',
|
||||
options: [
|
||||
{
|
||||
label: '僵尸账号',
|
||||
label: '长期未登录账号',
|
||||
filter: {
|
||||
risk: 'long_time_no_login'
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '幽灵账号',
|
||||
label: '未托管账号',
|
||||
filter: {
|
||||
risk: 'new_found'
|
||||
}
|
||||
|
@ -26,9 +26,10 @@ export default {
|
||||
tip: this.$t('RealTimeData')
|
||||
},
|
||||
counter: {
|
||||
total_count_online_sessions: '.',
|
||||
total_count_online_users: '.',
|
||||
total_count_today_failed_sessions: '.'
|
||||
total_privileged_accounts: '',
|
||||
total_ordinary_accounts: '',
|
||||
total_unmanaged_accounts: '',
|
||||
total_unavailable_accounts: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -39,7 +40,7 @@ export default {
|
||||
title: this.$t('特权账号'),
|
||||
body: {
|
||||
route: { name: `SessionList`, params: { activeMenu: 'OnlineList' }},
|
||||
count: 4932,
|
||||
count: this.counter.total_privileged_accounts,
|
||||
disabled: !this.$hasPerm('terminal.view_session')
|
||||
}
|
||||
},
|
||||
@ -47,21 +48,20 @@ export default {
|
||||
title: this.$t('普通账号'),
|
||||
body: {
|
||||
route: { name: `SessionList`, params: { activeMenu: 'OnlineList' }},
|
||||
count: 2323,
|
||||
disabled: !this.$hasPerm('terminal.view_session')
|
||||
count: this.counter.total_ordinary_accounts
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('未托管账号'),
|
||||
body: {
|
||||
count: 1233,
|
||||
count: this.counter.total_unmanaged_accounts,
|
||||
disabled: true
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('不可用账号'),
|
||||
body: {
|
||||
count: 123,
|
||||
count: this.counter.total_unavailable_accounts,
|
||||
disabled: true
|
||||
}
|
||||
}
|
||||
@ -74,12 +74,13 @@ export default {
|
||||
methods: {
|
||||
async getResourcesCount() {
|
||||
return this.$axios.get(
|
||||
'/api/v1/index/',
|
||||
'/api/v1/accounts/pam-dashboard/',
|
||||
{
|
||||
params: {
|
||||
total_count_online_sessions: 1,
|
||||
total_count_online_users: 1,
|
||||
total_count_today_failed_sessions: 1
|
||||
total_privileged_accounts: 1,
|
||||
total_ordinary_accounts: 1,
|
||||
total_unmanaged_accounts: 1,
|
||||
total_unavailable_accounts: 1
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div>
|
||||
<el-row :gutter="16">
|
||||
<el-col :lg="24" :sm="12">
|
||||
<SummaryChart :config="userConfig" />
|
||||
<SummaryChart :config="accountConfig" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
@ -10,41 +10,22 @@
|
||||
|
||||
<script>
|
||||
import SummaryChart from './SummaryChart.vue'
|
||||
import Decimal from 'decimal.js'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
SummaryChart
|
||||
},
|
||||
data() {
|
||||
const documentStyle = document.documentElement.style
|
||||
const themeColor = documentStyle.getPropertyValue('--color-primary')
|
||||
|
||||
return {
|
||||
userConfig: {
|
||||
accountConfig: {
|
||||
title: this.$t('账号数据'),
|
||||
tip: this.$t('UserData'),
|
||||
subTitle: this.$t('账号总数'),
|
||||
icon: 'users',
|
||||
subIcon: 'broken-line',
|
||||
color: '#FFD260',
|
||||
chartTitle: this.$t('LoginUserToday'),
|
||||
data: [],
|
||||
route: { name: 'UserList' },
|
||||
route: { name: 'PamAccounts' },
|
||||
total: 0,
|
||||
active: 0,
|
||||
weekAdd: 0
|
||||
},
|
||||
assetConfig: {
|
||||
title: this.$t('AssetData'),
|
||||
tip: this.$t('AssetData'),
|
||||
subTitle: this.$t('AssetsTotal'),
|
||||
icon: 'assets',
|
||||
subIcon: 'broken-line',
|
||||
color: themeColor,
|
||||
chartTitle: this.$t('LoginAssetToday'),
|
||||
data: [],
|
||||
route: { name: 'AssetList' }
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -53,52 +34,22 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async init() {
|
||||
const data = await this.$axios.get(`/api/v1/index/?total_count_users=1
|
||||
&total_count_users_this_week=1
|
||||
&total_count_login_users=1
|
||||
&total_count_assets=1
|
||||
&total_count_assets_this_week=1
|
||||
&total_count_today_active_assets=1
|
||||
`)
|
||||
const data = await this.$axios.get(
|
||||
'/api/v1/accounts/pam-dashboard/',
|
||||
{
|
||||
params: {
|
||||
total_accounts: 1,
|
||||
total_week_add_accounts: 1
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
const loginUserCountDecimal = data.total_count_login_users ? new Decimal(data.total_count_login_users) : new Decimal(0)
|
||||
const userCountDecimal = data.total_count_users ? new Decimal(data.total_count_users) : new Decimal(0)
|
||||
|
||||
let userActive = loginUserCountDecimal.dividedBy(userCountDecimal).times(100)
|
||||
userActive = isNaN(userActive) ? 0 : userActive
|
||||
userActive = userActive.toFixed(2)
|
||||
const userTotal = userActive === 100 ? 0 : 100 - userActive
|
||||
const users = [
|
||||
{ name: this.$t('ActiveUser'), value: userActive.toString() },
|
||||
{ name: this.$t('InActiveUser'), value: userTotal.toString() }
|
||||
]
|
||||
this.$set(this.userConfig, 'data', users)
|
||||
this.userConfig.total = data.total_count_users
|
||||
this.userConfig.active = data.total_count_login_users
|
||||
this.userConfig.weekAdd = data.total_count_users_this_week
|
||||
|
||||
const ActiveAssetCountDecimal = data.total_count_today_active_assets ? new Decimal(data.total_count_today_active_assets) : new Decimal(0)
|
||||
const AssetCountDecimal = data.total_count_assets ? new Decimal(data.total_count_assets) : new Decimal(0)
|
||||
|
||||
let assetActive = ActiveAssetCountDecimal.dividedBy(AssetCountDecimal).times(100)
|
||||
assetActive = isNaN(assetActive) ? 0 : assetActive
|
||||
assetActive = assetActive.toFixed(2)
|
||||
const assetTotal = assetActive === 100 ? 0 : 100 - assetActive
|
||||
const assets = [
|
||||
{ name: this.$t('ActiveAsset'), value: assetActive.toString() },
|
||||
{ name: this.$t('InActiveAsset'), value: assetTotal.toString() }
|
||||
]
|
||||
this.$set(this.assetConfig, 'data', assets)
|
||||
this.$set(this.assetConfig, 'total', data.total_count_assets)
|
||||
this.$set(this.assetConfig, 'active', data.total_count_today_active_assets)
|
||||
this.$set(this.assetConfig, 'weekAdd', data.total_count_assets_this_week)
|
||||
this.accountConfig.total = data.total_accounts
|
||||
this.accountConfig.weekAdd = data.total_week_add_accounts
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.left, .right {
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
|
@ -26,9 +26,9 @@ export default {
|
||||
tip: this.$t('RealTimeData')
|
||||
},
|
||||
counter: {
|
||||
total_count_online_sessions: '.',
|
||||
total_count_online_users: '.',
|
||||
total_count_today_failed_sessions: '.'
|
||||
total_long_time_no_login_accounts: '.',
|
||||
total_weak_password_accounts: '.',
|
||||
total_long_time_change_password_accounts: '.'
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -36,32 +36,23 @@ export default {
|
||||
summaryItems() {
|
||||
return [
|
||||
{
|
||||
title: this.$t('幽灵账号'),
|
||||
title: this.$t('长期未登录账号'),
|
||||
body: {
|
||||
route: { name: `SessionList`, params: { activeMenu: 'OnlineList' }},
|
||||
count: 23,
|
||||
disabled: !this.$hasPerm('terminal.view_session')
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('僵尸账号'),
|
||||
body: {
|
||||
route: { name: `SessionList`, params: { activeMenu: 'OnlineList' }},
|
||||
count: 293,
|
||||
disabled: !this.$hasPerm('terminal.view_session')
|
||||
count: this.counter.total_long_time_no_login_accounts
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('弱密码'),
|
||||
body: {
|
||||
count: 203,
|
||||
count: this.counter.total_weak_password_accounts,
|
||||
disabled: true
|
||||
}
|
||||
},
|
||||
{
|
||||
title: this.$t('长时未改密'),
|
||||
body: {
|
||||
count: 1010,
|
||||
count: this.counter.total_long_time_change_password_accounts,
|
||||
disabled: true
|
||||
}
|
||||
}
|
||||
@ -74,12 +65,16 @@ export default {
|
||||
methods: {
|
||||
async getResourcesCount() {
|
||||
return this.$axios.get(
|
||||
'/api/v1/index/',
|
||||
'/api/v1/accounts/pam-dashboard/',
|
||||
{
|
||||
params: {
|
||||
total_count_online_sessions: 1,
|
||||
total_count_online_users: 1,
|
||||
total_count_today_failed_sessions: 1
|
||||
total_privileged_accounts: 1,
|
||||
total_ordinary_accounts: 1,
|
||||
total_unmanaged_accounts: 1,
|
||||
total_unavailable_accounts: 1,
|
||||
total_long_time_no_login_accounts: 1,
|
||||
total_weak_password_accounts: 1,
|
||||
total_long_time_change_password_accounts: 1
|
||||
}
|
||||
}
|
||||
)
|
||||
|
@ -9,7 +9,7 @@
|
||||
<div>
|
||||
<template v-if="config.route">
|
||||
<router-link :to="config.route">
|
||||
<div class="num"> 1000 </div>
|
||||
<div class="num"> {{ config.total }} </div>
|
||||
</router-link>
|
||||
</template>
|
||||
<template v-else>
|
||||
|
Loading…
Reference in New Issue
Block a user