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

View File

@@ -41,7 +41,7 @@ export default {
name: 'Detail' name: 'Detail'
}, },
{ {
title: this.$t('AccountList'), title: this.$t('Accounts'),
name: 'Account', name: 'Account',
hidden: () => !this.$hasPerm('accounts.view_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 GatewayDialog from '@/components/Apps/GatewayDialog'
import { openTaskPage } from '@/utils/jms' import { openTaskPage } from '@/utils/jms'
import HostInfoFormatter from '@/components/Table/TableFormatters/HostInfoFormatter' import HostInfoFormatter from '@/components/Table/TableFormatters/HostInfoFormatter'
import AmountFormatter from '@/components/Table/TableFormatters/AmountFormatter.vue'
export default { export default {
components: { components: {
@@ -129,7 +130,7 @@ export default {
columnsShow: { columnsShow: {
min: ['name', 'address', 'actions'], min: ['name', 'address', 'actions'],
default: [ default: [
'name', 'address', 'platform', 'name', 'address', 'accounts_amount', 'platform',
'connectivity', 'actions' '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, connectivity: connectivityMeta,
actions: { actions: {
formatter: ActionsFormatter, formatter: ActionsFormatter,

View File

@@ -93,8 +93,14 @@ export default {
hasButtons: true, hasButtons: true,
hasReset: false, hasReset: false,
fields: [], fields: [],
method: 'get', method: 'get'
fieldsMeta: {} },
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.fields = fields
this.config.fieldsMeta = fieldsMeta this.config.fieldsMeta = fieldsMeta
}, },