From c932fbb5f3cad35abc4d04beb2a5bda2e3328754 Mon Sep 17 00:00:00 2001 From: feng <1304903146@qq.com> Date: Tue, 11 Feb 2025 18:17:56 +0800 Subject: [PATCH 1/3] perf: Pam dashboard --- .../dashboard/ChangeSecret/AccountSummary.vue | 8 +- .../dashboard/ChangeSecret/CardSummary.vue | 26 ++-- .../dashboard/ChangeSecret/DataSummary.vue | 10 +- .../ChangeSecret/FailedAccountSummary.vue | 2 +- .../dashboard/Pam/AssetProportionSummary.vue | 2 +- src/views/dashboard/Pam/DataSummary.vue | 14 +- src/views/dashboard/Pam/MissionSummery.vue | 40 +++--- src/views/dashboard/Pam/RiskSummary.vue | 126 +++++++++++------- src/views/dashboard/Pam/SummaryChart.vue | 20 ++- 9 files changed, 135 insertions(+), 113 deletions(-) diff --git a/src/views/dashboard/ChangeSecret/AccountSummary.vue b/src/views/dashboard/ChangeSecret/AccountSummary.vue index 9d1d21433..960057958 100644 --- a/src/views/dashboard/ChangeSecret/AccountSummary.vue +++ b/src/views/dashboard/ChangeSecret/AccountSummary.vue @@ -26,15 +26,15 @@ export default { return { loading: false, config: { - title: '账号成功/失败情况', - tip: '账号成功/失败情况' + title: this.$t('AccountResult'), + tip: this.$t('AccountResult') }, lineChartConfig: { datesMetrics: [], primaryData: [1], - primaryName: '成功', + primaryName: this.$t('Success'), secondaryData: [1], - secondaryName: '失败' + secondaryName: this.$t('Failed') } } }, diff --git a/src/views/dashboard/ChangeSecret/CardSummary.vue b/src/views/dashboard/ChangeSecret/CardSummary.vue index d4acc5136..3f03673b3 100644 --- a/src/views/dashboard/ChangeSecret/CardSummary.vue +++ b/src/views/dashboard/ChangeSecret/CardSummary.vue @@ -26,12 +26,12 @@ export default { data() { return { logConfig: { - title: '当前状态', - tip: '当前状态' + title: this.$t('CurrentStatus'), + tip: this.$t('CurrentStatus') }, sessionConfig: { - title: '改密任务执行状态', - tip: '改密任务执行状态' + title: this.$t('ChangeSecretTaskStatus'), + tip: this.$t('ChangeSecretTaskStatus') }, data: { total_count_change_secrets: 0, @@ -47,23 +47,20 @@ export default { LogItems() { return [ { - title: '任务数', + title: this.$t('TaskCount'), body: { - route: { name: `LoginLogList` }, count: this.data.total_count_change_secrets } }, { - title: '定时任务数', + title: this.$t('ScheduledTaskCount'), body: { - route: { name: `LoginLogList` }, count: this.data.total_count_periodic_change_secrets } }, { - title: '资产数', + title: this.$t('AssetsOfNumber'), body: { - route: { name: `OperateLogList` }, count: this.data.total_count_change_secret_assets } } @@ -72,23 +69,20 @@ export default { sessionItems() { return [ { - title: '任务执行数', + title: this.$t('TaskExecutionCount'), body: { - route: { name: `SessionList`, params: { activeMenu: 'OnlineList' }}, count: this.data.total_count_change_secret_executions } }, { - title: '成功数', + title: this.$t('SuccessCount'), body: { - route: { name: `SessionList`, params: { activeMenu: 'OfflineList' }}, count: this.data.total_count_success_change_secret_executions } }, { - title: '失败数', + title: this.$t('FailCount'), body: { - route: { name: `FtpLog` }, count: this.data.total_count_failed_change_secret_executions } } diff --git a/src/views/dashboard/ChangeSecret/DataSummary.vue b/src/views/dashboard/ChangeSecret/DataSummary.vue index 04ae005a2..35b1ae4c8 100644 --- a/src/views/dashboard/ChangeSecret/DataSummary.vue +++ b/src/views/dashboard/ChangeSecret/DataSummary.vue @@ -22,8 +22,8 @@ export default { data() { return { logConfig: { - title: '当前正在改密情况', - tip: '当前正在改密情况' + title: this.$t('OngoingPwdChange'), + tip: this.$t('OngoingPwdChange') }, data: { total_count_ongoing_change_secret: 0, @@ -36,21 +36,21 @@ export default { LogItems() { return [ { - title: '任务执行数', + title: this.$t('TaskExecutionCount'), body: { route: { name: `LoginLogList` }, count: this.data.total_count_ongoing_change_secret } }, { - title: '资产数', + title: this.$t('AssetsOfNumber'), body: { route: { name: `LoginLogList` }, count: this.data.total_count_ongoing_change_secret_assets } }, { - title: '账号数', + title: this.$t('AccountAmount'), body: { route: { name: `OperateLogList` }, count: this.data.total_count_ongoing_change_secret_accounts diff --git a/src/views/dashboard/ChangeSecret/FailedAccountSummary.vue b/src/views/dashboard/ChangeSecret/FailedAccountSummary.vue index a43dcda63..cc905e43c 100644 --- a/src/views/dashboard/ChangeSecret/FailedAccountSummary.vue +++ b/src/views/dashboard/ChangeSecret/FailedAccountSummary.vue @@ -31,7 +31,7 @@ export default { return { showViewSecretDialog: false, cardConfig: { - title: '改密失败账号' + title: this.$tc('ChangeSecretFailAccounts') }, tableConfig: { url: `/api/v1/accounts/change-secret-records/dashboard/?days=${this.days}`, diff --git a/src/views/dashboard/Pam/AssetProportionSummary.vue b/src/views/dashboard/Pam/AssetProportionSummary.vue index 8c1b2d190..e1804c925 100644 --- a/src/views/dashboard/Pam/AssetProportionSummary.vue +++ b/src/views/dashboard/Pam/AssetProportionSummary.vue @@ -46,7 +46,7 @@ export default { const str = data[this.url.split('?')[1].split('=')[0]] if (this.url.includes('accounts')) { - this.titleConfig.title = this.$t('ProportionOfAccontTypes') + this.titleConfig.title = this.$t('ProportionOfAccountTypes') this.titleConfig.tip = this.$t('ProportionOfAccountTypes') } else { this.titleConfig.title = this.$t('ProportionOfAssetTypes') diff --git a/src/views/dashboard/Pam/DataSummary.vue b/src/views/dashboard/Pam/DataSummary.vue index 8a26d5847..369a74214 100644 --- a/src/views/dashboard/Pam/DataSummary.vue +++ b/src/views/dashboard/Pam/DataSummary.vue @@ -26,10 +26,10 @@ export default { route: { name: 'PamAccounts' }, total: 0, weekAdd: 0, + privileged: 0, resetSecret: 0, connectable: 0, - privilegedAccount: 0, - regularAccount: 0 + valid: 0 } } }, @@ -44,20 +44,20 @@ export default { params: { total_accounts: 1, total_week_add_accounts: 1, + total_privileged_accounts: 1, total_secret_reset_accounts: 1, - total_connectivity_ok_accounts: 1 + total_connectivity_ok_accounts: 1, + total_valid_accounts: 1 } } ) this.accountConfig.total = data.total_accounts this.accountConfig.weekAdd = data.total_week_add_accounts + this.accountConfig.privileged = data.total_privileged_accounts this.accountConfig.resetSecret = data.total_secret_reset_accounts this.accountConfig.connectable = data.total_connectivity_ok_accounts - - // TODO 额外两个字段 - this.accountConfig.privilegedAccount = data.total_privileged_accounts - this.accountConfig.regularAccount = data.total_regular_accounts + this.accountConfig.valid = data.total_valid_accounts } } } diff --git a/src/views/dashboard/Pam/MissionSummery.vue b/src/views/dashboard/Pam/MissionSummery.vue index 663c748ea..b41d4e833 100644 --- a/src/views/dashboard/Pam/MissionSummery.vue +++ b/src/views/dashboard/Pam/MissionSummery.vue @@ -25,14 +25,14 @@ export default { data() { return { config: { - title: '任务执行情况', - tip: '任务执行情况' + title: this.$t('Task Distribution'), + tip: this.$t('Task Distribution') }, counter: { - total_count_gathered_account_automation: 0, + total_count_change_secret_automation: 0, total_count_push_account_automation: 0, + total_count_gathered_account_automation: 0, total_count_backup_account_automation: 0, - total_count_risk_account: 0, total_count_integration_application: 0 }, chart: null @@ -55,11 +55,11 @@ export default { itemHeight: 8, formatter: (name) => { const data = [ - { name: '账号收集任务', value: this.counter.total_count_gathered_account_automation }, - { name: '账号推送任务', value: this.counter.total_count_push_account_automation }, - { name: '账号备份任务', value: this.counter.total_count_backup_account_automation }, - { name: '风险账号', value: this.counter.total_count_risk_account }, - { name: '集成应用', value: this.counter.total_count_integration_application } + { name: this.$t('BaseAccountChangeSecret'), value: this.counter.total_count_change_secret_automation }, + { name: this.$t('BaseAccountPush'), value: this.counter.total_count_push_account_automation }, + { name: this.$t('DiscoverAccounts'), value: this.counter.total_count_gathered_account_automation }, + { name: this.$t('AccountBackup'), value: this.counter.total_count_backup_account_automation }, + { name: this.$t('RelevantApp'), value: this.counter.total_count_integration_application } ] const item = data.find(item => item.name === name) @@ -68,7 +68,7 @@ export default { }, series: [ { - name: '任务分布', + name: this.$t('Task Distribution'), type: 'pie', radius: ['50%', '70'], center: ['25%', '50%'], @@ -80,24 +80,24 @@ export default { }, data: [ { - value: this.counter.total_count_gathered_account_automation, - name: '账号收集任务' + value: this.counter.total_count_change_secret_automation, + name: this.$t('BaseAccountChangeSecret') }, { value: this.counter.total_count_push_account_automation, - name: '账号推送任务' + name: this.$t('BaseAccountPush') + }, + { + value: this.counter.total_count_gathered_account_automation, + name: this.$t('DiscoverAccounts') }, { value: this.counter.total_count_backup_account_automation, - name: '账号备份任务' - }, - { - value: this.counter.total_count_risk_account, - name: '风险账号' + name: this.$t('AccountBackup') }, { value: this.counter.total_count_integration_application, - name: '集成应用' + name: this.$t('RelevantApp') } ], emphasis: { @@ -139,10 +139,10 @@ export default { async getResourcesCount() { return this.$axios.get('/api/v1/accounts/pam-dashboard/', { params: { + total_count_change_secret_automation: 1, total_count_gathered_account_automation: 1, total_count_push_account_automation: 1, total_count_backup_account_automation: 1, - total_count_risk_account: 1, total_count_integration_application: 1 } }) diff --git a/src/views/dashboard/Pam/RiskSummary.vue b/src/views/dashboard/Pam/RiskSummary.vue index 709588803..b7aad171f 100644 --- a/src/views/dashboard/Pam/RiskSummary.vue +++ b/src/views/dashboard/Pam/RiskSummary.vue @@ -13,11 +13,6 @@ class="metric-item" /> - @@ -35,15 +30,19 @@ export default { tip: this.$t('RealTimeData') }, counter: { - total_long_time_no_login_accounts: '.', - total_weak_password_accounts: '.', - total_long_time_change_password_accounts: '.', - total_leaked_password_accounts: '.', - total_repeated_password_accounts: '.', - total_password_expired_accounts: '.', - total_no_admin_account_accounts: '.', - total_password_error_accounts: '.', - total_new_found_accounts: '.' + 'total_long_time_no_login_accounts': '.', + 'total_new_found_accounts': '.', + 'total_group_changed_accounts': '.', + 'total_sudo_changed_accounts': '.', + 'total_authorized_keys_changed_accounts': '.', + 'total_account_deleted_accounts': '.', + 'total_password_expired_accounts': '.', + 'total_long_time_password_accounts': '.', + 'total_weak_password_accounts': '.', + 'total_leaked_password_accounts': '.', + 'total_repeated_password_accounts': '.', + 'total_password_error_accounts': '.', + 'total_no_admin_account_accounts': '.' } } }, @@ -51,9 +50,58 @@ export default { summaryItems() { return [ { - title: this.$t('LeakedPassword'), + title: this.$t('NoLoginLongTime'), body: { - count: this.counter.total_leaked_password_accounts, + count: this.counter.total_long_time_no_login_accounts, + disabled: true + } + }, + { + title: this.$t('NewAccountsFound'), + body: { + count: this.counter.total_new_found_accounts, + disabled: true + } + }, + { + title: this.$t('GroupChanged'), + body: { + count: this.counter.total_group_changed_accounts, + disabled: true + } + }, + { + title: this.$t('SudoChanged'), + body: { + count: this.counter.total_sudo_changed_accounts, + disabled: true + } + }, + { + title: this.$t('AuthorizedKeysChanged'), + body: { + count: this.counter.total_authorized_keys_changed_accounts, + disabled: true + } + }, + { + title: this.$t('AccountDeleted'), + body: { + count: this.counter.total_account_deleted_accounts, + disabled: true + } + }, + { + title: this.$t('PasswordExpired'), + body: { + count: this.counter.total_password_expired_accounts, + disabled: true + } + }, + { + title: this.$t('LongTimePassword'), + body: { + count: this.counter.total_long_time_password_accounts, disabled: true } }, @@ -65,17 +113,9 @@ export default { } }, { - title: this.$t('LongTimeNoLogin'), + title: this.$t('LeakedPassword'), body: { - route: { name: `SessionList`, params: { activeMenu: 'OnlineList' }}, - count: this.counter.total_long_time_no_login_accounts - } - }, - - { - title: this.$t('LongTimeNoChangeSecret'), - body: { - count: this.counter.total_long_time_change_password_accounts, + count: this.counter.total_leaked_password_accounts, disabled: true } }, @@ -87,28 +127,14 @@ export default { } }, { - title: this.$t('Unmanaged'), - body: { - count: this.counter.total_new_found_accounts, - disabled: true - } - }, - { - title: this.$t('Password expiration'), - body: { - count: this.counter.total_password_expired_accounts, - disabled: true - } - }, - { - title: this.$t('Error password'), + title: this.$t('PasswordError'), body: { count: this.counter.total_password_error_accounts, disabled: true } }, { - title: this.$t('No admin'), + title: this.$t('NoAdminAccount'), body: { count: this.counter.total_no_admin_account_accounts, disabled: true @@ -126,13 +152,19 @@ export default { '/api/v1/accounts/pam-dashboard/', { params: { - total_privileged_accounts: 1, - total_ordinary_accounts: 1, - total_unmanaged_accounts: 1, - total_unavailable_accounts: 1, total_long_time_no_login_accounts: 1, + total_new_found_accounts: 1, + total_group_changed_accounts: 1, + total_sudo_changed_accounts: 1, + total_authorized_keys_changed_accounts: 1, + total_account_deleted_accounts: 1, + total_password_expired_accounts: 1, + total_long_time_password_accounts: 1, total_weak_password_accounts: 1, - total_long_time_change_password_accounts: 1 + total_leaked_password_accounts: 1, + total_repeated_password_accounts: 1, + total_password_error_accounts: 1, + total_no_admin_account_accounts: 1 } } ) diff --git a/src/views/dashboard/Pam/SummaryChart.vue b/src/views/dashboard/Pam/SummaryChart.vue index ac6ec6211..934c24755 100644 --- a/src/views/dashboard/Pam/SummaryChart.vue +++ b/src/views/dashboard/Pam/SummaryChart.vue @@ -50,24 +50,20 @@ export default { return { summaryItems: [ { - label: 'Connectable', - key: 'connectable', - className: 'connection' + label: this.$t('Privileged'), + key: 'privileged' }, { - label: 'Reset secret', - key: 'resetSecret', - className: 'reset' + label: this.$t('Reset secret'), + key: 'resetSecret' }, { - label: 'Privileged Account', - key: 'privilegedAccount', - className: 'privileged' + label: this.$t('Connectable'), + key: 'connectable' }, { - label: 'Regular Account', - key: 'regularAccount', - className: 'regular' + label: this.$t('Valid'), + key: 'valid' } ] } From ee678289d4498955997bceb903aa9dfd97a3fb9d Mon Sep 17 00:00:00 2001 From: w940853815 <940853815@qq.com> Date: Tue, 11 Feb 2025 18:15:00 +0800 Subject: [PATCH 2/3] perf: Add demo code docs --- src/views/pam/Integration/SDKList.vue | 44 +++++++++++++++++++++------ 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/src/views/pam/Integration/SDKList.vue b/src/views/pam/Integration/SDKList.vue index a625a6158..bffc14a37 100644 --- a/src/views/pam/Integration/SDKList.vue +++ b/src/views/pam/Integration/SDKList.vue @@ -4,10 +4,14 @@