From d68b098a435b27c62fa46cb21fa1ca8bd3065f32 Mon Sep 17 00:00:00 2001 From: Hoang Nguyen Date: Tue, 27 Apr 2021 23:17:49 +0700 Subject: [PATCH] UI: Show IPv6 address of Instance (#4948) * vm: show IPv6 address * show ipv6 address on listview --- ui/src/components/view/DetailsTab.vue | 16 ++++++++++++++++ ui/src/components/view/InfoCard.vue | 17 +++++++++++++++++ ui/src/components/view/ListView.vue | 10 ++++++++++ ui/src/config/section/compute.js | 2 +- 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/ui/src/components/view/DetailsTab.vue b/ui/src/components/view/DetailsTab.vue index e47f3c58a3f..015b44e24d6 100644 --- a/ui/src/components/view/DetailsTab.vue +++ b/ui/src/components/view/DetailsTab.vue @@ -50,6 +50,13 @@ + +
+ {{ $t('label.' + String(item).toLowerCase()) }} +
+
{{ ipV6Address }}
+
+
@@ -88,6 +95,15 @@ export default { mounted () { this.dedicatedSectionActive = this.dedicatedRoutes.includes(this.$route.meta.name) }, + computed: { + ipV6Address () { + if (this.resource.nic && this.resource.nic.length > 0) { + return this.resource.nic.filter(e => { return e.ip6address }).map(e => { return e.ip6address }).join(', ') + } + + return null + } + }, created () { this.dedicatedSectionActive = this.dedicatedRoutes.includes(this.$route.meta.name) }, diff --git a/ui/src/components/view/InfoCard.vue b/ui/src/components/view/InfoCard.vue index d96fa0a8a81..15156b190fa 100644 --- a/ui/src/components/view/InfoCard.vue +++ b/ui/src/components/view/InfoCard.vue @@ -313,6 +313,16 @@ {{ ipaddress }} +
+
{{ $t('label.ip6address') }}
+
+ + {{ ipV6Address }} +
+
{{ $t('label.project') }}
@@ -778,6 +788,13 @@ export default { name () { return this.resource.displayname || this.resource.displaytext || this.resource.name || this.resource.username || this.resource.ipaddress || this.resource.virtualmachinename || this.resource.templatetype + }, + ipV6Address () { + if (this.resource.nic && this.resource.nic.length > 0) { + return this.resource.nic.filter(e => { return e.ip6address }).map(e => { return e.ip6address }).join(', ') + } + + return null } }, methods: { diff --git a/ui/src/components/view/ListView.vue b/ui/src/components/view/ListView.vue index 1f56dc1027c..c92c852797c 100644 --- a/ui/src/components/view/ListView.vue +++ b/ui/src/components/view/ListView.vue @@ -114,6 +114,9 @@ source-nat + + {{ ipV6Address(text, record) }} + {{ text }} @@ -564,6 +567,13 @@ export default { }, editTariffValue (record) { this.parentEditTariffAction(true, record) + }, + ipV6Address (text, record) { + if (!record || !record.nic || record.nic.length === 0) { + return '' + } + + return record.nic.filter(e => { return e.ip6address }).map(e => { return e.ip6address }).join(', ') || text } } } diff --git a/ui/src/config/section/compute.js b/ui/src/config/section/compute.js index 39271c44d8a..69a70182218 100644 --- a/ui/src/config/section/compute.js +++ b/ui/src/config/section/compute.js @@ -68,7 +68,7 @@ export default { return fields }, searchFilters: ['name', 'zoneid', 'domainid', 'account', 'tags'], - details: ['displayname', 'name', 'id', 'state', 'ipaddress', 'templatename', 'ostypename', 'serviceofferingname', 'isdynamicallyscalable', 'haenable', 'hypervisor', 'boottype', 'bootmode', 'account', 'domain', 'zonename'], + details: ['displayname', 'name', 'id', 'state', 'ipaddress', 'ip6address', 'templatename', 'ostypename', 'serviceofferingname', 'isdynamicallyscalable', 'haenable', 'hypervisor', 'boottype', 'bootmode', 'account', 'domain', 'zonename'], tabs: [{ component: () => import('@/views/compute/InstanceTab.vue') }],