incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [17/31] git commit: Revert commit f090fdeea748e72b92878d955764d5059055e69d "CS-15292: Split long OS Type list when create Template, ISO." which causes bug 39 (https://issues.apache.org/jira/browse/CLOUDSTACK-39) that blocks QA's testing since QA is unable
Date Fri, 14 Sep 2012 18:21:01 GMT
Revert commit f090fdeea748e72b92878d955764d5059055e69d "CS-15292: Split long OS Type list when
create Template,ISO." which causes bug 39 (https://issues.apache.org/jira/browse/CLOUDSTACK-39)
that blocks QA's testing since QA is unable to select a provider on any service during network
offering creation.


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

Branch: refs/heads/javelin
Commit: 90a649753c9ed411a3f45209c2943b8648db9033
Parents: 125a6fe
Author: Jessica Wang <jessica.wang@citrix.com>
Authored: Thu Sep 13 16:02:48 2012 -0700
Committer: Jessica Wang <jessica.wang@citrix.com>
Committed: Thu Sep 13 16:04:06 2012 -0700

----------------------------------------------------------------------
 ui/scripts/templates.js |   70 ++------------------------
 ui/scripts/ui/dialog.js |  116 +++++++++++++++++++----------------------
 2 files changed, 58 insertions(+), 128 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/90a64975/ui/scripts/templates.js
----------------------------------------------------------------------
diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js
index d926d05..7a99d79 100644
--- a/ui/scripts/templates.js
+++ b/ui/scripts/templates.js
@@ -204,42 +204,11 @@
                     }
                   },
 
