Merge pull request #2960 from jumpserver/pr@dev@clear_secret

perf: clear secret
This commit is contained in:
feng626
2023-03-23 16:05:27 +08:00
committed by GitHub
5 changed files with 25 additions and 16 deletions

View File

@@ -192,16 +192,16 @@ export default {
}
},
{
name: 'RemoveSecret',
title: this.$t('common.RemoveSecret'),
name: 'ClearSecret',
title: this.$t('common.ClearSecret'),
can: this.$hasPerm('accounts.change_account'),
type: 'primary',
callback: ({ row }) => {
this.$axios.patch(
`/api/v1/accounts/accounts/remove-secret/`,
`/api/v1/accounts/accounts/clear-secret/`,
{ account_ids: [row.id] }
).then(() => {
this.$message.success(this.$tc('common.RemoveSuccessMsg'))
this.$message.success(this.$tc('common.ClearSuccessMsg'))
})
}
},
@@ -306,8 +306,8 @@ export default {
],
extraMoreActions: [
{
name: 'RemoveSecrets',
title: this.$t('common.RemoveSecret'),
name: 'ClearSecrets',
title: this.$t('common.ClearSecret'),
type: 'primary',
can: ({ selectedRows }) => {
return selectedRows.length > 0 && vm.$hasPerm('accounts.change_account')
@@ -315,11 +315,11 @@ export default {
callback: function({ selectedRows }) {
const ids = selectedRows.map(v => { return v.id })
this.$axios.patch(
'/api/v1/accounts/accounts/remove-secret/',
'/api/v1/accounts/accounts/clear-secret/',
{ account_ids: ids }).then(() => {
this.$message.success(this.$tc('common.RemoveSuccessMsg'))
this.$message.success(this.$tc('common.ClearSuccessMsg'))
}).catch(err => {
this.$message.error(this.$tc('common.bulkRemoveErrorMsg' + ' ' + err))
this.$message.error(this.$tc('common.bulkClearErrorMsg' + ' ' + err))
})
}.bind(this)
}

View File

@@ -497,7 +497,10 @@
"MFAVerify": "Verify MFA",
"CurrentUserVerify": "Verify Current User",
"ViewSecret": "View secret",
"RemoveSecret": "Remove secret",
"ClearSecret": "Clear secret",
"ClearSuccessMsg": "Clear success",
"bulkClearErrorMsg": "Bulk clear error:",
"Clear": "Clear",
"ConnectWebSocketError": "Connect Websocket failed",
"Nothing": "Nothing",
"Action": "Action",

View File

@@ -494,7 +494,8 @@
"MFAVerify": "MFAの検証",
"CurrentUserVerify": "現在のユーザー検証",
"ViewSecret": "暗号文の表示",
"RemoveSecret": "暗号文の削除",
"ClearSecret": "暗号文の削除",
"Clear": "クリア",
"ConnectWebSocketError": "Webソケット接続に失敗しました",
"Action": "アクション",
"RequestTickets": "ワークオーダーを申請する",
@@ -583,6 +584,8 @@
"QuickUpdate": "クイックアップデート",
"QuickSelect": "クイック選択",
"RemoveSuccessMsg": "削除に成功しました",
"ClearSuccessMsg": "クリアに成功しました",
"bulkClearErrorMsg": "クリアに失敗しました: ",
"Reset": "リセット",
"Search": "検索",
"Select": "選択",

View File

@@ -505,7 +505,8 @@
"MFAVerify": "验证 MFA",
"CurrentUserVerify": "验证当前用户",
"ViewSecret": "查看密文",
"RemoveSecret": "除密文",
"ClearSecret": "除密文",
"Clear": "清除",
"ConnectWebSocketError": "连接 WebSocket 失败",
"Action": "动作",
"RequestTickets": "申请工单",
@@ -598,6 +599,8 @@
"QuickUpdate": "快速更新",
"QuickSelect": "快速选择",
"RemoveSuccessMsg": "移除成功",
"ClearSuccessMsg": "清除成功",
"bulkClearErrorMsg": "批量清除失败:",
"SyncSuccessMsg": "同步成功",
"Reset": "重置",
"Search": "搜索",

View File

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