Merge branch 'v3' of github.com:jumpserver/lina into v3

This commit is contained in:
Bai
2022-11-30 15:10:08 +08:00
15 changed files with 116 additions and 42 deletions

View File

@@ -596,6 +596,23 @@
"CurrentConnections": "Current connections",
"TodayFailedConnections": "Connections failed today",
"OnlineSessions": "Online sessions",
"RealTimeData": "Real-time data",
"UserAssetActivity": "User/Asset activity",
"UserData": "User data",
"LoginUserToday": "Login user today",
"AssetData": "Asset data",
"LoginAssetToday": "Active assets today",
"WeekAdd": "New this week",
"ProportionOfAssetTypes": "Proportion of asset types",
"Proportion": "Proportion",
"LoginUserRanking": "Login user ranking",
"ActiveAssetRanking": "Active asset ranking",
"AssetName": "Asset name",
"NumberOfVisits": "Number of visits",
"ranking": "Ranking",
"Today": "Today",
"Last7Days": "Last 7 days",
"Last30Days": "Last30 days",
"OnlineUsers": "Online users",
"ConnectUsers": "Connect users",
"TimesWeekUnit": "times/week",

View File

@@ -607,6 +607,23 @@
"CurrentConnections": "現在の接続数",
"TodayFailedConnections": "今日の接続に失敗しました",
"OnlineSessions": "オンラインセッション",
"RealTimeData": "リアルタイムデータ",
"UserAssetActivity": "ユーザー/資産のアクティブ化",
"UserData": "ユーザデータ",
"LoginUserToday": "今日のログインユーザー数",
"AssetData": "資産データ",
"LoginAssetToday": "今日のアクティブ資産数",
"WeekAdd": "今週の追加",
"ProportionOfAssetTypes": "資産タイプの割合",
"Proportion": "占有率",
"LoginUserRanking": "ログインユーザーランキング",
"ActiveAssetRanking": "アクティブ資産ランキング",
"AssetName": "資産名",
"NumberOfVisits": "アクセス回数",
"ranking": "ランキング",
"Today": "今日",
"Last7Days": "7日",
"Last30Days": "30日",
"OnlineUsers": "オンラインユーザー",
"ConnectUsers": "ユーザーの接続",
"TimesWeekUnit": "回/週",

View File

@@ -628,6 +628,23 @@
"CurrentConnections": "当前连接数",
"TodayFailedConnections": "今日连接失败数",
"OnlineSessions": "在线会话数",
"RealTimeData": "实时数据",
"UserAssetActivity": "用户/资产活跃情况",
"UserData": "用户数据",
"LoginUserToday": "今日登录用户数",
"AssetData": "资产数据",
"LoginAssetToday": "今日活跃资产数",
"WeekAdd": "本周新增",
"ProportionOfAssetTypes": "资产类型占比",
"Proportion": "占比",
"LoginUserRanking": "登录用户排名",
"ActiveAssetRanking": "活跃资产排名",
"AssetName": "资产名称",
"NumberOfVisits": "访问次数",
"ranking": "排名",
"Today": "今天",
"Last7Days": "近7天",
"Last30Days": "近30天",
"OnlineUsers": "在线用户",
"ConnectUsers": "连接用户",
"TimesWeekUnit": "次/周",

View File

