diff --git a/src/i18n/langs/cn.json b/src/i18n/langs/cn.json index 27314ecd3..211b3836e 100644 --- a/src/i18n/langs/cn.json +++ b/src/i18n/langs/cn.json @@ -170,6 +170,7 @@ "Disable": "禁用", "Download": "下载", "Enable": "启用", + "On/Off": "启/停", "EnterForSearch": "按回车进行搜索", "Export": "导出", "Import": "导入", diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json index 4c936ce68..ad9370176 100644 --- a/src/i18n/langs/en.json +++ b/src/i18n/langs/en.json @@ -171,6 +171,7 @@ "Disable": "Disable", "Download": "Download", "Enable": "Enable", + "On/Off": "On/Off", "EnterForSearch": "Press enter to search", "Export": "Export", "Import": "Import", @@ -885,4 +886,4 @@ "UsernameOfCreateUpdatePage": "The username of the user on the target host; If already existed, modify user password; If it doesn't exist, add the user and set the password." } } -} \ No newline at end of file +} diff --git a/src/layout/components/NavHeader/ApiKey.vue b/src/layout/components/NavHeader/ApiKey.vue index fa611c270..2d396f9fa 100644 --- a/src/layout/components/NavHeader/ApiKey.vue +++ b/src/layout/components/NavHeader/ApiKey.vue @@ -53,6 +53,7 @@ export default { actions: { prop: '', formatterArgs: { + hasUpdate: false, onDelete: function({ row, col, cellValue, reload }) { this.$axios.delete( `/api/v1/authentication/access-keys/${row.id}/` @@ -63,27 +64,34 @@ export default { this.$message.error(this.$t('common.deleteErrorMsg' + ' ' + error)) }) }.bind(this), - onUpdate: function({ row, col, cellValue, reload }) { - this.$axios.patch( - `/api/v1/authentication/access-keys/${row.id}/`, - { is_active: !row.is_active } - ).then(res => { - this.$refs.ListTable.reloadTable() - this.$message.success(this.$t('common.updateSuccessMsg')) - }).catch(error => { - this.$message.error(this.$t('common.updateErrorMsg' + ' ' + error)) - }) - }.bind(this) + extraActions: [ + { + name: 'Enabled', + title: this.$t('common.On/Off'), + type: 'info', + callback: function({ row, col, cellValue, reload }) { + this.$axios.patch( + `/api/v1/authentication/access-keys/${row.id}/`, + { is_active: !row.is_active } + ).then(res => { + this.$refs.ListTable.reloadTable() + this.$message.success(this.$t('common.updateSuccessMsg')) + }).catch(error => { + this.$message.error(this.$t('common.updateErrorMsg' + ' ' + error)) + }) + }.bind(this) + } + ] } } } }, headerActions: { hasSearch: true, - hasRightActions: false, + hasRightActions: true, + hasRefresh: true, hasExport: false, hasImport: false, - hasRefresh: true, hasBulkDelete: false, hasCreate: false, extraActions: [