Skip to content

Commit

Permalink
perf: ROOT Org show orgs-and-roles in user-detail page
Browse files Browse the repository at this point in the history
  • Loading branch information
BaiJiangJie committed Apr 8, 2024
1 parent 19bab77 commit f42b3e9
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/Cards/DetailCard/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<IBox :fa="fa" :title="title">
<el-form class="content" label-position="left" label-width="25%">
<el-form-item v-for="item in items" :key="item.key" :label="item.key">
<el-form-item v-for="item in iItems" :key="item.key" :label="item.key">
<ItemValue :value="item.value" class="item-value" v-bind="item" />
</el-form-item>
</el-form>
Expand Down Expand Up @@ -35,6 +35,13 @@ export default {
type: String,
default: 'left'
}
},
data() {
return {
iItems: this.items.filter(item => {
return !item.hasOwnProperty('has') || item.has === true
})
}
}
}
</script>
Expand Down
1 change: 1 addition & 0 deletions src/i18n/langs/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1996,6 +1996,7 @@
"UpdateNodeAssetHardwareInfo": "Update node asset hardware information"
},
"users": {
"OrgRoleRelations": "Organizations",
"LunaSettingUpdate": "Luna setting",
"KokoSettingUpdate": "Koko setting",
"UserSetting": "User setting",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/langs/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -1987,6 +1987,7 @@
"UpdateNodeAssetHardwareInfo": "ノード資産ハードウェア情報の更新"
},
"users": {
"OrgRoleRelations": "しょぞくそしき",
"LunaSettingUpdate": "Luna 設定更新",
"KokoSettingUpdate": "Koko 設定更新",
"UserSetting": "個人設定",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/langs/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1981,6 +1981,7 @@
"PasskeyAddDisableInfo": "你的认证来源是 {source}, 不支持添加 Passkey"
},
"users": {
"OrgRoleRelations": "所属组织",
"LunaSettingUpdate": "Luna 配置设置",
"KokoSettingUpdate": "Koko 配置设置",
"UserSetting": "偏好设置",
Expand Down
18 changes: 18 additions & 0 deletions src/views/users/User/UserDetail/UserInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,24 @@ export default {
return <div>{dom}</div>
}
},
{
key: this.$t('users.OrgRoleRelations'),
has: this.$store.getters.currentOrgIsRoot,
formatter: (item, val) => {
const doms = []
const orgsRoles = this.object.orgs_roles
const allowKeyMaxLength = 50
Object.entries(orgsRoles).forEach(([key, value]) => {
let prettyKey = key
if (key.length >= allowKeyMaxLength) {
prettyKey = key.substring(0, allowKeyMaxLength - 3) + '...'
}
const domKey = <el-tag size='mini' type='success'>{prettyKey}</el-tag>
doms.push(domKey)
})
return <div>{doms}</div>
}
},
'mfa_level', 'source', 'created_by', 'date_joined', 'date_expired',
'date_password_last_updated', 'last_login', 'comment'
],
Expand Down

0 comments on commit f42b3e9

Please sign in to comment.