Updated Branches:
  refs/heads/master e3f67d126 -> 4534dafba

CLOUDSTACK-1840: cloudstack UI - VM Wizard - fix a bug that the first parameter 
in jQuery.grep() should not be null.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4534dafb
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4534dafb
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4534dafb

Branch: refs/heads/master
Commit: 4534dafba120914d4d78482f1485fe4895a69211
Parents: e3f67d1
Author: Jessica Wang <[email protected]>
Authored: Thu Mar 28 16:23:05 2013 -0700
Committer: Jessica Wang <[email protected]>
Committed: Thu Mar 28 16:23:34 2013 -0700

----------------------------------------------------------------------
 ui/scripts/instanceWizard.js |   60 +++++++++++++++++++++++++++---------
 1 files changed, 45 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4534dafb/ui/scripts/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js
index 75d45aa..e1aeafd 100644
--- a/ui/scripts/instanceWizard.js
+++ b/ui/scripts/instanceWizard.js
@@ -128,10 +128,15 @@
           dataType: "json",
           async: false,
           success: function(json) {                                            
                                  
-            featuredTemplateObjs = $.grep(json.listtemplatesresponse.template, 
function(item, index) {                                                         
                          
-              if($.inArray(item.hypervisor, hypervisorArray) > -1)
-                return true;
-            });        
+            if(json.listtemplatesresponse.template == null) {
+                                                 featuredTemplateObjs = null;
+                                               }
+                                               else {
+                                                       featuredTemplateObjs = 
$.grep(json.listtemplatesresponse.template, function(item, index) {             
                                                                           
+                                                               
if($.inArray(item.hypervisor, hypervisorArray) > -1)
+                                                                       return 
true;
+                                                       });     
+                                               }
           }
         });
         $.ajax({
@@ -139,10 +144,15 @@
           dataType: "json",
           async: false,
           success: function(json) {
-            communityTemplateObjs = 
$.grep(json.listtemplatesresponse.template, function(item, index) {             
                                                                             
-              if($.inArray(item.hypervisor, hypervisorArray) > -1)
-                return true;
-            });        
+                                         
if(json.listtemplatesresponse.template == null) {
+                                                 communityTemplateObjs = null;
+                                               }
+                                               else {
+                                                       communityTemplateObjs = 
$.grep(json.listtemplatesresponse.template, function(item, index) {             
                                                                          
+                                                               
if($.inArray(item.hypervisor, hypervisorArray) > -1)
+                                                                       return 
true;
+                                                       });     
+                                               }
           }
         });
         $.ajax({
@@ -150,10 +160,15 @@
           dataType: "json",
           async: false,
           success: function(json) {
-            myTemplateObjs = $.grep(json.listtemplatesresponse.template, 
function(item, index) {                                                         
                                
-              if($.inArray(item.hypervisor, hypervisorArray) > -1)
-                return true;
-            });        
+                                         
if(json.listtemplatesresponse.template == null) {
+                                                 myTemplateObjs = null;
+                                               }
+                                               else {
+                                                       myTemplateObjs = 
$.grep(json.listtemplatesresponse.template, function(item, index) {             
                                                                         
+                                                               
if($.inArray(item.hypervisor, hypervisorArray) > -1)
+                                                                       return 
true;
+                                                       });     
+                                               }
           }
         });
       } else if (selectedTemplate == 'select-iso') {
@@ -162,7 +177,12 @@
           dataType: "json",
           async: false,
           success: function(json) {
-            featuredIsoObjs = json.listisosresponse.iso;
+                                         if(json.listisosresponse.iso == null) 
{
+                                                 featuredIsoObjs = null;
+                                               }
+                                               else {                          
        
+              featuredIsoObjs = json.listisosresponse.iso;
+                                               }
           }
         });
         $.ajax({
@@ -170,7 +190,12 @@
           dataType: "json",
           async: false,
           success: function(json) {
-            communityIsoObjs = json.listisosresponse.iso;
+                                         if(json.listisosresponse.iso == null) 
{
+                                                 communityIsoObjs = null;
+                                               }
+                                               else {                          
         
+              communityIsoObjs = json.listisosresponse.iso;
+                                               }
           }
         });
         $.ajax({
@@ -178,7 +203,12 @@
           dataType: "json",
           async: false,
           success: function(json) {
-            myIsoObjs = json.listisosresponse.iso;
+                                         if(json.listisosresponse.iso == null) 
{
+                                                 myIsoObjs = null;
+                                               }
+                                               else {                          
        
+              myIsoObjs = json.listisosresponse.iso;
+                                               }
           }
         });
       }

Reply via email to