You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/08/25 07:37:48 UTC

[cloudstack-primate] branch master updated: Fixes an issue that could not search on zone select (#602)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 5eb3ede  Fixes an issue that could not search on zone select (#602)
5eb3ede is described below

commit 5eb3ede23aa13c39d2df09d640d025650f0d649b
Author: Hoang Nguyen <ho...@unitech.vn>
AuthorDate: Tue Aug 25 14:37:42 2020 +0700

    Fixes an issue that could not search on zone select (#602)
    
    * Fixes an issue that could not search on zone select
    
    * Fixes show error from console
    
    * add search zone for Upload ISO
---
 src/views/image/RegisterOrUploadIso.vue      | 13 +++----------
 src/views/image/RegisterOrUploadTemplate.vue | 15 +++++++++++----
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/views/image/RegisterOrUploadIso.vue b/src/views/image/RegisterOrUploadIso.vue
index 501d528..b244a2b 100644
--- a/src/views/image/RegisterOrUploadIso.vue
+++ b/src/views/image/RegisterOrUploadIso.vue
@@ -91,14 +91,7 @@
             :loading="zoneLoading"
             :placeholder="apiParams.zoneid.description">
             <a-select-option :value="opt.id" v-for="opt in zones" :key="opt.id">
-              <div v-if="currentForm === 'Upload'">
-                <div v-if="opt.name !== $t('label.all.zone')">
-                  {{ opt.name || opt.description }}
-                </div>
-              </div>
-              <div v-else>
-                {{ opt.name || opt.description }}
-              </div>
+              {{ opt.name || opt.description }}
             </a-select-option>
           </a-select>
         </a-form-item>
@@ -205,7 +198,7 @@ export default {
   },
   created () {
     this.zones = []
-    if (this.$store.getters.userInfo.roletype === 'Admin') {
+    if (this.$store.getters.userInfo.roletype === 'Admin' && this.currentForm === 'Create') {
       this.zones = [
         {
           id: '-1',
@@ -235,7 +228,7 @@ export default {
         this.zones = this.zones.concat(listZones)
       }).finally(() => {
         this.zoneLoading = false
-        this.selectedZone = this.currentForm === 'Create' ? (this.zones[0].id ? this.zones[0].id : '') : ((this.zones[1].id) ? this.zones[1].id : '')
+        this.selectedZone = (this.zones[0].id ? this.zones[0].id : '')
       })
     },
     fetchOsType () {
diff --git a/src/views/image/RegisterOrUploadTemplate.vue b/src/views/image/RegisterOrUploadTemplate.vue
index 19d85fc..d0b4689 100644
--- a/src/views/image/RegisterOrUploadTemplate.vue
+++ b/src/views/image/RegisterOrUploadTemplate.vue
@@ -95,6 +95,10 @@
                   }]"
                   :loading="zones.loading"
                   mode="multiple"
+                  optionFilterProp="children"
+                  :filterOption="(input, option) => {
+                    return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+                  }"
                   :placeholder="apiParams.zoneids.description"
                   @change="handlerSelectZone">
                   <a-select-option v-for="opt in zones.opts" :key="opt.id">
@@ -122,13 +126,16 @@
                       }
                     ]
                   }]"
+                  showSearch
+                  optionFilterProp="children"
+                  :filterOption="(input, option) => {
+                    return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+                  }"
                   @change="handlerSelectZone"
                   :placeholder="apiParams.zoneid.description"
                   :loading="zones.loading">
                   <a-select-option :value="zone.id" v-for="zone in zones.opts" :key="zone.id">
-                    <div v-if="zone.name !== $t('label.all.zone')">
-                      {{ zone.name || zone.description }}
-                    </div>
+                    {{ zone.name || zone.description }}
                   </a-select-option>
                 </a-select>
               </a-form-item>
@@ -517,7 +524,7 @@ export default {
 
       this.allowed = false
 
-      if (store.getters.userInfo.roletype === this.rootAdmin) {
+      if (store.getters.userInfo.roletype === this.rootAdmin && this.currentForm === 'Create') {
         this.allowed = true
         listZones.push({
           id: this.$t('label.all.zone'),