Merge pull request #2955 from jumpserver/pr@dev@remove_secret

feat: account remove secret
This commit is contained in:
feng626
2023-03-23 11:21:01 +08:00
committed by GitHub
5 changed files with 57 additions and 2 deletions

View File

@@ -191,6 +191,20 @@ export default {
})
}
},
{
name: 'RemoveSecret',
title: this.$t('common.RemoveSecret'),
can: this.$hasPerm('accounts.change_account'),
type: 'primary',
callback: ({ row }) => {
this.$axios.patch(
`/api/v1/accounts/accounts/remove-secret/`,
{ account_ids: [row.id] }
).then(() => {
this.$message.success(this.$tc('common.RemoveSuccessMsg'))
})
}
},
{
name: 'Delete',
title: this.$t('common.Delete'),
@@ -290,6 +304,26 @@ export default {
// type: 'default'
// }
],
extraMoreActions: [
{
name: 'RemoveSecrets',
title: this.$t('common.RemoveSecret'),
type: 'primary',
can: ({ selectedRows }) => {
return selectedRows.length > 0 && vm.$hasPerm('accounts.change_account')
},
callback: function({ selectedRows }) {
const ids = selectedRows.map(v => { return v.id })
this.$axios.patch(
'/api/v1/accounts/accounts/remove-secret/',
{ account_ids: ids }).then(() => {
this.$message.success(this.$tc('common.RemoveSuccessMsg'))
}).catch(err => {
this.$message.error(this.$tc('common.bulkRemoveErrorMsg' + ' ' + err))
})
}.bind(this)
}
],
canBulkDelete: vm.$hasPerm('accounts.delete_account'),
searchConfig: {
getUrlQuery: false,

View File

@@ -497,6 +497,7 @@
"MFAVerify": "Verify MFA",
"CurrentUserVerify": "Verify Current User",
"ViewSecret": "View secret",
"RemoveSecret": "Remove secret",
"ConnectWebSocketError": "Connect Websocket failed",
"Nothing": "Nothing",
"Action": "Action",

View File

@@ -493,7 +493,8 @@
"ApprovaLevel": "承認情報",
"MFAVerify": "MFAの検証",
"CurrentUserVerify": "現在のユーザー検証",
"ViewSecret": "パスワードの確認",
"ViewSecret": "暗号文の表示",
"RemoveSecret": "暗号文の削除",
"ConnectWebSocketError": "Webソケット接続に失敗しました",
"Action": "アクション",
"RequestTickets": "ワークオーダーを申請する",

View File

@@ -504,7 +504,8 @@
"ApprovaLevel": "审批信息",
"MFAVerify": "验证 MFA",
"CurrentUserVerify": "验证当前用户",
"ViewSecret": "查看密",
"ViewSecret": "查看密",
"RemoveSecret": "移除密文",
"ConnectWebSocketError": "连接 WebSocket 失败",
"Action": "动作",
"RequestTickets": "申请工单",

View File

@@ -142,6 +142,24 @@ export default {
}
})
},
{
title: this.$t('common.RemoveSecret'),
attrs: {
type: 'primary',
label: this.$t('users.Remove'),
disabled: !vm.$hasPerm('accounts.change_account')
},
callbacks: Object.freeze({
click: () => {
this.$axios.patch(
'/api/v1/accounts/accounts/remove-secret/',
{ account_ids: [this.object.id] }
).then(() => {
this.$message.success(this.$tc('common.RemoveSuccessMsg'))
})
}
})
},
{
title: this.$t('assets.UserSwitchFrom'),
type: 'updateSelect',