From 0a96331218a488701eea532bbbbf5774406c4134 Mon Sep 17 00:00:00 2001 From: feng <1304903146@qq.com> Date: Sun, 26 Jan 2025 16:39:32 +0800 Subject: [PATCH 1/5] perf: Push account record --- .../AccountChangeSecretRecord.vue | 11 +- .../index.vue | 5 - .../AccountChangeSecretExecutionList.vue | 2 +- .../accounts/AccountChangeSecret/index.vue | 8 + .../AccountPushRecord.vue | 140 ++++++++++++++++++ .../AccountPush/AccountPushExecutionList.vue | 2 +- src/views/accounts/AccountPush/index.vue | 8 + 7 files changed, 167 insertions(+), 9 deletions(-) create mode 100644 src/views/accounts/AccountPush/AccountPushExecutionDetail/AccountPushRecord.vue diff --git a/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionDetail/AccountChangeSecretRecord.vue b/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionDetail/AccountChangeSecretRecord.vue index 9e9624888..c22ad9ba2 100644 --- a/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionDetail/AccountChangeSecretRecord.vue +++ b/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionDetail/AccountChangeSecretRecord.vue @@ -24,17 +24,20 @@ export default { props: { object: { type: Object, - required: true, + required: false, default: () => ({}) } }, data() { const vm = this + const url = this.object.id === undefined + ? '/api/v1/accounts/change-secret-records/' + : `/api/v1/accounts/change-secret-records/?execution_id=${this.object.id}` return { secretUrl: '', showViewSecretDialog: false, tableConfig: { - url: `/api/v1/accounts/change-secret-records/?execution_id=${this.object.id}`, + url: url, columns: [ 'asset', 'account', 'date_finished', 'is_success', 'error', 'actions' ], @@ -157,6 +160,10 @@ export default { { value: 'failed', label: this.$t('Failed') + }, + { + label: this.$t('Execution'), + value: 'execution_id' } ] } diff --git a/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionDetail/index.vue b/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionDetail/index.vue index 9269d6c00..83970c2b1 100644 --- a/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionDetail/index.vue +++ b/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionDetail/index.vue @@ -32,11 +32,6 @@ export default { title: this.$t('Basic'), name: 'AccountChangeSecretExecutionInfo', hidden: () => !this.$hasPerm('accounts.view_changesecretexecution') - }, - { - title: this.$t('TaskList'), - name: 'AccountChangeSecretRecord', - hidden: () => !this.$hasPerm('accounts.view_changesecretrecord') } ], getTitle: this.getExecutionTitle diff --git a/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionList.vue b/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionList.vue index 726a7108f..01f5dfa78 100644 --- a/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionList.vue +++ b/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionList.vue @@ -35,7 +35,7 @@ export default { }, columnsMeta: { automation: { - label: this.$t('TaskID'), + label: this.$t('ExecutionID'), formatter: function(row) { return {row.automation} } diff --git a/src/views/accounts/AccountChangeSecret/index.vue b/src/views/accounts/AccountChangeSecret/index.vue index d924d6ccc..560629d53 100644 --- a/src/views/accounts/AccountChangeSecret/index.vue +++ b/src/views/accounts/AccountChangeSecret/index.vue @@ -33,6 +33,14 @@ export default { component: () => import( '@/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionList.vue' ) + }, + { + title: this.$t('RecordList'), + name: 'AccountPushRecord', + hidden: () => !this.$hasPerm('accounts.view_changesecretrecord'), + component: () => import( + '@/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionDetail/AccountChangeSecretRecord.vue' + ) } ] } diff --git a/src/views/accounts/AccountPush/AccountPushExecutionDetail/AccountPushRecord.vue b/src/views/accounts/AccountPush/AccountPushExecutionDetail/AccountPushRecord.vue new file mode 100644 index 000000000..80ef4ed0b --- /dev/null +++ b/src/views/accounts/AccountPush/AccountPushExecutionDetail/AccountPushRecord.vue @@ -0,0 +1,140 @@ + + + + + diff --git a/src/views/accounts/AccountPush/AccountPushExecutionList.vue b/src/views/accounts/AccountPush/AccountPushExecutionList.vue index 0a5ea1f15..deeb2270a 100644 --- a/src/views/accounts/AccountPush/AccountPushExecutionList.vue +++ b/src/views/accounts/AccountPush/AccountPushExecutionList.vue @@ -35,7 +35,7 @@ export default { }, columnsMeta: { automation: { - label: this.$t('TaskID'), + label: this.$t('ExecutionID'), formatter: function(row) { return {row.automation} } diff --git a/src/views/accounts/AccountPush/index.vue b/src/views/accounts/AccountPush/index.vue index e5a64bdd3..af4e0b3db 100644 --- a/src/views/accounts/AccountPush/index.vue +++ b/src/views/accounts/AccountPush/index.vue @@ -26,6 +26,14 @@ export default { name: 'AccountPushExecutionList', hidden: !this.$hasPerm('accounts.view_pushaccountexecution'), component: () => import('@/views/accounts/AccountPush/AccountPushExecutionList.vue') + }, + { + title: this.$t('RecordList'), + name: 'AccountPushRecord', + hidden: () => !this.$hasPerm('accounts.view_pushsecretrecord'), + component: () => import( + '@/views/accounts/AccountPush/AccountPushExecutionDetail/AccountPushRecord.vue' + ) } ] } From 7524b6f8957e72af47ef51172682459eb3bc1160 Mon Sep 17 00:00:00 2001 From: feng <1304903146@qq.com> Date: Sun, 26 Jan 2025 17:25:59 +0800 Subject: [PATCH 2/5] perf: change secret push account record --- src/router/pam/automations.js | 3 +-- .../AccountChangeSecretRecord.vue | 12 +--------- .../AccountChangeSecretExecutionList.vue | 21 +++++++++++------ .../accounts/AccountChangeSecret/index.vue | 2 +- .../AccountPushRecord.vue | 5 +--- .../AccountPush/AccountPushExecutionList.vue | 23 +++++++++++-------- 6 files changed, 32 insertions(+), 34 deletions(-) diff --git a/src/router/pam/automations.js b/src/router/pam/automations.js index dbe7b4ffd..6c42d6bdb 100644 --- a/src/router/pam/automations.js +++ b/src/router/pam/automations.js @@ -242,8 +242,7 @@ export default [ title: i18n.t('ExecutionDetail'), permissions: ['accounts.view_pushaccountexecution'] } - } - ] + }] }, { path: 'account-backup', diff --git a/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionDetail/AccountChangeSecretRecord.vue b/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionDetail/AccountChangeSecretRecord.vue index c22ad9ba2..ce43794df 100644 --- a/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionDetail/AccountChangeSecretRecord.vue +++ b/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionDetail/AccountChangeSecretRecord.vue @@ -21,23 +21,13 @@ export default { RecordViewSecret, GenericListTable }, - props: { - object: { - type: Object, - required: false, - default: () => ({}) - } - }, data() { const vm = this - const url = this.object.id === undefined - ? '/api/v1/accounts/change-secret-records/' - : `/api/v1/accounts/change-secret-records/?execution_id=${this.object.id}` return { secretUrl: '', showViewSecretDialog: false, tableConfig: { - url: url, + url: '/api/v1/accounts/change-secret-records/', columns: [ 'asset', 'account', 'date_finished', 'is_success', 'error', 'actions' ], diff --git a/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionList.vue b/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionList.vue index 01f5dfa78..b0dbb9a55 100644 --- a/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionList.vue +++ b/src/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionList.vue @@ -12,13 +12,6 @@ export default { components: { GenericListTable }, - props: { - object: { - type: Object, - required: false, - default: () => ({}) - } - }, data() { return { tableConfig: { @@ -105,6 +98,20 @@ export default { callback: function({ row }) { window.open(`/api/v1/accounts/change-secret-executions/${row.id}/report/`) } + }, + { + name: 'record', + title: this.$t('Record'), + can: this.$hasPerm('accounts.view_changesecretrecord'), + callback: function({ row }) { + return this.$router.push({ + name: 'AccountChangeSecretList', + query: { + tab: 'ChangeSecretRecord', + execution_id: row.id + } + }) + } } ] } diff --git a/src/views/accounts/AccountChangeSecret/index.vue b/src/views/accounts/AccountChangeSecret/index.vue index 560629d53..f5e2bc55f 100644 --- a/src/views/accounts/AccountChangeSecret/index.vue +++ b/src/views/accounts/AccountChangeSecret/index.vue @@ -36,7 +36,7 @@ export default { }, { title: this.$t('RecordList'), - name: 'AccountPushRecord', + name: 'ChangeSecretRecord', hidden: () => !this.$hasPerm('accounts.view_changesecretrecord'), component: () => import( '@/views/accounts/AccountChangeSecret/AccountChangeSecretExecution/AccountChangeSecretExecutionDetail/AccountChangeSecretRecord.vue' diff --git a/src/views/accounts/AccountPush/AccountPushExecutionDetail/AccountPushRecord.vue b/src/views/accounts/AccountPush/AccountPushExecutionDetail/AccountPushRecord.vue index 80ef4ed0b..293b93e4b 100644 --- a/src/views/accounts/AccountPush/AccountPushExecutionDetail/AccountPushRecord.vue +++ b/src/views/accounts/AccountPush/AccountPushExecutionDetail/AccountPushRecord.vue @@ -28,14 +28,11 @@ export default { } }, data() { - const url = this.object.id === undefined - ? '/api/v1/accounts/push-account-records/' - : `/api/v1/accounts/push-account-records/?execution_id=${this.object.id}` return { secretUrl: '', showViewSecretDialog: false, tableConfig: { - url: url, + url: '/api/v1/accounts/push-account-records/', columns: [ 'asset', 'account', 'date_finished', 'is_success', 'error' ], diff --git a/src/views/accounts/AccountPush/AccountPushExecutionList.vue b/src/views/accounts/AccountPush/AccountPushExecutionList.vue index deeb2270a..9f6a38dab 100644 --- a/src/views/accounts/AccountPush/AccountPushExecutionList.vue +++ b/src/views/accounts/AccountPush/AccountPushExecutionList.vue @@ -12,13 +12,6 @@ export default { components: { GenericListTable }, - props: { - object: { - type: Object, - required: false, - default: () => ({}) - } - }, data() { return { tableConfig: { @@ -91,7 +84,6 @@ export default { { name: 'detail', title: this.$t('Detail'), - type: 'info', can: this.$hasPerm('accounts.view_pushaccountexecution'), callback: function({ row }) { return this.$router.push({ name: 'AccountPushExecutionDetail', params: { id: row.id }}) @@ -100,11 +92,24 @@ export default { { name: 'report', title: this.$t('Report'), - type: 'success', can: this.$hasPerm('accounts.view_pushaccountexecution'), callback: function({ row }) { window.open(`/api/v1/accounts/push-account-executions/${row.id}/report/`) } + }, + { + name: 'record', + title: this.$t('Record'), + can: this.$hasPerm('accounts.view_pushsecretrecord'), + callback: function({ row }) { + return this.$router.push({ + name: 'AccountPushList', + query: { + tab: 'AccountPushRecord', + execution_id: row.id + } + }) + } } ] } From b12784938820e2bf87fae97b9785306df79647fe Mon Sep 17 00:00:00 2001 From: zhaojisen <1301338853@qq.com> Date: Wed, 5 Feb 2025 11:17:43 +0800 Subject: [PATCH 3/5] perf: Perf optimism build cach --- src/views/dashboard/Pam/DataSummary.vue | 4 ++-- src/views/dashboard/Pam/SummaryChart.vue | 1 + src/views/dashboard/Pam/index.vue | 3 +-- vue.config.js | 22 ++++++++++++++-------- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/views/dashboard/Pam/DataSummary.vue b/src/views/dashboard/Pam/DataSummary.vue index 8c3ececb5..8a26d5847 100644 --- a/src/views/dashboard/Pam/DataSummary.vue +++ b/src/views/dashboard/Pam/DataSummary.vue @@ -56,8 +56,8 @@ export default { 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.privilegedAccount = data.total_privileged_accounts + this.accountConfig.regularAccount = data.total_regular_accounts } } } diff --git a/src/views/dashboard/Pam/SummaryChart.vue b/src/views/dashboard/Pam/SummaryChart.vue index 8be33c3d7..ac6ec6211 100644 --- a/src/views/dashboard/Pam/SummaryChart.vue +++ b/src/views/dashboard/Pam/SummaryChart.vue @@ -91,6 +91,7 @@ $text-color: #646A73; padding: 1.25rem; background-color: #FFF; overflow: hidden; + border-radius: 0.25rem; .total-section { display: flex; diff --git a/src/views/dashboard/Pam/index.vue b/src/views/dashboard/Pam/index.vue index ebd372e2c..c85fb363c 100644 --- a/src/views/dashboard/Pam/index.vue +++ b/src/views/dashboard/Pam/index.vue @@ -67,12 +67,11 @@ export default { } .summary-container { - .account-secret-summary, .asset-proportion-summary, .risk-summary, .mission-summery { - border-radius: 0.5rem; + border-radius: 0.25rem; } .account-secret-summary, diff --git a/vue.config.js b/vue.config.js index 7465664f6..aefab7620 100644 --- a/vue.config.js +++ b/vue.config.js @@ -95,14 +95,6 @@ module.exports = { }, extensions: ['.vue', '.js', '.json'] }, - plugins: [ - new CompressionWebpackPlugin({ - algorithm: 'gzip', - test: productionGzipExtensions, // 处理所有匹配此 {RegExp} 的资源 - threshold: 10240, // 只处理比这个值大的资源。按字节计算(楼主设置10K以上进行压缩) - minRatio: 0.8 // 只有压缩率比这个值小的资源才会被处理 - }) - ] }, chainWebpack(config) { // it can improve the speed of the first screen, it is recommended to turn on preload @@ -153,6 +145,20 @@ module.exports = { config => config.devtool('cheap-source-map') ) + config + .when(process.env.NODE_ENV === 'production', config => { + config + .plugin('CompressionWebpackPlugin') + .use(CompressionWebpackPlugin, [ + { + algorithm: 'gzip', + test: productionGzipExtensions, // 处理所有匹配此 {RegExp} 的资源 + threshold: 10240, // 只处理比这个值大的资源。按字节计算(楼主设置10K以上进行压缩) + minRatio: 0.8 // 只有压缩率比这个值小的资源才会被处理 + } + ]) + }) + config .when(process.env.NODE_ENV !== 'development', config => { From f518e4cb102ffe8ca67ef998458107b8e29370ee Mon Sep 17 00:00:00 2001 From: zhaojisen <1301338853@qq.com> Date: Wed, 5 Feb 2025 11:40:34 +0800 Subject: [PATCH 4/5] Perf: Add Cache Option --- vue.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vue.config.js b/vue.config.js index aefab7620..25eaa0e31 100644 --- a/vue.config.js +++ b/vue.config.js @@ -154,7 +154,8 @@ module.exports = { algorithm: 'gzip', test: productionGzipExtensions, // 处理所有匹配此 {RegExp} 的资源 threshold: 10240, // 只处理比这个值大的资源。按字节计算(楼主设置10K以上进行压缩) - minRatio: 0.8 // 只有压缩率比这个值小的资源才会被处理 + minRatio: 0.8, // 只有压缩率比这个值小的资源才会被处理 + cache: false } ]) }) From 44e05e7f80a979900b7f759290d730ea0d570fc7 Mon Sep 17 00:00:00 2001 From: feng <1304903146@qq.com> Date: Wed, 5 Feb 2025 15:42:45 +0800 Subject: [PATCH 5/5] perf: pam dashboard --- src/views/dashboard/Pam/RiskSummary.vue | 30 ++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/views/dashboard/Pam/RiskSummary.vue b/src/views/dashboard/Pam/RiskSummary.vue index 61f31022d..709588803 100644 --- a/src/views/dashboard/Pam/RiskSummary.vue +++ b/src/views/dashboard/Pam/RiskSummary.vue @@ -39,7 +39,11 @@ export default { total_weak_password_accounts: '.', total_long_time_change_password_accounts: '.', total_leaked_password_accounts: '.', - total_repeated_password_accounts: '.' + total_repeated_password_accounts: '.', + total_password_expired_accounts: '.', + total_no_admin_account_accounts: '.', + total_password_error_accounts: '.', + total_new_found_accounts: '.' } } }, @@ -83,16 +87,32 @@ export default { } }, { - title: 'Unmanaged' + title: this.$t('Unmanaged'), + body: { + count: this.counter.total_new_found_accounts, + disabled: true + } }, { - title: 'Password expiration' + title: this.$t('Password expiration'), + body: { + count: this.counter.total_password_expired_accounts, + disabled: true + } }, { - title: 'Wrong password' + title: this.$t('Error password'), + body: { + count: this.counter.total_password_error_accounts, + disabled: true + } }, { - title: 'No admin' + title: this.$t('No admin'), + body: { + count: this.counter.total_no_admin_account_accounts, + disabled: true + } } ] }