Merge pull request #3084 from jumpserver/pr@dev@fix_asset_gatheredinfo_undefined

fix: 修复资产硬件信息显示undefined问题
This commit is contained in:
老广
2023-04-28 11:12:55 +08:00
committed by GitHub
2 changed files with 5 additions and 25 deletions

View File

@@ -149,7 +149,7 @@ export default {
nodes_display: { nodes_display: {
formatter: ArrayFormatter formatter: ArrayFormatter
}, },
info: { gathered_info: {
label: this.$t('assets.HardwareInfo'), label: this.$t('assets.HardwareInfo'),
formatter: HostInfoFormatter, formatter: HostInfoFormatter,
formatterArgs: { formatterArgs: {
@@ -299,7 +299,7 @@ export default {
}, },
watch: { watch: {
optionInfo(iNew) { optionInfo(iNew) {
this.$set(this.defaultConfig.columnsMeta.info.formatterArgs, 'info', iNew) this.$set(this.defaultConfig.columnsMeta.gathered_info.formatterArgs, 'info', iNew)
} }
}, },
methods: { methods: {

View File

@@ -11,34 +11,14 @@ export default {
GenericCreateUpdatePage GenericCreateUpdatePage
}, },
data() { data() {
const nodesInitial = []
if (this.$route.query['node']) {
nodesInitial.push(this.$route.query.node)
}
return { return {
initial: { initial: {},
is_active: true,
platform: 'Linux',
protocols: ['ssh/22'],
nodes: nodesInitial
},
fields: [ fields: [
[this.$t('common.Basic'), ['name', 'address']], [this.$t('common.Basic'), ['name', 'address']],
[this.$t('assets.Hardware'), ['info']] [this.$t('assets.Hardware'), ['gathered_info']]
], ],
fieldsMeta: { fieldsMeta: {
platform: { gathered_info: {
el: {
multiple: false,
ajax: {
url: '/api/v1/assets/platforms/',
transformOption: (item) => {
return { label: `${item.name}`, value: item.name }
}
}
}
},
info: {
fields: [ fields: [
'vendor', 'model', 'sn', 'cpu_model', 'cpu_count', 'vendor', 'model', 'sn', 'cpu_model', 'cpu_count',
'cpu_cores', 'cpu_vcpus', 'memory', 'disk_total', 'cpu_cores', 'cpu_vcpus', 'memory', 'disk_total',