-                  osCategory: {
-                    label: 'OS Category',
-                    select: function(args) {
-                      $.ajax({
-                        url: createURL("listOsCategories"),
-                        dataType: "json",
-                        async: true,
-                        success: function(json) {
-                          var osCats = json.listoscategoriesresponse.oscategory;
-                          var items = [];
-                          if (isAdmin())
-                            items.push({id: -1, description: "All OS"});
-                          $(osCats).each(function() {
-                            items.push({id: this.id, description: this.name});
-                          });
-                          args.response.success({data: items});
-                        }
-                      });
-                    }
-                  },
-
                   osTypeId: {
                     label: 'label.os.type',
-                    dependsOn: 'osCategory',
                     select: function(args) {
-                      if(args.osCategory == null)
-                        return;
-
-                      var apiCmd;
-                      if(args.osCategory == -1)
-                        apiCmd = "listOsTypes";
-                      else
-                        apiCmd = "listOsTypes&oscategoryid=" + args.osCategory;
-
                       $.ajax({
-                        url: createURL(apiCmd),
+                        url: createURL("listOsTypes"),
                         dataType: "json",
                         async: true,
                         success: function(json) {
@@ -814,46 +783,15 @@
                     isBoolean: true,
                     isChecked: true
                   },
-                  
-                  osCategory: {
-                    label: 'OS Category',
-                    dependsOn: 'isBootable',
-                    select: function(args) {
-                      $.ajax({
-                        url: createURL("listOsCategories"),
-                        dataType: "json",
-                        async: true,
-                        success: function(json) {
-                          var osCats = json.listoscategoriesresponse.oscategory;
-                          var items = [];
-                          if (isAdmin())
-                            items.push({id: -1, description: "All OS"});
-                          $(osCats).each(function() {
-                            items.push({id: this.id, description: this.name});
-                          });
-                          args.response.success({data: items});
-                        }
-                      });
-                    }
-                  },
-                  
+
                   osTypeId: {
                     label: 'label.os.type',
-                    dependsOn: ['isBootable','osCategory'],
+                    dependsOn: 'isBootable',
                     isHidden: false,
                     validation: { required: true },
                     select: function(args) {
-                      if(args.osCategory == null)
-                        return;
-
-                      var apiCmd;
-                      if(args.osCategory == -1)
-                        apiCmd = "listOsTypes";
-                      else
-                        apiCmd = "listOsTypes&oscategoryid=" + args.osCategory;
-
                       $.ajax({
-                        url: createURL(apiCmd),
+                        url: createURL("listOsTypes"),
                         dataType: "json",
                         async: true,
                         success: function(json) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/90a64975/ui/scripts/ui/dialog.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js
index 88ffe57..2d22637 100644
--- a/ui/scripts/ui/dialog.js
+++ b/ui/scripts/ui/dialog.js
@@ -117,56 +117,52 @@
         var $value = $('<div>').addClass('value')
               .appendTo($formItem);
         var $input, $dependsOn, selectFn, selectArgs;
-        var dependsOn = $.isArray(field.dependsOn) ? field.dependsOn : [field.dependsOn]
; //now an array
+        var dependsOn = field.dependsOn;
 
         // Depends on fields
-        if (dependsOn.length) {
-          $.each(dependsOn, function(key, value){
-            var dependsOn = value;
-
-            $formItem.attr('depends-on-'+value, dependsOn);
-            $dependsOn = $form.find('input, select').filter(function() {
-              return $(this).attr('name') === dependsOn;
-            });
+        if (field.dependsOn) {
+          $formItem.attr('depends-on', dependsOn);
+          $dependsOn = $form.find('input, select').filter(function() {
+            return $(this).attr('name') === dependsOn;
+          });
 
-            if ($dependsOn.is('[type=checkbox]')) {
-              var isReverse = args.form.fields[dependsOn].isReverse;
+          if ($dependsOn.is('[type=checkbox]')) {
+            var isReverse = args.form.fields[dependsOn].isReverse;
 
-              // Checkbox
-              $dependsOn.bind('click', function(event) {
-                var $target = $(this);
-                var $dependent = $target.closest('form').find('[depends-on-' + value + '=\''
+ dependsOn + '\']');
+            // Checkbox
+            $dependsOn.bind('click', function(event) {
+              var $target = $(this);
+              var $dependent = $target.closest('form').find('[depends-on=\'' + dependsOn
+ '\']');
 
-                if (($target.is(':checked') && !isReverse) ||
+              if (($target.is(':checked') && !isReverse) ||
                   ($target.is(':unchecked') && isReverse)) {
-                  $dependent.css('display', 'inline-block');
-                  $dependent.each(function() {
-                    if ($(this).find('select').data('dialog-select-fn')) {
-                      $(this).find('select').data('dialog-select-fn')();
-                    }
-                  });
-                } else if (($target.is(':unchecked') && !isReverse) ||
-                           ($target.is(':checked') && isReverse)) {
-                  $dependent.hide();
-                }
+                $dependent.css('display', 'inline-block');
+                $dependent.each(function() {
+                  if ($(this).data('dialog-select-fn')) {
+                    $(this).data('dialog-select-fn')();
+                  }
+                });
+              } else if (($target.is(':unchecked') && !isReverse) ||
+                         ($target.is(':checked') && isReverse)) {
+                $dependent.hide();
+              }
 
-                $dependent.find('input[type=checkbox]').click();
+              $dependent.find('input[type=checkbox]').click();
 
-                if (!isReverse) {
-                  $dependent.find('input[type=checkbox]').attr('checked', false);
-                } else {
-                  $dependent.find('input[type=checkbox]').attr('checked', true);
-                }
+              if (!isReverse) {
+                $dependent.find('input[type=checkbox]').attr('checked', false);
+              } else {
+                $dependent.find('input[type=checkbox]').attr('checked', true);
+              }
 
-                return true;
-              });
+              return true;
+            });
 
-              // Show fields by default if it is reverse checkbox
-              if (isReverse) {
-                $dependsOn.click();
-              }
-            };
-          });
+            // Show fields by default if it is reverse checkbox
+            if (isReverse) {
+              $dependsOn.click();
+            }
+          }
         }
 
         // Determine field type of input
@@ -211,35 +207,31 @@
           // Pass form item to provider for additional manipulation
           $.extend(selectArgs, { $select: $input });
 
-          if (dependsOn.length) {
-            $.each(dependsOn, function(key, value){
-              var dependsOn = value;
-
-              $dependsOn = $input.closest('form').find('input, select').filter(function()
{
-                return $(this).attr('name') === dependsOn;
-              });
-
-              $dependsOn.bind('change', function(event) {
-                var $target = $(this);
-
-                if (!$dependsOn.is('select')) return true;
+          if (dependsOn) {
+            $dependsOn = $input.closest('form').find('input, select').filter(function() {
+              return $(this).attr('name') === dependsOn;
+            });
 
-                var dependsOnArgs = {};
+            $dependsOn.bind('change', function(event) {
+              var $target = $(this);
 
-                $input.find('option').remove();
+              if (!$dependsOn.is('select')) return true;
 
-                if (!$target.children().size()) return true;
+              var dependsOnArgs = {};
 
-                dependsOnArgs[dependsOn] = $target.val();
-                selectFn($.extend(selectArgs, dependsOnArgs));
+              $input.find('option').remove();
+             
+              if (!$target.children().size()) return true;
 
-                return true;
-              });
+              dependsOnArgs[dependsOn] = $target.val();
+              selectFn($.extend(selectArgs, dependsOnArgs));
 
-              if (!$dependsOn.is('select')) {
-                selectFn(selectArgs);
-              }
+              return true;
             });
+
+            if (!$dependsOn.is('select')) {
+              selectFn(selectArgs);
+            }
           } else {
             selectFn(selectArgs);
           }


Mime
View raw message