perf: 创建资产类型为web时,资产详情添加账号过滤掉切换字、特权账号等字段

This commit is contained in:
“huailei000”
2023-01-30 19:00:18 +08:00
committed by huailei
parent c9a3fe625c
commit e867277a7f
2 changed files with 6 additions and 2 deletions

View File

@@ -32,6 +32,10 @@ export default {
} }
}, },
data() { data() {
let privileged = ['privileged', 'su_from']
if (this.asset?.type?.value === 'website') {
privileged = []
}
return { return {
loading: true, loading: true,
usernameChanged: false, usernameChanged: false,
@@ -49,7 +53,7 @@ export default {
form: this.account || {}, form: this.account || {},
fields: [ fields: [
[this.$t('assets.Asset'), ['assets']], [this.$t('assets.Asset'), ['assets']],
[this.$t('common.Basic'), ['name', 'username', 'privileged', 'su_from']], [this.$t('common.Basic'), ['name', 'username', ...privileged]],
[this.$t('assets.Secret'), [ [this.$t('assets.Secret'), [
'secret_type', 'secret', 'ssh_key', 'token', 'secret_type', 'secret', 'ssh_key', 'token',
'api_key', 'passphrase' 'api_key', 'passphrase'

View File

@@ -56,7 +56,7 @@ export default {
const query = this.$route.query || {} const query = this.$route.query || {}
const automation = values['automation'] || {} const automation = values['automation'] || {}
const category_type = values['category_type'] const category_type = values['category_type']
const ansibleConfig = automation?.['ansible_config'] const ansibleConfig = automation?.['ansible_config'] || {}
automation.ansible_config = ansibleConfig instanceof Object ? ansibleConfig : JSON.parse(ansibleConfig) automation.ansible_config = ansibleConfig instanceof Object ? ansibleConfig : JSON.parse(ansibleConfig)
if (query.hasOwnProperty('clone_from')) { if (query.hasOwnProperty('clone_from')) {