perf: asset add account info

This commit is contained in:
ibuler
2024-10-18 15:21:47 +08:00
parent 8b25fd198e
commit 7c5c5f966d
4 changed files with 44 additions and 6 deletions

View File

@@ -124,7 +124,7 @@ export default {
}
},
cloneNameSuffix: {
type: String,
type: [String, Number],
default: function() {
return this.$t('Duplicate').toLowerCase()
}
@@ -372,7 +372,7 @@ export default {
name = object['hostname']
attr = 'hostname'
}
object[attr] = name + '-' + this.cloneNameSuffix
object[attr] = name + '-' + this.cloneNameSuffix.toString()
} else {
object = await this.getObjectDetail(this.iUrl)
}

View File

@@ -41,7 +41,7 @@ export default {
name: 'Detail'
},
{
title: this.$t('AccountList'),
title: this.$t('Accounts'),
name: 'Account',
hidden: () => !this.$hasPerm('accounts.view_account')
},

View File

@@ -31,6 +31,7 @@ import PlatformDialog from '../components/PlatformDialog'
import GatewayDialog from '@/components/Apps/GatewayDialog'
import { openTaskPage } from '@/utils/jms'
import HostInfoFormatter from '@/components/Table/TableFormatters/HostInfoFormatter'
import AmountFormatter from '@/components/Table/TableFormatters/AmountFormatter.vue'
export default {
components: {
@@ -129,7 +130,7 @@ export default {
columnsShow: {
min: ['name', 'address', 'actions'],
default: [
'name', 'address', 'platform',
'name', 'address', 'accounts_amount', 'platform',
'connectivity', 'actions'
]
},
@@ -171,6 +172,28 @@ export default {
}
}
},
accounts_amount: {
label: this.$t('Accounts'),
formatter: AmountFormatter,
width: '100px',
formatterArgs: {
async: true,
getItem(item) {
return `${item.name}(${item.username})`
},
getRoute({ row }) {
return {
name: 'AssetDetail',
params: {
id: row.id
},
query: {
tab: 'Account'
}
}
}
}
},
connectivity: connectivityMeta,
actions: {
formatter: ActionsFormatter,

View File

@@ -93,8 +93,14 @@ export default {
hasButtons: true,
hasReset: false,
fields: [],
method: 'get',
fieldsMeta: {}
method: 'get'
},
preFieldsMeta: {
'change_secret_by_ssh': {
commands: {
helpTextAsTip: false
}
}
}
}
},
@@ -159,6 +165,15 @@ export default {
}
}
const preDefineFieldMeta = this.preFieldsMeta[method]
if (preDefineFieldMeta) {
for (const [k, v] of Object.entries(preDefineFieldMeta)) {
for (const [j, l] of Object.entries(v)) {
fieldsMeta[method]['fieldsMeta'][k][j] = l
}
}
}
this.config.fields = fields
this.config.fieldsMeta = fieldsMeta
},