diff --git a/src/i18n/langs/cn.json b/src/i18n/langs/cn.json index 7a1fd23c4..3774bec6a 100644 --- a/src/i18n/langs/cn.json +++ b/src/i18n/langs/cn.json @@ -1115,6 +1115,7 @@ "NodeAmount": "节点数量", "PasswordLength": "密码长度", "PasswordStrategy": "密码策略", + "SecretKeyStrategy": "密钥策略", "RegularlyPerform": "定期执行", "Result": "结果", "Retry": "重试", diff --git a/src/views/accounts/ChangeAuthPlan/ChangeAuthPlanCreateUpdate.vue b/src/views/accounts/ChangeAuthPlan/ChangeAuthPlanCreateUpdate.vue index 3bf371368..3737900c4 100644 --- a/src/views/accounts/ChangeAuthPlan/ChangeAuthPlanCreateUpdate.vue +++ b/src/views/accounts/ChangeAuthPlan/ChangeAuthPlanCreateUpdate.vue @@ -24,13 +24,17 @@ export default { fields: [ [this.$t('common.Basic'), ['name']], [this.$t('xpack.Asset'), ['username', 'assets', 'nodes']], - [this.$t('xpack.ChangeAuthPlan.PasswordStrategy'), ['password_strategy', 'password', 'password_rules']], + [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']] ], initial: { password_strategy: 'custom', + ssh_key_strategy: 'add', is_periodic: true, + is_password: true, + is_ssh_key: true, password_rules: { length: 30 }, @@ -50,7 +54,7 @@ export default { }, password: { hidden: (formValue) => { - return formValue.password_strategy !== 'custom' + return formValue.password_strategy !== 'custom' || formValue.is_password === false }, rules: [ { required: this.$route.meta.action === 'create', message: this.$t('common.fieldRequiredError'), trigger: 'blur' } @@ -60,6 +64,19 @@ export default { type: 'group', items: this.generatePasswordRulesItemsFields() }, + private_key: { + el: { + type: 'textarea', + placeholder: '-----BEGIN OPENSSH PRIVATE KEY-----', + autosize: { minRows: 3 } + }, + hidden: (formValue) => { + return formValue.is_ssh_key === false + }, + rules: [ + { required: this.$route.meta.action === 'create', message: this.$t('common.fieldRequiredError'), trigger: 'blur' } + ] + }, nodes: { label: this.$t('xpack.Node'), el: { @@ -75,6 +92,24 @@ export default { is_periodic: { type: 'switch' }, + is_password: { + type: 'switch' + }, + is_ssh_key: { + type: 'switch' + }, + password_strategy: { + label: this.$t('xpack.ChangeAuthPlan.PasswordStrategy'), + hidden: (formValue) => { + return formValue.is_password === false + } + }, + ssh_key_strategy: { + label: this.$t('xpack.ChangeAuthPlan.SecretKeyStrategy'), + hidden: (formValue) => { + return formValue.is_ssh_key === false + } + }, crontab: { label: this.$t('xpack.RegularlyPerform'), hidden: (formValue) => { @@ -115,7 +150,7 @@ export default { items.forEach((item, index, array) => { itemsFields.push({ id: item.id, prop: item.prop, el: {}, attrs: {}, type: 'input', label: item.label, rules: [Required], - hidden: (formValue) => { return ['random_one', 'random_all'].indexOf(formValue.password_strategy) === -1 } + hidden: (formValue) => { return ['random_one', 'random_all'].indexOf(formValue.password_strategy) === -1 || formValue.is_password === false } }) }) return itemsFields diff --git a/yarn.lock b/yarn.lock index 94e339a3f..d27f58dda 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11290,11 +11290,6 @@ yargs@^11.0.0: y18n "^3.2.1" yargs-parser "^9.0.2" -yarn@^1.22.10: - version "1.22.10" - resolved "https://registry.npm.taobao.org/yarn/download/yarn-1.22.10.tgz#c99daa06257c80f8fa2c3f1490724e394c26b18c" - integrity sha1-yZ2qBiV8gPj6LD8UkHJOOUwmsYw= - yorkie@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/yorkie/-/yorkie-2.0.0.tgz#92411912d435214e12c51c2ae1093e54b6bb83d9"