Repository: cloudstack
Updated Branches:
  refs/heads/master 7d7df0245 -> 7e0f1cf45


CLOUDSTACK-8040: UI: register template dialog, register ISO dialog - fix a bug 
that hidden fields fail to be generated before 
cloudStack.preFilter.createTemplate() is called. Thus, 
cloudStack.preFilter.createTemplate() is unable to change hidden fields's css 
display property from none to inline-block for admin users.


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

Branch: refs/heads/master
Commit: 7e0f1cf4571f9c3f6c26b8d744d2ed102fa7a511
Parents: 7d7df02
Author: Jessica Wang <jessicaw...@apache.org>
Authored: Fri Dec 5 16:47:34 2014 -0800
Committer: Jessica Wang <jessicaw...@apache.org>
Committed: Fri Dec 5 16:49:13 2014 -0800

----------------------------------------------------------------------
 ui/scripts/templates.js | 166 +++++++++++++++++++++----------------------
 1 file changed, 81 insertions(+), 85 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7e0f1cf4/ui/scripts/templates.js
----------------------------------------------------------------------
diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js
index 141b48a..e0c628b 100644
--- a/ui/scripts/templates.js
+++ b/ui/scripts/templates.js
@@ -408,20 +408,18 @@
                                     osTypeId: {
                                         label: 'label.os.type',
                                         docID: 'helpRegisterTemplateOSType',
-                                        select: function(args) {               
                                
-                                               if (ostypeObjs == undefined) {
-                                                   $.ajax({
-                                                       url: 
createURL("listOsTypes"),
-                                                       dataType: "json",
-                                                       async: false,
-                                                       success: function(json) 
{                                                               
-                                                               ostypeObjs = 
json.listostypesresponse.ostype;                                                
       
-                                                       }
-                                                   });
-                                               }                               
                
-                                               args.response.success({
-                                                data: ostypeObjs
-                                            });
+                                        select: function(args) {    
+                                            $.ajax({
+                                                url: createURL("listOsTypes"),
+                                                dataType: "json",
+                                                async: true,
+                                                success: function(json) {      
                                                        
+                                                       var ostypeObjs = 
json.listostypesresponse.ostype;
+                                                       args.response.success({
+                                                        data: ostypeObjs
+                                                    });
+                                                }
+                                            });                                
                    
                                         }
                                     },
 
@@ -849,16 +847,16 @@
                                     }
                                                                       
                                     if ('templates' in args.context && 
args.context.templates[0].ostypeid != undefined) {
-                                       if (ostypeObjs == undefined) {
-                                               $.ajax({
-                                                   url: 
createURL("listOsTypes"),
-                                                   dataType: "json",
-                                                   async: false,
-                                                   success: function(json) {   
                                        
-                                                       ostypeObjs = 
json.listostypesresponse.ostype;                                                
   
-                                                   }
-                                               });
-                                       }                               
+                                       var ostypeObjs;
+                                       $.ajax({
+                                           url: createURL("listOsTypes"),
+                                           dataType: "json",
+                                           async: false,
+                                           success: function(json) {           
                                
+                                               var ostypeObjs = 
json.listostypesresponse.ostype;                                                
       
+                                           }
+                                       });
+                                                                       
                                        if (ostypeObjs != undefined) {
                                                var ostypeName;
                                                for (var i = 0; i < 
ostypeObjs.length; i++) {
@@ -963,16 +961,16 @@
                                         label: 'label.os.type',
                                         isEditable: true,
                                         select: function(args) {
-                                               if (ostypeObjs == undefined) {
-                                                   $.ajax({
-                                                       url: 
createURL("listOsTypes"),
-                                                       dataType: "json",
-                                                       async: false,
-                                                       success: function(json) 
{                                                               
-                                                               ostypeObjs = 
json.listostypesresponse.ostype;                                                
      
-                                                       }
-                                                   });
-                                               }                               
                
+                                               var ostypeObjs;
+                                            $.ajax({
+                                                url: createURL("listOsTypes"),
+                                                dataType: "json",
+                                                async: false,
+                                                success: function(json) {      
                                                        
+                                                       ostypeObjs = 
json.listostypesresponse.ostype;                                                
      
+                                                }
+                                            });
+                                                                               
                
                                                var items = [];
                                             $(ostypeObjs).each(function() {
                                                 items.push({
@@ -1231,16 +1229,16 @@
                                                 }
                                                                                
                
                                                 if ('templates' in 
args.context && args.context.templates[0].ostypeid != undefined) {
-                                                       if (ostypeObjs == 
undefined) {
-                                                       $.ajax({
-                                                           url: 
createURL("listOsTypes"),
-                                                           dataType: "json",
-                                                           async: false,
-                                                           success: 
function(json) {                                           
-                                                               ostypeObjs = 
json.listostypesresponse.ostype;                                                
   
-                                                           }
-                                                       });
-                                                       }                       
        
+                                                       var ostypeObjs;
+                                                       $.ajax({
+                                                           url: 
createURL("listOsTypes"),
+                                                           dataType: "json",
+                                                           async: false,
+                                                           success: 
function(json) {                                           
+                                                               ostypeObjs = 
json.listostypesresponse.ostype;                                                
   
+                                                           }
+                                                       });
+                                                                               
        
                                                        if (ostypeObjs != 
undefined) {
                                                                var ostypeName;
                                                                for (var i = 0; 
i < ostypeObjs.length; i++) {
@@ -1362,16 +1360,16 @@
                                                     label: 'label.os.type',
                                                     isEditable: true,
                                                     select: function(args) {   
                                                 
-                                                       if (ostypeObjs == 
undefined) {      
-                                                               $.ajax({
-                                                                   url: 
createURL("listOsTypes"),
-                                                                   dataType: 
"json",
-                                                                   async: 
false,
-                                                                   success: 
function(json) {
-                                                                       
ostypeObjs = json.listostypesresponse.ostype;                                   
                                
-                                                                   }
-                                                               });
-                                                       }                       
                             
+                                                       var ostypeObjs;
+                                                        $.ajax({
+                                                            url: 
createURL("listOsTypes"),
+                                                            dataType: "json",
+                                                            async: false,
+                                                            success: 
function(json) {
+                                                               ostypeObjs = 
json.listostypesresponse.ostype;                                                
                   
+                                                            }
+                                                        });
+                                                                               
                            
                                                        var items = [];
                                                         
$(ostypeObjs).each(function() {
                                                             items.push({
@@ -1565,27 +1563,25 @@
                                             required: true
                                         },
                                         select: function(args) {
-                                               if (ostypeObjs == undefined) {  
 
-                                                   $.ajax({
-                                                       url: 
createURL("listOsTypes"),
-                                                       dataType: "json",
-                                                       async: false,
-                                                       success: function(json) 
{
-                                                           ostypeObjs = 
json.listostypesresponse.ostype;                                                
           
-                                                       }
-                                                   });
-                                               }
-                                               var items = [];
-                                            //items.push({id: "", description: 
"None"}); //shouldn't have None option when bootable is checked
-                                            $(ostypeObjs).each(function() {
-                                                items.push({
-                                                    id: this.id,
-                                                    description: 
this.description
-                                                });
-                                            });
-                                            args.response.success({
-                                                data: items
-                                            });
+                                               $.ajax({
+                                                url: createURL("listOsTypes"),
+                                                dataType: "json",
+                                                async: true,
+                                                success: function(json) {
+                                                    var ostypeObjs = 
json.listostypesresponse.ostype;  
+                                                    var items = [];
+                                                    //items.push({id: "", 
description: "None"}); //shouldn't have None option when bootable is checked
+                                                    
$(ostypeObjs).each(function() {
+                                                        items.push({
+                                                            id: this.id,
+                                                            description: 
this.description
+                                                        });
+                                                    });
+                                                    args.response.success({
+                                                        data: items
+                                                    });
+                                                }
+                                            });                                
                                                                
                                         }
                                     },
 
@@ -2286,16 +2282,16 @@
                                                     label: 'label.os.type',
                                                     isEditable: true,
                                                     select: function(args) {
-                                                       if (ostypeObjs == 
undefined) {  
-                                                               $.ajax({
-                                                                   url: 
createURL("listOsTypes"),
-                                                                   dataType: 
"json",
-                                                                   async: 
false,
-                                                                   success: 
function(json) {
-                                                                       
ostypeObjs = json.listostypesresponse.ostype;                                   
                                
-                                                                   }
-                                                               });
-                                                       }
+                                                       var ostypeObjs;
+                                                        $.ajax({
+                                                            url: 
createURL("listOsTypes"),
+                                                            dataType: "json",
+                                                            async: false,
+                                                            success: 
function(json) {
+                                                               ostypeObjs = 
json.listostypesresponse.ostype;                                                
                   
+                                                            }
+                                                        });
+                                                       
                                                        var items = [];
                                                         
$(ostypeObjs).each(function() {
                                                             items.push({

Reply via email to