From a23a0d0197de49a2103375231506389c931f782d Mon Sep 17 00:00:00 2001 From: ibuler Date: Fri, 11 Oct 2024 17:59:00 +0800 Subject: [PATCH] perf: update perm --- .../Apps/AccountListTable/AccountList.vue | 41 ++++- src/components/Table/AutoDataTable/index.vue | 2 + .../TableFormatters/ActionsFormatter.vue | 2 +- .../TableFormatters/PlatformFormatter.vue | 60 +++++++ .../TableFormatters/ShowKeyCopyFormatter.vue | 2 +- src/components/Table/TableFormatters/index.js | 3 + .../components/NavHeader/Organization.vue | 2 +- src/router/console/index.js | 2 +- src/router/pam/index.js | 4 +- src/store/modules/users.js | 1 + src/utils/jms.js | 22 ++- src/utils/startup.js | 2 +- .../Asset/AssetList/components/BaseList.vue | 5 +- .../AssetList/components/PlatformDialog.vue | 28 +--- src/views/dashboard/Pam/AccountSummary.vue | 123 ++++++++++++++ .../dashboard/Pam/AssetProportionSummary.vue | 60 +++++++ src/views/dashboard/Pam/DataSummary.vue | 104 ++++++++++++ src/views/dashboard/Pam/RankSummary.vue | 64 ++++++++ src/views/dashboard/Pam/RiskSummary.vue | 123 ++++++++++++++ src/views/dashboard/Pam/SummaryChart.vue | 124 ++++++++++++++ src/views/dashboard/Pam/UserAssetActivity.vue | 74 +++++++++ src/views/dashboard/Pam/index.vue | 53 ++++++ src/views/pam/Account/AccountList.vue | 154 +++++++++++------- src/views/pam/Account/AssetList.vue | 24 +++ src/views/pam/Account/index.vue | 49 ++++++ 25 files changed, 1031 insertions(+), 97 deletions(-) create mode 100644 src/components/Table/TableFormatters/PlatformFormatter.vue create mode 100644 src/views/dashboard/Pam/AccountSummary.vue create mode 100644 src/views/dashboard/Pam/AssetProportionSummary.vue create mode 100644 src/views/dashboard/Pam/DataSummary.vue create mode 100644 src/views/dashboard/Pam/RankSummary.vue create mode 100644 src/views/dashboard/Pam/RiskSummary.vue create mode 100644 src/views/dashboard/Pam/SummaryChart.vue create mode 100644 src/views/dashboard/Pam/UserAssetActivity.vue create mode 100644 src/views/dashboard/Pam/index.vue create mode 100644 src/views/pam/Account/AssetList.vue create mode 100644 src/views/pam/Account/index.vue diff --git a/src/components/Apps/AccountListTable/AccountList.vue b/src/components/Apps/AccountListTable/AccountList.vue index f5e834739..cbba1f9fc 100644 --- a/src/components/Apps/AccountListTable/AccountList.vue +++ b/src/components/Apps/AccountListTable/AccountList.vue @@ -49,7 +49,7 @@ + + diff --git a/src/components/Table/TableFormatters/ShowKeyCopyFormatter.vue b/src/components/Table/TableFormatters/ShowKeyCopyFormatter.vue index f4d1656ef..84e62c920 100644 --- a/src/components/Table/TableFormatters/ShowKeyCopyFormatter.vue +++ b/src/components/Table/TableFormatters/ShowKeyCopyFormatter.vue @@ -23,8 +23,8 @@ v-if="item.has" :key="index" :content="item.tooltip" + :open-delay="500" effect="dark" - open-delay="500" placement="top" > diff --git a/src/components/Table/TableFormatters/index.js b/src/components/Table/TableFormatters/index.js index b3782104d..9032d53d4 100644 --- a/src/components/Table/TableFormatters/index.js +++ b/src/components/Table/TableFormatters/index.js @@ -18,6 +18,7 @@ import ProtocolsFormatter from './ProtocolsFormatter.vue' import TagChoicesFormatter from './TagChoicesFormatter.vue' import SwitchFormatter from './SwitchFormatter.vue' import AccountInfoFormatter from './AccountInfoFormatter.vue' +import PlatformFormatter from './PlatformFormatter.vue' export default { DetailFormatter, @@ -39,6 +40,7 @@ export default { TagChoicesFormatter, LabelsFormatter, SwitchFormatter, + PlatformFormatter, AccountInfoFormatter } @@ -62,5 +64,6 @@ export { TagChoicesFormatter, LabelsFormatter, SwitchFormatter, + PlatformFormatter, AccountInfoFormatter } diff --git a/src/layout/components/NavHeader/Organization.vue b/src/layout/components/NavHeader/Organization.vue index ada5512a0..7e00f82b0 100644 --- a/src/layout/components/NavHeader/Organization.vue +++ b/src/layout/components/NavHeader/Organization.vue @@ -82,7 +82,7 @@ export default { ] } const hasPerms = this.$hasPerm('orgs.view_organization | orgs.add_organization') - const isConsole = this.currentViewRoute.name === 'console' + const isConsole = ['console'].includes(this.currentViewRoute.name) return hasPerms && isConsole ? orgActions : {} }, orgChoicesGroup() { diff --git a/src/router/console/index.js b/src/router/console/index.js index 4c50cd610..bbccc7183 100644 --- a/src/router/console/index.js +++ b/src/router/console/index.js @@ -27,7 +27,7 @@ export default { children: [ { path: '/console/dashboard', - component: () => import('@/views/dashboard/Console/index'), + component: () => import('@/views/dashboard/Console/index.vue'), name: 'AdminDashboard', meta: { icon: 'dashboard', diff --git a/src/router/pam/index.js b/src/router/pam/index.js index c23632a85..55d7eb0a5 100644 --- a/src/router/pam/index.js +++ b/src/router/pam/index.js @@ -23,7 +23,7 @@ export default { children: [ { path: '/pam/dashboard', - component: () => import('@/views/dashboard/Audit/index'), + component: () => import('@/views/dashboard/Pam/index'), name: 'PamDashboard', meta: { icon: 'dashboard', @@ -34,7 +34,7 @@ export default { { path: '/pam/accounts', name: 'PamAccounts', - component: () => import('@/views/pam/Account/AccountList.vue'), + component: () => import('@/views/pam/Account/index.vue'), meta: { title: i18n.t('Accounts'), icon: 'accounts', diff --git a/src/store/modules/users.js b/src/store/modules/users.js index af0871a61..d42e30518 100644 --- a/src/store/modules/users.js +++ b/src/store/modules/users.js @@ -188,6 +188,7 @@ const actions = { commit('SET_MFA_VERIFY') }, changeToView({ commit }, viewName) { + console.log('Change to view') const mapper = { console: state.consoleOrgs, audit: state.auditOrgs, diff --git a/src/utils/jms.js b/src/utils/jms.js index 9cb63fe4b..d2a32ebab 100644 --- a/src/utils/jms.js +++ b/src/utils/jms.js @@ -96,7 +96,8 @@ export function getPermedViews() { ['audit', store.getters.auditOrgs.length > 0], ['workbench', true], ['tickets', hasPermission('tickets.view_ticket')], - ['settings', hasPermission('settings.view_setting')] + ['settings', hasPermission('settings.view_setting')], + ['pam', store.getters.consoleOrgs.length > 0] ] return viewShowMapper.filter(i => i[1]).map(i => i[0]) } @@ -155,3 +156,22 @@ export function IsSupportPauseSessionType(terminalType) { const supportedType = ['koko', 'lion', 'chen', 'kael'] return supportedType.includes(terminalType) } + +export function loadPlatformIcon(name, type) { + const platformMap = { + 'Huawei': 'huawei', + 'Cisco': 'cisco', + 'Gateway': 'gateway', + 'macOS': 'macos', + 'BSD': 'bsd', + 'Vmware-vSphere': 'vmware' + } + + const value = platformMap[name] || type + + try { + return require(`@/assets/img/icons/${value}.png`) + } catch (error) { + return require(`@/assets/img/icons/other.png`) + } +} diff --git a/src/utils/startup.js b/src/utils/startup.js index a5e368a02..668bd172d 100644 --- a/src/utils/startup.js +++ b/src/utils/startup.js @@ -131,7 +131,7 @@ export async function checkUserFirstLogin({ to, from, next }) { export async function changeCurrentViewIfNeed({ to, from, next }) { let viewName = to.path.split('/')[1] // 这几个是需要检测的, 切换视图组织时,避免 404, 这里不能加 settings, 因为 默认没有返回 setting 组织(System) 的管理权限 - if (['console', 'audit', 'workbench', 'tickets', ''].indexOf(viewName) === -1) { + if (['console', 'audit', 'workbench', 'tickets', 'pam', ''].indexOf(viewName) === -1) { Vue.$log.debug('Current view no need check', viewName) return } diff --git a/src/views/assets/Asset/AssetList/components/BaseList.vue b/src/views/assets/Asset/AssetList/components/BaseList.vue index c480425d3..f252838a3 100644 --- a/src/views/assets/Asset/AssetList/components/BaseList.vue +++ b/src/views/assets/Asset/AssetList/components/BaseList.vue @@ -23,7 +23,7 @@ + + diff --git a/src/views/dashboard/Pam/AssetProportionSummary.vue b/src/views/dashboard/Pam/AssetProportionSummary.vue new file mode 100644 index 000000000..fbee35614 --- /dev/null +++ b/src/views/dashboard/Pam/AssetProportionSummary.vue @@ -0,0 +1,60 @@ +