perf(formatterPassword): 统一管理用户、系统用户密码组建

This commit is contained in:
jym503558564
2020-10-20 12:30:23 +08:00
committed by Orange
parent 48c0f6e8c6
commit 9d62614ff4
2 changed files with 34 additions and 7 deletions

View File

@@ -17,7 +17,8 @@ export default {
},
fields: [
[this.$t('common.Basic'), ['name', 'username', 'password', 'private_key', 'comment']]
[this.$t('common.Basic'), ['name', 'username', 'update_password', 'password', 'private_key']],
[this.$t('common.Other'), ['comment']]
],
fieldsMeta: {
name: {
@@ -30,8 +31,24 @@ export default {
placeholder: this.$t('common.Username')
}
},
update_password: {
label: this.$t('users.UpdatePassword'),
type: 'checkbox',
hidden: (formValue) => {
if (formValue.update_password) {
return true
}
return !this.$route.params.id
}
},
password: {
helpText: this.$t('common.passwordOrPassphrase')
helpText: this.$t('common.passwordOrPassphrase'),
hidden: (formValue) => {
if (!this.$route.params.id) {
return false
}
return !formValue.update_password
}
},
private_key: {
component: Uploadkey

View File

@@ -30,7 +30,7 @@ export default {
fields: [
[this.$t('common.Basic'), ['name', 'login_mode', 'username', 'username_same_with_user', 'priority', 'protocol']],
[this.$t('assets.AutoPush'), ['auto_push', 'sudo', 'shell', 'home', 'system_groups']],
[this.$t('common.Auth'), ['auto_generate_key', 'password', 'private_key', 'token']],
[this.$t('common.Auth'), ['auto_generate_key', 'update_password', 'password', 'private_key', 'token']],
[this.$t('common.Command filter'), ['cmd_filters']],
[this.$t('common.Other'), ['sftp_root', 'comment']]
],
@@ -175,16 +175,26 @@ export default {
helpText: this.$t('assets.SudoHelpMessage'),
hidden: (item) => item.protocol !== 'ssh' || !item.auto_push
},
update_password: {
label: this.$t('users.UpdatePassword'),
type: 'checkbox',
hidden: (formValue) => {
if (formValue.update_password) {
return true
}
return !this.$route.params.id
}
},
password: {
helpText: this.$t('assets.PasswordHelpMessage'),
hidden: form => {
if (form.login_mode !== 'auto') {
if (form.login_mode !== 'auto' || form.protocol === 'k8s' || form.auto_generate_key) {
return true
}
if (form.protocol === 'k8s') {
return true
if (!this.$route.params.id) {
return false
}
return form.auto_generate_key === true
return !form.update_password
}
},
shell: {