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

View File

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

View File

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

View File

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

View File

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