feat: xpack 批量修改密钥

This commit is contained in:
feng626 2021-07-29 19:04:16 +08:00 committed by Jiangjie.Bai
parent 0152ad269b
commit a0534e0c2e
3 changed files with 39 additions and 8 deletions

View File

@ -1115,6 +1115,7 @@
"NodeAmount": "节点数量",
"PasswordLength": "密码长度",
"PasswordStrategy": "密码策略",
"SecretKeyStrategy": "密钥策略",
"RegularlyPerform": "定期执行",
"Result": "结果",
"Retry": "重试",

View File

@ -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

View File

@ -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"