Skip to content

Commit

Permalink
Merge pull request #10732 from zhanxu33/feature_9620_memberManage
Browse files Browse the repository at this point in the history
feat:支持管理员查看项目成员 #9620
  • Loading branch information
bkci-bot authored Aug 19, 2024
2 parents 2bf1791 + 93c57d2 commit fc94abc
Show file tree
Hide file tree
Showing 15 changed files with 416 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/frontend/bk-permission/dist/main.css

Large diffs are not rendered by default.

23 changes: 12 additions & 11 deletions src/frontend/bk-permission/dist/main.js

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions src/frontend/bk-permission/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bk-permission",
"version": "0.0.28",
"version": "0.0.30",
"description": "",
"main": "./dist/main.js",
"scripts": {
Expand Down Expand Up @@ -40,5 +40,8 @@
},
"peerDependencies": {
"vue": "^3.2.41"
},
"dependencies": {
"axios": "^1.7.2"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@
@click="handleChooseGroup(group)"
>
<span class="group-name" :title="group.name">{{ group.name }}</span>
<span class="user-num">
<img src="../../../svg/user.svg?inline" class="group-icon">
{{ group.userCount }}
</span>
<span class="group-num">
<img src="../../../svg/organization.svg?inline" class="group-icon">
{{ group.departmentCount }}
</span>
<div class="num-box">
<i :class="{
'group-icon manage-icon manage-icon-user-shape': true,
'active': activeTab === group.groupId
}" />
<div class="group-num">{{ group.userCount }}</div>
</div>
<div class="num-box">
<i :class="{
'group-icon manage-icon manage-icon-organization': true,
'active': activeTab === group.groupId
}" />
<div class="group-num">{{ group.departmentCount }}</div>
</div>
<bk-popover
v-if="resourceType === 'project'"
class="group-more-option"
Expand All @@ -31,7 +37,7 @@
:arrow="false"
offset="15"
:distance="0">
<img src="../../../svg/more.svg?inline" class="more-icon">
<i @click.stop class="more-icon manage-icon manage-icon-more-fill"></i>
<template #content>
<bk-button
class="btn"
Expand Down Expand Up @@ -292,18 +298,30 @@ export default {
case 'add_user_confirm':
this.groupList[this.curGroupIndex].departmentCount += data.data.departments.length
this.groupList[this.curGroupIndex].userCount += data.data.users.length
this.syncGroupIAM(this.groupList[this.curGroupIndex].groupId)
break;
case 'remove_user_confirm':
const departments = data.data.members.filter(i => i.type === 'department')
const users = data.data.members.filter(i => i.type === 'user')
this.groupList[this.curGroupIndex].departmentCount -= departments.length
this.groupList[this.curGroupIndex].userCount -= users.length
this.syncGroupIAM(this.groupList[this.curGroupIndex].groupId)
break;
case 'change_group_detail_tab':
this.$emit('change-group-detail-tab', data.data.tab)
}
}
},
async syncGroupIAM(groupId){
try {
await ajax.put(`${this.ajaxPrefix}/auth/api/user/auth/resource/group/sync/${this.projectCode}/${groupId}/syncGroupMember`)
} catch (error) {
Message({
theme: 'error',
message: error.message
});
}
},
},
};
</script>
Expand Down Expand Up @@ -363,9 +381,16 @@ export default {
color: #fff;
}
.group-icon {
filter: invert(100%) sepia(0%) saturate(1%) hue-rotate(151deg) brightness(104%) contrast(101%);
color: #A3C5FD;
}
}
.num-box {
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
padding-right: 10px;
}
.user-num,
.group-num {
background-color: #A3C5FD;
Expand Down Expand Up @@ -404,9 +429,9 @@ export default {
color: #3A84FF !important;
}
.group-icon {
height: 12px;
width: 12px;
filter: invert(89%) sepia(8%) saturate(136%) hue-rotate(187deg) brightness(91%) contrast(86%);
font-size: 12px;
margin-bottom: 4px;
color: #C4C6CC;
}
.line-split {
width: 80%;
Expand Down
Binary file not shown.
122 changes: 122 additions & 0 deletions src/frontend/bk-permission/src/css/fonts/iconcool.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
10 changes: 10 additions & 0 deletions src/frontend/bk-permission/src/css/iconcool.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/frontend/bk-permission/src/css/iconcool.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/frontend/bk-permission/src/css/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import url(./style.css);
112 changes: 112 additions & 0 deletions src/frontend/bk-permission/src/css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
@font-face {
font-family: "manage";
src: url("fonts/iconcool.svg#iconcool") format("svg"),
url("fonts/iconcool.ttf") format("truetype"),
url("fonts/iconcool.woff") format("woff"),
url("fonts/iconcool.eot?#iefix") format("embedded-opentype");
font-weight: normal;
font-style: normal;
}

.manage-icon {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'manage' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
text-align: center;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

.manage-icon-sync-failed:before {
content: "\e111";
}
.manage-icon-sync-success:before {
content: "\e112";
}
.manage-icon-sync-default:before {
content: "\e113";
}
.manage-icon-abnormal:before {
content: "\e115";
}
.manage-icon-sync-waiting-01:before {
content: "\e114";
}
.manage-icon-warning-2:before {
content: "\e116";
}
.manage-icon-more-fill:before {
content: "\e101";
}
.manage-icon-user-shape:before {
content: "\e102";
}
.manage-icon-add-fill:before {
content: "\e103";
}
.manage-icon-lock-radius:before {
content: "\e104";
}
.manage-icon-normal:before {
content: "\e106";
}
.manage-icon-organization:before {
content: "\e117";
}
.manage-icon-warning-circle-fill:before {
content: "\e118";
}
.manage-icon-unknown:before {
content: "\e121";
}
.manage-icon-angle-right:before {
content: "\e122";
}
.manage-icon-close:before {
content: "\e123";
}
.manage-icon-refresh:before {
content: "\e129";
}
.manage-icon-down-shape:before {
content: "\e12a";
}
.manage-icon-color-logo-pipeline:before {
content: "\e12b";
}
.manage-icon-color-logo-ticket:before {
content: "\e12d";
}
.manage-icon-color-logo-quality:before {
content: "\e131";
}
.manage-icon-color-logo-environment:before {
content: "\e12e";
}
.manage-icon-color-logo-experience:before {
content: "\e130";
}
.manage-icon-color-logo-codelib:before {
content: "\e12f";
}
.manage-icon-right-shape:before {
content: "\e138";
}
.manage-icon-arrows-right:before {
content: "\e139";
}
.manage-icon-jump:before {
content: "\e13a";
}
.manage-icon-info-line:before {
content: "\e13b";
}
.manage-icon-tishi:before {
content: "\e13c";
}
56 changes: 56 additions & 0 deletions src/frontend/bk-permission/src/i18n/en-US.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"开启权限管理": "",
"尚未开启此流水线权限管理功能": "",
"尚未开启流水线组权限管理。开启后,可以给组内流水线批量添加编辑者、执行者或查看者权限": "",
"用户组名": "",
"授权期限": "",
"自定义": "",
"到期时间": "",
"天": "",
"理由": "",
"取消": "",
"1个月": "",
"3个月": "",
"12个月": "",
"请选择申请期限": "",
"请填写申请理由": "",
"申请成功,请等待审批": "",
"用户组": "",
"添加时间": "",
"有效期": "",
"状态": "",
"操作": "",
"权限详情": "",
"申请加入": "",
"通过用户组获得权限,若需续期请联系项目管理员续期用户组": "",
"通过用户组获得权限,若需退出先联系项目管理员退出用户组": "",
"退出": "",
"确认退出用户组": "",
"退出后,将无法再使用所赋予的权限。": "",
"流水线模板管理": "",
"流水线组管理": "",
"未加入": "",
"已过期": "",
"续期": "",
"无该项目用户组管理权限": "",
"权限角色": "",
"删除": "",
"新建用户组": "",
"关闭权限管理": "",
"确认关闭【】的权限管理?": "",
"关闭流水线权限管理,将执行如下操作:": "",
"将编辑者中的用户移除": "",
"删除对应组内用户继承该组的权限": "",
"删除对应组信息和组权限": "",
"流水线组": "",
"将编辑者、执行者、查看者中的用户移除": "",
"提交后,再次开启权限管理时对应组内用户将不能恢复,请谨慎操作!": "",
"需要申请的权限": "",
"关联的资源类型": "",
"关联的资源实例": "",
"没有操作权限": "",
"去申请": "",
"权限申请单已提交": "",
"请在权限管理页填写权限申请单,提交完成后再刷新该页面": "",
"关闭": ""
}
56 changes: 56 additions & 0 deletions src/frontend/bk-permission/src/i18n/zh-CN.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"开启权限管理": "开启权限管理",
"尚未开启此流水线权限管理功能": "尚未开启此流水线权限管理功能",
"尚未开启流水线组权限管理。开启后,可以给组内流水线批量添加编辑者、执行者或查看者权限": "尚未开启流水线组权限管理。开启后,可以给组内流水线批量添加编辑者、执行者或查看者权限",
"用户组名": "用户组名",
"授权期限": "授权期限",
"自定义": "自定义",
"到期时间": "到期时间",
"天": "",
"理由": "理由",
"取消": "取消",
"1个月": "1个月",
"3个月": "3个月",
"12个月": "12个月",
"请选择申请期限": "请选择申请期限",
"请填写申请理由": "请填写申请理由",
"申请成功,请等待审批": "申请成功,请等待审批",
"用户组": "用户组",
"添加时间": "添加时间",
"有效期": "有效期",
"状态": "状态",
"操作": "操作",
"权限详情": "权限详情",
"申请加入": "申请加入",
"通过用户组获得权限,若需续期请联系项目管理员续期用户组": "通过用户组获得权限,若需续期请联系项目管理员续期用户组",
"通过用户组获得权限,若需退出先联系项目管理员退出用户组": "通过用户组获得权限,若需退出先联系项目管理员退出用户组",
"退出": "退出",
"确认退出用户组": "确认退出用户组",
"退出后,将无法再使用所赋予的权限。": "退出后,将无法再使用所赋予的权限。",
"流水线模板管理": "流水线模板管理",
"流水线组管理": "流水线组管理",
"未加入": "未加入",
"已过期": "已过期",
"续期": "续期",
"无该项目用户组管理权限": "无该项目用户组管理权限",
"权限角色": "权限角色",
"删除": "删除",
"新建用户组": "新建用户组",
"关闭权限管理": "关闭权限管理",
"确认关闭【】的权限管理?": "确认关闭【】的权限管理?",
"关闭流水线权限管理,将执行如下操作:": "关闭流水线权限管理,将执行如下操作:",
"将编辑者中的用户移除": "将编辑者中的用户移除",
"删除对应组内用户继承该组的权限": "删除对应组内用户继承该组的权限",
"删除对应组信息和组权限": "删除对应组信息和组权限",
"流水线组": "流水线组",
"将编辑者、执行者、查看者中的用户移除": "将编辑者、执行者、查看者中的用户移除",
"提交后,再次开启权限管理时对应组内用户将不能恢复,请谨慎操作!": "提交后,再次开启权限管理时对应组内用户将不能恢复,请谨慎操作!",
"需要申请的权限": "需要申请的权限",
"关联的资源类型": "关联的资源类型",
"关联的资源实例": "关联的资源实例",
"没有操作权限": "没有操作权限",
"去申请": "去申请",
"权限申请单已提交": "权限申请单已提交",
"请在权限管理页填写权限申请单,提交完成后再刷新该页面": "请在权限管理页填写权限申请单,提交完成后再刷新该页面",
"关闭": "关闭"
}
3 changes: 2 additions & 1 deletion src/frontend/bk-permission/src/main.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

import BkPermission from './components/permission-main.vue';
import PermissionDirective from './directive/authority-directive';
import { AuthorityDirectiveV3 } from './directive/authority-directive';
import handleNoPermission from './function/permission';
import { handleNoPermissionV3 } from './function/permission';
import { loadI18nMessages } from './utils/locale';
import './css/index.css';


function install (Vue, opts = {}) {
loadI18nMessages(opts.i18n)
Expand Down

0 comments on commit fc94abc

Please sign in to comment.