@@ -30,6 +30,7 @@
<el-menu
class="left-menu"
:default-active="activeMenu"
:default-openeds="defaultOpensMenu"
:collapse="isCollapse"
:background-color="variables['menuBg']"
:text-color="variables['menuText']"
@@ -73,6 +74,7 @@ export default {
computed: {
...mapGetters([
'currentViewRoute',
'defaultOpensMenu',
'sidebar'
]),
activeMenu() {
@@ -146,13 +148,17 @@ export default {
.switch-view {
position: absolute;
top: 50%;
right: 0;
right: 16px;
transform: translateY(-50%);
z-index: 1;
padding: 3px;
line-height: 10px;
border-radius: 3px;
&:hover {
color: var(--color-primary);
background: var(--menu-hover)!important;
}
.icon {
margin-right: 0!important;
&:hover {
color: var(--color-primary);
}

View File

@@ -1,5 +1,6 @@
const getters = {
sidebar: state => state.app.sidebar,
defaultOpensMenu: state => state.app.defaultOpensMenu,
device: state => state.app.device,
inited: state => state.app.inited,
isMobile: state => state.app.device === 'mobile',

View File

@@ -5,6 +5,8 @@ const state = {
opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true,
withoutAnimation: false
},
// 默认需要展开的菜单
defaultOpensMenu: ['/audit/sessions', '/audit/logs', '/workbench/ops'],
device: 'desktop',
inited: false
}

View File

@@ -18,8 +18,8 @@ export default {
data() {
return {
titleConfig: {
title: '资产类型占比',
tip: '资产类型占比'
title: this.$t('dashboard.ProportionOfAssetTypes'),
tip: this.$t('dashboard.ProportionOfAssetTypes')
},
config: {
data: []

View File

@@ -26,19 +26,19 @@ export default {
return {
userConfig: {
title: '用户数据',
tip: '用户数据',
subTitle: '用户总数',
title: this.$t('dashboard.UserData'),
tip: this.$t('dashboard.UserData'),
subTitle: this.$t('dashboard.UsersTotal'),
color: '#FFD260',
chartTitle: '今日登录用户数',
chartTitle: this.$t('dashboard.LoginUserToday'),
data: []
},
assetConfig: {
title: '资产数据',
tip: '资产数据',
subTitle: '资产总数',
title: this.$t('dashboard.AssetData'),
tip: this.$t('dashboard.AssetData'),
subTitle: this.$t('dashboard.AssetsTotal'),
color: themeColor,
chartTitle: '今日活跃资产数',
chartTitle: this.$t('dashboard.LoginAssetToday'),
data: []
}
}
@@ -57,15 +57,15 @@ export default {
`)
const users = [
{ name: this.$t('dashboard.ActiveUser'), value: data.total_count_users },
{ name: this.$t('dashboard.DisabledUser'), value: data.total_count_today_login_users }
{ name: this.$t('dashboard.InActiveUser'), value: data.total_count_today_login_users }
]
this.$set(this.userConfig, 'data', users)
this.$set(this.userConfig, 'total', data.total_count_users)
this.$set(this.userConfig, 'active', data.total_count_today_login_users)
this.$set(this.userConfig, 'weekAdd', data.total_count_users_this_week)
const assets = [
{ name: this.$t('dashboard.ActiveUser'), value: data.total_count_assets },
{ name: this.$t('dashboard.DisabledUser'), value: data.total_count_today_active_assets }
{ name: this.$t('dashboard.ActiveAsset'), value: data.total_count_assets },
{ name: this.$t('dashboard.InActiveAsset'), value: data.total_count_today_active_assets }
]
this.$set(this.assetConfig, 'data', assets)
this.$set(this.assetConfig, 'total', data.total_count_assets)

View File

@@ -20,34 +20,34 @@ export default {
data() {
return {
userConfig: {
title: '登录用户排名',
title: this.$t('dashboard.LoginUserRanking'),
url: '/api/v1/index/?dates_login_times_top10_users=1',
tip: '登录用户排名',
tip: this.$t('dashboard.LoginUserRanking'),
data: 'dates_login_times_top10_users',
columns: [
{
prop: 'user',
label: '用户名'
label: this.$t('users.Username')
},
{
prop: 'total',
label: '登录次数'
label: this.$t('dashboard.LoginCount')
}
]
},
assetConfig: {
title: '活跃资产排名',
title: this.$t('dashboard.ActiveAssetRanking'),
url: '/api/v1/index/?dates_login_times_top10_assets=1',
tip: '活跃资产排名',
tip: this.$t('dashboard.ActiveAssetRanking'),
data: 'dates_login_times_top10_assets',
columns: [
{
prop: 'asset',
label: '资产名称'
label: this.$t('dashboard.AssetName')
},
{
prop: 'total',
label: '访问次数'
label: this.$t('dashboard.NumberOfVisits')
}
]
}

View File

@@ -8,7 +8,7 @@
<div class="num">{{ config.total }}</div>
<div class="add">
<span class="add-num">
本周新增{{ config.weekAdd }}
{{ $tc('dashboard.WeekAdd') }}{{ config.weekAdd }}
<svg-icon icon-class="broken-line" style="font-size: 18px;" />
</span>
<span class="add-icon">

View File

@@ -19,6 +19,7 @@
// eslint-disable-next-line no-unused-vars
import * as echarts from 'echarts'
import Title from './Title.vue'
import { mix } from '@/utils/theme/color'
export default {
name: 'LoginMetric',
@@ -32,8 +33,8 @@ export default {
data: function() {
return {
config: {
title: '用户/资产活跃情况 ',
tip: '用户/资产活跃情况 '
title: this.$t('dashboard.UserAssetActivity'),
tip: this.$t('dashboard.UserAssetActivity')
},
dataUrl: '',
metricsData: {
@@ -44,14 +45,22 @@ export default {
}
},
computed: {
themeColor() {
mixColors() {
const documentStyle = document.documentElement.style
const primary = documentStyle.getPropertyValue('--color-primary')
const colorValue = primary.replace(/#/g, '')
const TwoLevelColor = mix(colorValue, 'ffffff', 38)
const ThreeLevelColor = mix(colorValue, 'ffffff', 20)
const shadowColor = mix(colorValue, 'ffffff', 1)
return {
primary: documentStyle.getPropertyValue('--color-primary')
primary,
TwoLevelColor,
ThreeLevelColor,
shadowColor
}
},
options() {
const { primary } = this.themeColor
const { primary, TwoLevelColor, ThreeLevelColor, shadowColor } = this.mixColors
return {
title: {
show: false
@@ -149,20 +158,20 @@ export default {
1,
[{
offset: 0,
color: 'rgba(50, 220, 182, 0.6)'
color: primary
}, {
offset: 0.6,
color: 'rgba(50, 220, 182, 0.2)'
color: TwoLevelColor
},
{
offset: 0.8,
color: 'rgba(50, 220, 182, 0.1)'
color: ThreeLevelColor
}
],
false
),
shadowColor: 'rgba(50, 220, 182, 0.1)',
shadowBlur: 6
shadowColor: shadowColor,
shadowBlur: 5
}
},
data: this.metricsData.dates_metrics_total_count_active_users

View File

@@ -12,6 +12,8 @@
<script>
// eslint-disable-next-line no-unused-vars
import * as echarts from 'echarts'
import { mix } from '@/utils/theme/color'
export default {
props: {
colors: {
@@ -19,8 +21,10 @@ export default {
default: () => {
const documentStyle = document.documentElement.style
const themeColor = documentStyle.getPropertyValue('--color-primary')
const colorValue = themeColor.replace(/#/g, '')
const subCOlor = mix(colorValue, 'ffffff', 40)
return [
themeColor, '#B3D6CE', '#F3B44B', 'rgba(243, 180, 75, 0.5)',
themeColor, subCOlor, '#F3B44B', 'rgba(243, 180, 75, 0.5)',
'#535C65', 'rgba(83, 92, 101, 0.5)', '#29448A', 'rgba(41, 68, 138, 0.5)'
]
}

View File

@@ -20,7 +20,7 @@
style="width: 100%"
class="table"
>
<el-table-column :label="'排名'">
<el-table-column :label="$tc('dashboard.ranking')">
<template v-slot="scope">
<span>{{ scope.$index + 1 }}</span>
</template>
@@ -55,15 +55,15 @@ export default {
data() {
const defaultOptions = [
{
label: '今天',
label: this.$t('dashboard.Today'),
value: '1'
},
{
label: '近7天',
label: this.$t('dashboard.Last7Days'),
value: '7'
},
{
label: '近30天',
label: this.$t('dashboard.Last30Days'),
value: '30'
}
]
@@ -103,6 +103,7 @@ export default {
.switch {
background: #EFF0F1;
border-radius: 4px;
padding: 0 4px;
&>>> .el-radio-button {
.el-radio-button__inner {
border: none;

View File

@@ -22,8 +22,8 @@ export default {
data() {
return {
config: {
title: '实时数据',
tip: '实时数据'
title: this.$t('dashboard.RealTimeData'),
tip: this.$t('dashboard.RealTimeData')
},
counter: {
total_count_online_sessions: '.',

View File

@@ -51,7 +51,7 @@ export default {
fontSize: 24,
color: '#646A73'
},
subtext: '占比' + percentage + '%',
subtext: this.$t('dashboard.Proportion') + percentage + '%',
subtextStyle: {
fontSize: 12,
color: '#646A73'