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

View File

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