Skip to content

Commit

Permalink
feat:用户个人视角 权限管理优化 TencentBlueKing#11138
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 26503
  • Loading branch information
useryuyu committed Dec 11, 2024
1 parent 47b172c commit f520295
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
>
<div class="manage-content-project" v-if="projectTable.length">
<p class="project-group">
<span>{{t("流水线权限代持")}}</span>
<span>{{t("资源授权")}}</span>
<i18n-t v-overflow-title class="describe" keypath="你是以下X条流水线权限代持人,直接退出将导致流水线运行失败,需先移交" tag="div">
<span class="text-blue">{{ authorizationsLength }}</span>
</i18n-t>
Expand Down Expand Up @@ -57,7 +57,7 @@
</div>
<div class="manage-content-resource" v-if="sourceTable.length">
<p class="project-group">
<span>{{t("唯一拥有者资源")}}</span>
<span>{{t("影响流水线代持权限及唯一拥有者用户组")}}</span>
<!-- <i18n-t class="describe" keypath="你是以下X个用户组的唯一管理员,直接退出将导致对应资源无管理人,需先移交" tag="div">
<span class="text-blue">{{ 3 }}</span>
</i18n-t> -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@
<bk-button
text
theme="primary"
:disabled="row.removeMemberButtonControl != 'OTHER'"
:disabled="row.removeMemberButtonControl != 'OTHER' || row.beingHandedOver"
@click="handleRemove(row, index)"
v-bk-tooltips="{
content: TOOLTIPS_CONTENT[row.removeMemberButtonControl] || '',
disabled: row.removeMemberButtonControl === 'OTHER'
content: TOOLTIPS_CONTENT[row.removeMemberButtonControl] || t('等待审核中, 不能移出'),
disabled: row.removeMemberButtonControl === 'OTHER' && !row.beingHandedOver
}"
>
{{t("移出")}}
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/devops-permission/src/store/userGroupTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export default defineStore('userGroupTable', () => {
*/
async function handleUpDateRow(expiredAt: number) {
let paramTimestamp: number;
const isExpired = selectedRow.value!.expiredAt < Date.now() && selectedRow.value!.removeMemberButtonControl === 'OTHER'
const isExpired = selectedRow.value!.expiredAt < Date.now()
if (isExpired) {
paramTimestamp = (selectedRow.value!.expiredAt / 1000) + expiredAt * 24 * 3600
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,26 +241,37 @@
v-if="authorizationInvalid && batchFlag === 'handover'"
class="main-text"
>
<i18n-t keypath="移交以上用户组,将导致X条流水线权限代持失效。请确认是否同步移交授权。" tag="div">
<span class="remove-num">{{ authorizationInvalid }}</span>
{{ t('移交以上用户组,将导致') }}
<i18n-t v-if="checkData.invalidPipelineAuthorizationCount" keypath="X个流水线权限代持失效," tag="span">
<span class="remove-num">{{ checkData.invalidPipelineAuthorizationCount }}</span>
</i18n-t>

<i18n-t v-if="checkData.invalidRepositoryAuthorizationCount" keypath="X个代码库授权失效," tag="span">
<span class="remove-num">{{ checkData.invalidRepositoryAuthorizationCount }}</span>
</i18n-t>
{{ t('请确认是否同步移交授权。') }}
</p>

<div v-if="batchFlag === 'remove'">
<p
v-if="authorizationInvalid"
class="main-text"
>
<i18n-t keypath="退出以上用户组,将导致X条流水线权限代持失效,X个资源没有拥有者。查看详情, 请填写交接人,完成交接后才能成功退出。" tag="div">
<template #op>
<span class="remove-num">{{ authorizationInvalid }}</span>
</template>
<template #op1>
<span class="remove-num">{{ checkData.uniqueManagerCount }}</span>
</template>
<template #op2>
<span class="remove-num remove-detail" @click="handleDetail">{{ t("查看详情") }}</span>
</template>
{{ t('退出以上用户组,将导致') }}
<i18n-t v-if="checkData.invalidPipelineAuthorizationCount" keypath="X个流水线权限代持失效," tag="span">
<span class="remove-num">{{ checkData.invalidPipelineAuthorizationCount }}</span>
</i18n-t>

<i18n-t v-if="checkData.invalidRepositoryAuthorizationCount" keypath="X个代码库授权失效," tag="span">
<span class="remove-num">{{ checkData.invalidRepositoryAuthorizationCount }}</span>
</i18n-t>

<i18n-t v-if="checkData.uniqueManagerCount" keypath="X个资源没有拥有者," tag="span">
<span class="remove-num">{{ checkData.uniqueManagerCount }}</span>
</i18n-t>

<i18n-t keypath="查看详情, 请填写交接人,完成交接后才能成功退出。" tag="span">
<span class="remove-num remove-detail" @click="handleDetail">{{ t("查看详情") }}</span>
</i18n-t>
</p>
<p
Expand Down Expand Up @@ -681,7 +692,7 @@ async function batchConfirm(batchFlag) {
if (!(await handleHandoverValidation())) return;
batchBtnLoading.value = true;
res = await http.batchHandover(projectId.value, params);
if (res && authorizationInvalid.value) {
if (res) {
showHandoverSuccessInfoBox();
}
} else if (batchFlag === 'remove') {
Expand Down Expand Up @@ -749,7 +760,6 @@ function showHandoverSuccessInfoBox() {
}
function showRemoveSuccessInfoBox() {
const successRemove = checkData.value.invalidGroupCount + checkData.value.uniqueManagerCount
InfoBox({
width: 500,
type: 'success',
Expand All @@ -760,9 +770,9 @@ function showRemoveSuccessInfoBox() {
content: h(
'div', { class: 'info-content' },
[
h('p', { class: 'info-text' }, t('无需交接的X个用户组已成功退出。', [checkData.value.operableCount])),
checkData.value.operableCount && h('p', { class: 'info-text' }, t('无需交接的X个用户组已成功退出。', [checkData.value.operableCount])),
h('div', [
h('p', { class: 'info-text info-tip' }, t('需要交接的X个用户组:', [successRemove])),
h('p', { class: 'info-text info-tip' }, t('需要交接的X个用户组:', [checkData.value.canHandoverCount])),
h('p', { class: 'info-text' }, t('1. 已成功提交移交权限申请,等待交接人X确认。', [handOverForm.value.id])),
h('p', { class: 'info-text' }, t('2. 可在“我的交接”中查看进度。')),
h('p', { class: 'info-text' }, t('3. 完成交接后,将自动退出用户组')),
Expand Down
13 changes: 10 additions & 3 deletions src/frontend/locale/permission/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,16 @@
";其中X个用户组X,本次操作将忽略": "; {0} of which {1}, will be ignored in this operation",
"无法移出": "Cannot remove",
"确认退出以上X个用户组吗?": "Are you sure you want to exit the above {0} user groups?",
"移交以上用户组,将导致 {0} 条流水线权限代持失效。请确认是否同步移交授权。": "Transferring the above user group will cause the delegation of permissions for {0} pipelines to become invalid. Please confirm whether to also transfer the authorization.",
"退出以上用户组,将导致 {op} 条流水线权限代持失效,{op1} 个资源没有拥有者。{op2}, 请填写交接人,完成交接后才能成功退出。": "Exiting the above user group will cause the delegation of permissions for {op} pipelines to become invalid, and {op1} resources to have no owner. {op2}, please specify a transferee, and complete the transfer before successfully exiting.",
"移交以上用户组,将导致": "Transferring the above user group will cause",
" {0} 个流水线权限代持失效,": " {0} pipeline permissions to become invalid,",
" {0} 个代码库授权失效,": " {0} repository authorizations to become invalid,",
" {0} 个资源没有拥有者,": " {0} resources to have no owner,",
"请确认是否同步移交授权。": "Please confirm whether to also transfer the authorization.",
"退出以上用户组,将导致": "Exiting the above user group will cause",
"{0}, 请填写交接人,完成交接后才能成功退出。": "{0}, please specify a transferee, and complete the transfer before successfully exiting.",
"影响流水线代持权限及唯一拥有者用户组": "Affecting pipeline delegated permissions and sole owner user group",
"资源授权": "Resource authorization",
"等待审核中, 不能移出": "Pending approval, cannot be removed",
"确定续期": "Confirm Renewal",
"确定移交": "Confirm Transfer",
"确定退出": "Confirm Exit",
Expand Down Expand Up @@ -196,7 +204,6 @@
"你是以下X条流水线权限代持人,直接退出将导致流水线运行失败,需先移交": "You are the proxy for the following {0} pipeline permissions. Directly exiting will cause the pipeline to fail, so a transfer is required first.",
"流水线权限代持": "Pipeline Permission Proxy",
"通过组织加入的 不允许 续期/移出/移交": "Joining through the organization does not allow renewal/removal/transfer",
"唯一拥有者资源": "Sole Owner Resource",
"等待审核中": "Awaiting Review",
"批量退出操作尚未完成,确认放弃操作吗?": "The batch exit operation is not yet complete. Are you sure you want to abandon the operation?",
"直接加入": "Direct Join",
Expand Down
13 changes: 10 additions & 3 deletions src/frontend/locale/permission/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,16 @@
";其中X个用户组X,本次操作将忽略": ";其中{0}个用户组{1},本次操作将忽略",
"无法移出": "无法移出",
"确认退出以上X个用户组吗?": "确认退出以上 {0} 个用户组吗?",
"移交以上用户组,将导致X条流水线权限代持失效。请确认是否同步移交授权。": "移交以上用户组,将导致 {0} 条流水线权限代持失效。请确认是否同步移交授权。",
"退出以上用户组,将导致X条流水线权限代持失效,X个资源没有拥有者。查看详情, 请填写交接人,完成交接后才能成功退出。": "退出以上用户组,将导致 {op} 条流水线权限代持失效,{op1} 个资源没有拥有者。{op2}, 请填写交接人,完成交接后才能成功退出。",
"移交以上用户组,将导致": "移交以上用户组,将导致",
"X个流水线权限代持失效,": " {0} 个流水线权限代持失效,",
"X个代码库授权失效,": " {0} 个代码库授权失效,",
"X个资源没有拥有者,": " {0} 个资源没有拥有者,",
"请确认是否同步移交授权。": "请确认是否同步移交授权。",
"退出以上用户组,将导致": "退出以上用户组,将导致",
"查看详情, 请填写交接人,完成交接后才能成功退出。": "{0}, 请填写交接人,完成交接后才能成功退出。",
"影响流水线代持权限及唯一拥有者用户组": "影响流水线代持权限及唯一拥有者用户组",
"资源授权": "资源授权",
"等待审核中, 不能移出": "等待审核中, 不能移出",
"确定续期": "确定续期",
"确定移交": "确定移交",
"确定退出": "确定退出",
Expand Down Expand Up @@ -197,7 +205,6 @@
"流水线权限代持": "流水线权限代持",
"批量退出操作尚未完成,确认放弃操作吗?": "批量退出操作尚未完成,确认放弃操作吗?",
"通过组织加入的 不允许 续期/移出/移交": "通过组织加入的 不允许 续期/移出/移交",
"唯一拥有者资源": "唯一拥有者资源",
"等待审核中": "等待审核中",
"批量处理": "批量处理",
"单号": "单号",
Expand Down

0 comments on commit f520295

Please sign in to comment.