From 5eff271cb2ed33a2c76523ad239866efe4031f30 Mon Sep 17 00:00:00 2001 From: feng626 <1304903146@qq.com> Date: Fri, 3 Dec 2021 15:57:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=86=E7=A0=81=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E9=82=AE=E4=BB=B6=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/i18n/langs/cn.json | 3 + src/i18n/langs/en.json | 3 + .../users/UserProfile/SecretKeyUpdate.vue | 67 +++++++++++++++++++ src/userviews/users/UserProfile/index.vue | 6 ++ .../AppChangeAuthPlanCreateUpdate.vue | 5 +- .../ChangeAuthPlanExecutionInfo.vue | 6 +- .../ChangeAuthPlanCreateUpdate.vue | 5 +- .../ChangeAuthPlanExecutionInfo.vue | 6 +- src/views/accounts/ChangeAuthPlan/fields.js | 15 ++++- 9 files changed, 109 insertions(+), 7 deletions(-) create mode 100644 src/userviews/users/UserProfile/SecretKeyUpdate.vue diff --git a/src/i18n/langs/cn.json b/src/i18n/langs/cn.json index 31e9b7902..2c77ffb9f 100644 --- a/src/i18n/langs/cn.json +++ b/src/i18n/langs/cn.json @@ -1094,6 +1094,7 @@ "UpdateNodeAssetHardwareInfo": "更新节点资产硬件信息" }, "users": { + "FileEncryptionPassword": "文件加密密码", "MessageSubscription": "消息订阅", "AuthSettings": "认证配置", "UserName": "姓名", @@ -1233,7 +1234,9 @@ "AssetCount": "资产数量", "Auditor": "审计员", "ChangeAuthPlan": { + "ContainAttachment": "含附件", "AddAsset": "添加资产", + "MailRecipient": "邮件收件人", "AddNode": "添加节点", "AddSystemUser": "添加系统用户", "Asset": "资产", diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json index 94c3c103f..7ee3c3f81 100644 --- a/src/i18n/langs/en.json +++ b/src/i18n/langs/en.json @@ -1057,6 +1057,7 @@ "UpdateNodeAssetHardwareInfo": "Update node asset hardware information" }, "users": { + "FileEncryptionPassword": "File encryption password", "MessageSubscription": "Message Subscription", "AuthSettings": "Auth settings", "UserName": "Name", @@ -1193,7 +1194,9 @@ "AssetCount": "Asset count", "Auditor": "Auditor", "ChangeAuthPlan": { + "MailRecipient": "Mail recipient", "AddAsset": "Add asset", + "ContainAttachment": "Contain attachment", "AddNode": "Add node", "AddSystemUser": "Add systemuser", "Asset": "Asset", diff --git a/src/userviews/users/UserProfile/SecretKeyUpdate.vue b/src/userviews/users/UserProfile/SecretKeyUpdate.vue new file mode 100644 index 000000000..a6da711f1 --- /dev/null +++ b/src/userviews/users/UserProfile/SecretKeyUpdate.vue @@ -0,0 +1,67 @@ + + + + + diff --git a/src/userviews/users/UserProfile/index.vue b/src/userviews/users/UserProfile/index.vue index bc9eb7504..f248cfb18 100644 --- a/src/userviews/users/UserProfile/index.vue +++ b/src/userviews/users/UserProfile/index.vue @@ -11,6 +11,7 @@ import { GenericDetailPage } from '@/layout/components' import ProfileInfo from './ProfileInfo' import ProfileUpdate from './ProfileUpdate' import PasswordUpdate from './PasswordUpdate' +import SecretKeyUpdate from './SecretKeyUpdate' import SSHUpdate from './SSHUpdate' export default { @@ -19,6 +20,7 @@ export default { ProfileInfo, ProfileUpdate, PasswordUpdate, + SecretKeyUpdate, SSHUpdate }, data() { @@ -55,6 +57,10 @@ export default { title: this.$t('users.SSHKeySetting'), name: 'SSHUpdate', disabled: !this.$store.state.users.profile.can_public_key_auth + }, + { + title: this.$t('users.FileEncryptionPassword'), + name: 'SecretKeyUpdate' } ] }, diff --git a/src/views/accounts/ChangeAuthPlan/AppChangeAuthPlan/AppChangeAuthPlanCreateUpdate.vue b/src/views/accounts/ChangeAuthPlan/AppChangeAuthPlan/AppChangeAuthPlanCreateUpdate.vue index 830302468..91bb468a2 100644 --- a/src/views/accounts/ChangeAuthPlan/AppChangeAuthPlan/AppChangeAuthPlanCreateUpdate.vue +++ b/src/views/accounts/ChangeAuthPlan/AppChangeAuthPlan/AppChangeAuthPlanCreateUpdate.vue @@ -20,7 +20,7 @@ export default { [this.$t('assets.Applications'), ['category', 'type', 'apps', 'system_users']], [this.$t('xpack.ChangeAuthPlan.PasswordStrategy'), ['password_strategy', 'password', 'password_rules']], [this.$t('xpack.Timer'), ['is_periodic', 'crontab', 'interval']], - [this.$t('common.Other'), ['comment']] + [this.$t('common.Other'), ['recipients', 'comment']] ], initial: { type: this.$route.query.type, @@ -81,7 +81,8 @@ export default { is_periodic: fields.is_periodic, password_strategy: fields.password_strategy, crontab: fields.crontab, - interval: fields.interval + interval: fields.interval, + recipients: fields.recipients }, createSuccessNextRoute: { name: 'ChangeAuthPlanIndex' }, updateSuccessNextRoute: { name: 'ChangeAuthPlanIndex' }, diff --git a/src/views/accounts/ChangeAuthPlan/AppChangeAuthPlan/ChangeAuthPlanDetail/AppChangeAuthPlanExecution/ChangeAuthPlanExecutionDetail/ChangeAuthPlanExecutionInfo.vue b/src/views/accounts/ChangeAuthPlan/AppChangeAuthPlan/ChangeAuthPlanDetail/AppChangeAuthPlanExecution/ChangeAuthPlanExecutionDetail/ChangeAuthPlanExecutionInfo.vue index 53871540b..c32284179 100644 --- a/src/views/accounts/ChangeAuthPlan/AppChangeAuthPlan/ChangeAuthPlanDetail/AppChangeAuthPlanExecution/ChangeAuthPlanExecutionDetail/ChangeAuthPlanExecutionInfo.vue +++ b/src/views/accounts/ChangeAuthPlan/AppChangeAuthPlan/ChangeAuthPlanDetail/AppChangeAuthPlanExecution/ChangeAuthPlanExecutionDetail/ChangeAuthPlanExecutionInfo.vue @@ -55,8 +55,12 @@ export default { { key: this.$t('xpack.ChangeAuthPlan.DateStart'), value: toSafeLocalDateStr(this.object.date_start) + }, + { + key: this.$t('xpack.ChangeAuthPlan.MailRecipient'), + value: this.object.recipients ? this.object.recipients.map( + i => `${i[0]}` + `${i[1] ? ': ' + this.$t('xpack.ChangeAuthPlan.ContainAttachment') : ''}`).join(', ') : '' } - ] } } diff --git a/src/views/accounts/ChangeAuthPlan/AssetChangeAuthPlan/ChangeAuthPlanCreateUpdate.vue b/src/views/accounts/ChangeAuthPlan/AssetChangeAuthPlan/ChangeAuthPlanCreateUpdate.vue index f84470b49..521654f9b 100644 --- a/src/views/accounts/ChangeAuthPlan/AssetChangeAuthPlan/ChangeAuthPlanCreateUpdate.vue +++ b/src/views/accounts/ChangeAuthPlan/AssetChangeAuthPlan/ChangeAuthPlanCreateUpdate.vue @@ -21,7 +21,7 @@ export default { [this.$t('xpack.ChangeAuthPlan.PasswordStrategy'), ['is_password', 'password_strategy', 'password', 'password_rules']], [this.$t('xpack.ChangeAuthPlan.SecretKeyStrategy'), ['is_ssh_key', 'ssh_key_strategy', 'private_key']], [this.$t('xpack.Timer'), ['is_periodic', 'crontab', 'interval']], - [this.$t('common.Other'), ['comment']] + [this.$t('common.Other'), ['recipients', 'comment']] ], initial: { password_strategy: 'custom', @@ -47,7 +47,8 @@ export default { password_strategy: fields.password_strategy, ssh_key_strategy: fields.ssh_key_strategy, crontab: fields.crontab, - interval: fields.interval + interval: fields.interval, + recipients: fields.recipients }, createSuccessNextRoute: { name: 'ChangeAuthPlanIndex' }, updateSuccessNextRoute: { name: 'ChangeAuthPlanIndex' }, diff --git a/src/views/accounts/ChangeAuthPlan/AssetChangeAuthPlan/ChangeAuthPlanDetail/ChangeAuthPlanExecution/ChangeAuthPlanExecutionDetail/ChangeAuthPlanExecutionInfo.vue b/src/views/accounts/ChangeAuthPlan/AssetChangeAuthPlan/ChangeAuthPlanDetail/ChangeAuthPlanExecution/ChangeAuthPlanExecutionDetail/ChangeAuthPlanExecutionInfo.vue index 036683dfa..f20a9df4d 100644 --- a/src/views/accounts/ChangeAuthPlan/AssetChangeAuthPlan/ChangeAuthPlanDetail/ChangeAuthPlanExecution/ChangeAuthPlanExecutionDetail/ChangeAuthPlanExecutionInfo.vue +++ b/src/views/accounts/ChangeAuthPlan/AssetChangeAuthPlan/ChangeAuthPlanDetail/ChangeAuthPlanExecution/ChangeAuthPlanExecutionDetail/ChangeAuthPlanExecutionInfo.vue @@ -51,8 +51,12 @@ export default { { key: this.$t('xpack.ChangeAuthPlan.DateStart'), value: toSafeLocalDateStr(this.object.date_start) + }, + { + key: this.$t('xpack.ChangeAuthPlan.MailRecipient'), + value: this.object.recipients ? this.object.recipients.map( + i => `${i[0]}` + `${i[1] ? ': ' + this.$t('xpack.ChangeAuthPlan.ContainAttachment') : ''}`).join(', ') : '' } - ] } } diff --git a/src/views/accounts/ChangeAuthPlan/fields.js b/src/views/accounts/ChangeAuthPlan/fields.js index 549900d7b..e33110ec5 100644 --- a/src/views/accounts/ChangeAuthPlan/fields.js +++ b/src/views/accounts/ChangeAuthPlan/fields.js @@ -127,6 +127,18 @@ function getFields() { ] } + const recipients = { + el: { + value: [], + ajax: { + url: '/api/v1/users/users/?fields_size=mini', + transformOption: (item) => { + return { label: item.name + '(' + item.username + ')', value: item.id } + } + } + } + } + const nodes = { label: i18n.t('xpack.Node'), el: { @@ -220,7 +232,8 @@ function getFields() { is_periodic: is_periodic, is_ssh_key: is_ssh_key, crontab: crontab, - interval: interval + interval: interval, + recipients: recipients } }