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 d3d7a6c  Fixes ostype combobox not respond (#890)
d3d7a6c is described below

commit d3d7a6c8a42f67c29479d0c91a229e080487c679
Author: Hoang Nguyen <[email protected]>
AuthorDate: Mon Dec 7 20:14:17 2020 +0700

    Fixes ostype combobox not respond (#890)
---
 src/views/image/RegisterOrUploadIso.vue      |  7 +++----
 src/views/image/RegisterOrUploadTemplate.vue | 15 ++++++++-------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/views/image/RegisterOrUploadIso.vue 
b/src/views/image/RegisterOrUploadIso.vue
index d70d282..a5b2a6a 100644
--- a/src/views/image/RegisterOrUploadIso.vue
+++ b/src/views/image/RegisterOrUploadIso.vue
@@ -118,7 +118,7 @@
             }"
             :loading="osTypeLoading"
             :placeholder="apiParams.ostypeid.description">
-            <a-select-option :value="opt.description" v-for="(opt, optIndex) 
in osTypes" :key="optIndex">
+            <a-select-option :value="opt.id" v-for="(opt, optIndex) in 
osTypes" :key="optIndex">
               {{ opt.name || opt.description }}
             </a-select-option>
           </a-select>
@@ -244,7 +244,7 @@ export default {
         this.osTypes = this.osTypes.concat(listOsTypes)
       }).finally(() => {
         this.osTypeLoading = false
-        this.defaultOsType = this.osTypes[0].description
+        this.defaultOsType = this.osTypes[0].id
       })
     },
     handleRemove (file) {
@@ -320,8 +320,7 @@ export default {
               params[key] = zone[0].id
               break
             case 'ostypeid':
-              var os = this.osTypes.filter(osType => osType.description === 
input)
-              params[key] = os[0].id
+              params[key] = input
               break
             default:
               params[key] = input
diff --git a/src/views/image/RegisterOrUploadTemplate.vue 
b/src/views/image/RegisterOrUploadTemplate.vue
index 597685c..c55410f 100644
--- a/src/views/image/RegisterOrUploadTemplate.vue
+++ b/src/views/image/RegisterOrUploadTemplate.vue
@@ -252,8 +252,12 @@
             <a-form-item :label="$t('label.ostypeid')">
               <a-select
                 showSearch
+                optionFilterProp="children"
+                :filterOption="(input, option) => {
+                  return 
option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase())
 >= 0
+                }"
                 v-decorator="['ostypeid', {
-                  initialValue: defaultOsType,
+                  initialValue: defaultOsId,
                   rules: [
                     {
                       required: true,
@@ -263,7 +267,7 @@
                 }]"
                 :loading="osTypes.loading"
                 :placeholder="apiParams.ostypeid.description">
-                <a-select-option v-for="opt in osTypes.opts" :key="opt.name || 
opt.description">
+                <a-select-option v-for="opt in osTypes.opts" :key="opt.id">
                   {{ opt.name || opt.description }}
                 </a-select-option>
               </a-select>
@@ -792,12 +796,9 @@ export default {
             }
             params[key] = input.join()
           } else if (key === 'zoneid') {
-            params[key] = values[key]
+            params[key] = input
           } else if (key === 'ostypeid') {
-            const osTypeSelected = this.osTypes.opts.filter(item => 
item.description === input)
-            if (osTypeSelected && osTypeSelected[0]) {
-              params[key] = osTypeSelected[0].id
-            }
+            params[key] = input
           } else if (key === 'hypervisor') {
             params[key] = this.hyperVisor.opts[input].name
           } else if (key === 'groupenabled') {

Reply via email to