ui: fix display host hypervisorversion (#5301)

This commit is contained in:
Abhishek Kumar 2021-08-11 19:53:08 +05:30 committed by GitHub
parent 1182051961
commit fb0dedc896
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 9 deletions

View File

@ -18,7 +18,7 @@
<template>
<a-spin :spinning="fetchLoading">
<a-list size="small">
<a-list-item>
<a-list-item v-if="host.hypervisorversion || (host.details && host.details['Host.OS'])">
<div>
<strong>{{ $t('label.hypervisorversion') }}</strong>
<div>
@ -26,12 +26,9 @@
<span v-if="host.hypervisorversion">
{{ host.hypervisorversion }}
</span>
<span v-else-if="host.details">
<span v-else-if="host.details && host.details['Host.OS']">
{{ host.details['Host.OS'] + ' ' + host.details['Host.OS.Version'] }}
</span>
<span v-else>
{{ host.version }}
</span>
</div>
</div>
</a-list-item>
@ -130,15 +127,16 @@ export default {
},
watch: {
resource (newItem, oldItem) {
if (this.resource && this.resource.id && newItem && newItem.id !== oldItem.id) {
this.fetchData()
if (this.resource) {
this.host = this.resource
if (this.resource.id && newItem && newItem.id !== oldItem.id) {
this.fetchData()
}
}
}
},
methods: {
fetchData () {
this.dataSource = []
this.itemCount = 0
this.fetchLoading = true
api('listHosts', { id: this.resource.id }).then(json => {
this.host = json.listhostsresponse.host[0]