This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.15
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.15 by this push:
     new d68b098  UI: Show IPv6 address of Instance (#4948)
d68b098 is described below

commit d68b098a435b27c62fa46cb21fa1ca8bd3065f32
Author: Hoang Nguyen <[email protected]>
AuthorDate: Tue Apr 27 23:17:49 2021 +0700

    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 e47f3c5..015b44e 100644
--- a/ui/src/components/view/DetailsTab.vue
+++ b/ui/src/components/view/DetailsTab.vue
@@ -50,6 +50,13 @@
         </div>
       </div>
     </a-list-item>
+    <a-list-item slot="renderItem" slot-scope="item" v-else-if="item === 
'ip6address' && ipV6Address.length > 0">
+      <div>
+        <strong>{{ $t('label.' + String(item).toLowerCase()) }}</strong>
+        <br/>
+        <div>{{ ipV6Address }}</div>
+      </div>
+    </a-list-item>
     <HostInfo :resource="resource" v-if="$route.meta.name === 'host' && 
'listHosts' in $store.getters.apis" />
     <DedicateData :resource="resource" v-if="dedicatedSectionActive" />
     <VmwareData :resource="resource" v-if="$route.meta.name === 'zone' && 
'listVmwareDcs' in $store.getters.apis" />
@@ -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 d96fa0a..15156b1 100644
--- a/ui/src/components/view/InfoCard.vue
+++ b/ui/src/components/view/InfoCard.vue
@@ -313,6 +313,16 @@
             <span v-else>{{ ipaddress }}</span>
           </div>
         </div>
+        <div class="resource-detail-item" v-if="ipV6Address && ipV6Address !== 
null">
+          <div class="resource-detail-item__label">{{ $t('label.ip6address') 
}}</div>
+          <div class="resource-detail-item__details">
+            <a-icon
+              type="environment"
+              @click="$message.success(`${$t('label.copied.clipboard')} : ${ 
ipV6Address }`)"
+              v-clipboard:copy="ipV6Address" />
+            {{ ipV6Address }}
+          </div>
+        </div>
         <div class="resource-detail-item" v-if="resource.projectid || 
resource.projectname">
           <div class="resource-detail-item__label">{{ $t('label.project') 
}}</div>
           <div class="resource-detail-item__details">
@@ -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 1f56dc1..c92c852 100644
--- a/ui/src/components/view/ListView.vue
+++ b/ui/src/components/view/ListView.vue
@@ -114,6 +114,9 @@
         <a-tag>source-nat</a-tag>
       </span>
     </span>
+    <span slot="ip6address" slot-scope="text, record" href="javascript:;">
+      <span>{{ ipV6Address(text, record) }}</span>
+    </span>
     <a slot="publicip" slot-scope="text, record" href="javascript:;">
       <router-link :to="{ path: $route.path + '/' + record.id }">{{ text 
}}</router-link>
     </a>
@@ -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 39271c4..69a7018 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')
       }],

Reply via email to