You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by gu...@apache.org on 2022/12/20 13:54:00 UTC

[cloudstack] branch main updated: Support for parameter `cidrlist` added to the UI (#6869)

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

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


The following commit(s) were added to refs/heads/main by this push:
     new 440d7805cb Support for parameter `cidrlist` added to the UI (#6869)
440d7805cb is described below

commit 440d7805cbccba36b619913d66165afb456f6469
Author: João Jandre <48...@users.noreply.github.com>
AuthorDate: Tue Dec 20 10:53:53 2022 -0300

    Support for parameter `cidrlist` added to the UI (#6869)
    
    Co-authored-by: João Jandre <jo...@scclouds.com.br>
---
 ui/src/components/view/BulkActionProgress.vue |  3 +++
 ui/src/components/view/BulkActionView.vue     | 13 +++++++------
 ui/src/components/widgets/TooltipLabel.vue    | 10 ++++++++--
 ui/src/views/network/LoadBalancing.vue        | 24 +++++++++++++++++++++---
 4 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/ui/src/components/view/BulkActionProgress.vue b/ui/src/components/view/BulkActionProgress.vue
index 085c458f43..ce99d23354 100644
--- a/ui/src/components/view/BulkActionProgress.vue
+++ b/ui/src/components/view/BulkActionProgress.vue
@@ -80,6 +80,9 @@
         <template #vm="{record}">
           <div><desktop-outlined /> {{ record.virtualmachinename }} ({{ record.vmguestip }})</div>
         </template>
+        <template #cidrlist="{ record }">
+          <span style="white-space: pre-line"> {{ record.cidrlist.replaceAll(" ", "\n") }}</span>
+        </template>
       </a-table>
       <br/>
     </div>
diff --git a/ui/src/components/view/BulkActionView.vue b/ui/src/components/view/BulkActionView.vue
index 38e3c62465..e30a8676d6 100644
--- a/ui/src/components/view/BulkActionView.vue
+++ b/ui/src/components/view/BulkActionView.vue
@@ -82,6 +82,9 @@
           <template #endport="{record}">
             {{ record.icmpcode || record.endport >= 0 ? record.icmpcode || record.endport : $t('label.all') }}
           </template>
+          <template #cidrlist="{record}">
+            <span style="white-space: pre-line"> {{ record.cidrlist.replaceAll(" ", "\n") }}</span>
+          </template>
         </a-table>
         <a-divider />
         <br/>
@@ -149,12 +152,6 @@ export default {
       default: () => {}
     }
   },
-  filters: {
-    capitalise: val => {
-      if (val === 'all') return 'All'
-      return val.toUpperCase()
-    }
-  },
   inject: ['parentFetchData'],
   data () {
     return {
@@ -164,6 +161,10 @@ export default {
     }
   },
   methods: {
+    capitalise (val) {
+      if (val === 'all') return 'All'
+      return val.toUpperCase()
+    },
     handleCancel () {
       this.$emit('handle-cancel')
     },
diff --git a/ui/src/components/widgets/TooltipLabel.vue b/ui/src/components/widgets/TooltipLabel.vue
index 634aed6977..2874b1e7aa 100644
--- a/ui/src/components/widgets/TooltipLabel.vue
+++ b/ui/src/components/widgets/TooltipLabel.vue
@@ -17,7 +17,12 @@
 
 <template>
   <span>
-    {{ title }}
+    <b v-if="bold">
+      {{ title }}
+    </b>
+    <span v-else>
+      {{ title }}
+    </span>
     <a-tooltip v-if="tooltip" :title="tooltip" :placement="tooltipPlacement">
       <info-circle-outlined class="tooltip-icon" />
     </a-tooltip>
@@ -40,7 +45,8 @@ export default {
     tooltipPlacement: {
       type: String,
       default: 'top'
-    }
+    },
+    bold: Boolean
   }
 }
 </script>
diff --git a/ui/src/views/network/LoadBalancing.vue b/ui/src/views/network/LoadBalancing.vue
index 089e2aca78..ace092ee8c 100644
--- a/ui/src/views/network/LoadBalancing.vue
+++ b/ui/src/views/network/LoadBalancing.vue
@@ -36,6 +36,10 @@
         </div>
       </div>
       <div class="form">
+        <div class="form__item" ref="newCidrList">
+          <tooltip-label :title="$t('label.cidrlist')" bold :tooltip="createLoadBalancerRuleParams.cidrlist.description" :tooltip-placement="'right'"/>
+          <a-input v-model:value="newRule.cidrlist"></a-input>
+        </div>
         <div class="form__item">
           <div class="form__label">{{ $t('label.algorithm') }}</div>
           <a-select
@@ -114,6 +118,9 @@
       :pagination="false"
       :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
       :rowKey="record => record.id">
+      <template #cidrlist="{ record }">
+        <span style="white-space: pre-line"> {{ record.cidrlist.replaceAll(" ", "\n") }}</span>
+      </template>
       <template #algorithm="{ record }">
         {{ returnAlgorithmName(record.algorithm) }}
       </template>
@@ -532,6 +539,7 @@ import Status from '@/components/widgets/Status'
 import TooltipButton from '@/components/widgets/TooltipButton'
 import BulkActionView from '@/components/view/BulkActionView'
 import eventBus from '@/config/eventBus'
+import TooltipLabel from '@/components/widgets/TooltipLabel'
 
 export default {
   name: 'LoadBalancing',
@@ -539,7 +547,8 @@ export default {
   components: {
     Status,
     TooltipButton,
-    BulkActionView
+    BulkActionView,
+    TooltipLabel
   },
   props: {
     resource: {
@@ -586,7 +595,8 @@ export default {
         publicport: '',
         protocol: 'tcp',
         virtualmachineid: [],
-        vmguestip: []
+        vmguestip: [],
+        cidrlist: ''
       },
       addVmModalVisible: false,
       addVmModalLoading: false,
@@ -609,6 +619,10 @@ export default {
           title: this.$t('label.privateport'),
           dataIndex: 'privateport'
         },
+        {
+          title: this.$t('label.cidrlist'),
+          slots: { customRender: 'cidrlist' }
+        },
         {
           title: this.$t('label.algorithm'),
           slots: { customRender: 'algorithm' }
@@ -684,6 +698,9 @@ export default {
       return this.selectedRowKeys.length > 0
     }
   },
+  beforeCreate () {
+    this.createLoadBalancerRuleParams = this.$getApiParams('createLoadBalancerRule')
+  },
   created () {
     this.initForm()
     this.fetchData()
@@ -1403,7 +1420,8 @@ export default {
         name: this.newRule.name,
         privateport: this.newRule.privateport,
         protocol: this.newRule.protocol,
-        publicport: this.newRule.publicport
+        publicport: this.newRule.publicport,
+        cidrlist: this.newRule.cidrlist
       }).then(response => {
         this.addVmModalVisible = false
         this.handleAssignToLBRule(response.createloadbalancerruleresponse.id)