From 8150855050b4c007cb67254490e52d699ceada9d Mon Sep 17 00:00:00 2001 From: davidjumani Date: Wed, 11 Nov 2020 19:20:50 +0530 Subject: [PATCH] kubernetesservicetab: Fixing instance tab (#858) Signed-off-by: Rohit Yadav --- ui/src/views/compute/KubernetesServiceTab.vue | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/ui/src/views/compute/KubernetesServiceTab.vue b/ui/src/views/compute/KubernetesServiceTab.vue index 20a7fe7f0bc..1524467af19 100644 --- a/ui/src/views/compute/KubernetesServiceTab.vue +++ b/ui/src/views/compute/KubernetesServiceTab.vue @@ -186,6 +186,10 @@ export default { title: this.$t('label.instancename'), dataIndex: 'instancename' }, + { + title: this.$t('label.ipaddress'), + dataIndex: 'ipaddress' + }, { title: this.$t('label.ssh.port'), dataIndex: 'port', @@ -204,9 +208,14 @@ export default { this.handleFetchData() }, watch: { - loading (newData, oldData) { - if (!newData && this.resource.id) { + resource (newData, oldData) { + if (newData && newData !== oldData) { this.handleFetchData() + if (this.resource.ipaddress) { + this.vmColumns = this.vmColumns.filter(x => x.dataIndex !== 'ipaddress') + } else { + this.vmColumns = this.vmColumns.filter(x => x.dataIndex !== 'port') + } } } }, @@ -265,7 +274,6 @@ export default { }, fetchKubernetesVersion () { this.versionLoading = true - this.virtualmachines = [] if (!this.isObjectEmpty(this.resource) && this.isValidValueForKey(this.resource, 'kubernetesversionid') && this.resource.kubernetesversionid !== '') { var params = {} @@ -289,7 +297,8 @@ export default { }, fetchInstances () { this.instanceLoading = true - this.virtualmachines = this.resource.virtualmachines + this.virtualmachines = this.resource.virtualmachines || [] + this.virtualmachines.map(x => { x.ipaddress = x.nic[0].ipaddress }) this.instanceLoading = false }, fetchPublicIpAddress () {