Skip to content

Commit

Permalink
feat:仓库权限配置内用户可粘贴 TencentBlueKing#1695
Browse files Browse the repository at this point in the history
* feat:仓库权限配置内用户可粘贴 TencentBlueKing#1695

* feat:仓库权限配置内用户可粘贴 TencentBlueKing#1695
  • Loading branch information
lannoy0523 authored Jan 26, 2024
1 parent 2a41c6c commit 87e043e
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
<bk-tag-input
class="w480"
v-model="permissionForm.users"
:placeholder="$t('enterPlaceHolder')"
:placeholder="$t('enterPlaceHolder') + $t('parseTip')"
trigger="focus"
:paste-fn="parseFn"
:has-delete-icon="true"
allow-create>
</bk-tag-input>
Expand Down Expand Up @@ -142,7 +143,6 @@
body: body
}).then(() => {
this.reset()
this.$emit('refresh')
})
} else {
const body = {
Expand All @@ -157,7 +157,6 @@
body: body
}).then(() => {
this.reset()
this.$emit('refresh')
})
}
},
Expand All @@ -173,6 +172,17 @@
this.type = 'create'
this.$refs.pathConfig.replicaTaskObjects = []
this.$refs.permissionForm.clearError()
this.$emit('refresh')
},
parseFn (data) {
if (data !== '') {
const users = data.toString().split(',')
for (let i = 0; i < users.length; i++) {
users[i] = users[i].toString().trim()
this.permissionForm.users.push(users[i])
}
this.permissionForm.user = Array.from(new Set(this.permissionForm.users))
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</div>
</div> -->
<bk-form style="margin-top:-15px" ref="genericShareForm" :label-width="360" form-type="vertical">
<bk-form-item :label="$t('authorizedUser')">
<bk-form-item :label="$t('authorizedUser') + $t('parseTip')">
<bk-tag-input
v-model="genericShare.user"
:list="Object.values(userList).filter(user => user.id !== 'anonymous')"
Expand Down
21 changes: 18 additions & 3 deletions src/frontend/devops-repository/src/views/userGroup/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
width="500"
height-num="301"
:title="editRoleConfig.id ? $t('editUserGroupTitle') : $t('addUserGroupTitle')"
@cancel="editRoleConfig.show = false">
@cancel="cancel">
<bk-form :label-width="80" :model="editRoleConfig" :rules="rules" ref="roleForm">
<bk-form-item :label="$t('roleName')" :required="true" property="name" error-display-type="normal">
<bk-input v-model.trim="editRoleConfig.name" maxlength="32" show-word-limit></bk-input>
Expand All @@ -51,15 +51,16 @@
<bk-form-item :label="$t('user')" property="users" error-display-type="normal">
<bk-tag-input
v-model="editRoleConfig.users"
:placeholder="$t('enterPlaceHolder')"
:placeholder="$t('enterPlaceHolder') + $t('parseTip')"
trigger="focus"
:paste-fn="parseFn"
:has-delete-icon="true"
allow-create>
</bk-tag-input>
</bk-form-item>
</bk-form>
<template #footer>
<bk-button @click="editRoleConfig.show = false">{{ $t('cancel') }}</bk-button>
<bk-button @click="cancel">{{ $t('cancel') }}</bk-button>
<bk-button class="ml10" theme="primary" @click="confirm">{{ $t('confirm') }}</bk-button>
</template>
</canway-dialog>
Expand Down Expand Up @@ -212,6 +213,20 @@
})
}
})
},
parseFn (data) {
if (data !== '') {
const users = data.toString().split(',')
for (let i = 0; i < users.length; i++) {
users[i] = users[i].toString().trim()
this.editRoleConfig.users.push(users[i])
}
this.editRoleConfig.user = Array.from(new Set(this.editRoleConfig.users))
}
},
cancel () {
this.editRoleConfig.show = false
this.getRoleListHandler()
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/locale/repository/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,8 @@
"totalFilesMsg":"{0} files exist in current folder",
"batchDeleteMsg":"Confirm to delete the selected {0} items in batches?",
"batchDeleteSubMsg":"The selected folder and files contain {0} files in total",
"authorizedUser":"Authorized Users (Separate multi-users with commas)",
"authorizedUser":"Authorized Users",
"parseTip": "(Separate multi-users with commas)",
"permanent":"permanent",
"sharePlaceHolder":"If left blank, any user can access.",
"authorizedIp":"Authorized IP",
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/locale/repository/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,8 @@
"totalFilesMsg":"当前文件夹下存在{0}个文件",
"batchDeleteMsg":"确认批量删除已选中的{0}项?",
"batchDeleteSubMsg":"选中文件夹和文件共计包含{0}个文件",
"authorizedUser":"授权用户(粘贴多用户需用,隔开)",
"authorizedUser":"授权用户",
"parseTip": "(粘贴多用户需用,隔开)",
"permanent":"永久",
"sharePlaceHolder":"授权访问用户,为空则任意用户可访问,按Enter键确认",
"authorizedIp":"授权IP",
Expand Down

0 comments on commit 87e043e

Please sign in to comment.