You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2012/08/17 01:49:03 UTC

[10/32] git commit: CS-16016: Reset input field to default value on add

CS-16016: Reset input field to default value on add

Conflicts:
	ui/scripts/vpc.js


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

Branch: refs/heads/4.0
Commit: ccec9e75daf89c718fa0739793dc6d25b9825eb5
Parents: 8d73830
Author: Brian Federle <br...@citrix.com>
Authored: Thu Aug 16 13:43:49 2012 -0700
Committer: Alex Huang <al...@citrix.com>
Committed: Thu Aug 16 16:43:28 2012 -0700

----------------------------------------------------------------------
 ui/scripts/ui/widgets/multiEdit.js |   21 ++++++++++++++++++---
 ui/scripts/vpc.js                  |    4 ++--
 2 files changed, 20 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ccec9e75/ui/scripts/ui/widgets/multiEdit.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui/widgets/multiEdit.js b/ui/scripts/ui/widgets/multiEdit.js
index 355ebbe..e4fc026 100644
--- a/ui/scripts/ui/widgets/multiEdit.js
+++ b/ui/scripts/ui/widgets/multiEdit.js
@@ -782,7 +782,11 @@
                   );
 
             if (field.isDisabled) $input.hide();
-            if (field.defaultValue) $input.val(field.defaultValue);
+
+            if (field.defaultValue) {
+              $input.val(field.defaultValue);
+              $input.data('multi-default-value', field.defaultValue);
+            }
           });
         } else {
           var $input = $('<input>')
@@ -795,7 +799,10 @@
                 .appendTo($td);
 
           if (field.isDisabled) $input.hide();
-          if (field.defaultValue) $input.val(field.defaultValue);
+          if (field.defaultValue) {
+            $input.val(field.defaultValue);
+            $input.data('multi-default-value', field.defaultValue);
+          }
         }
       } else if (field.custom) {
         $('<div>').addClass('button add-vm custom-action')
@@ -887,7 +894,15 @@
         $dataBody.prepend($loading);
 
         // Clear out fields
-        $multi.find('input').val('');
+        $multi.find('input').each(function() {
+          var $input = $(this);
+
+          if ($input.data('multi-default-value')) {
+            $input.val($input.data('multi-default-value'));
+          } else {
+            $input.val('');
+          }
+        });
         $multi.find('tbody td').each(function() {
           var $item = $(this);
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ccec9e75/ui/scripts/vpc.js
----------------------------------------------------------------------
diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js
index d25458b..8d79040 100644
--- a/ui/scripts/vpc.js
+++ b/ui/scripts/vpc.js
@@ -111,8 +111,8 @@
           });
         }
       },
-      'icmptype': { edit: true, label: 'ICMP.type', isDisabled: true , desc:'Please specify -1 if you want to allow any', defaultValue:'-1'},
-      'icmpcode': { edit: true, label: 'ICMP.code', isDisabled: true , desc:'Please specify -1 if you want to allow any', defaultValue:'-1'},
+      'icmptype': { edit: true, label: 'ICMP.type', isDisabled: true, desc:'Please specify -1 if you want to allow all ICMP types', defaultValue:'-1' },
+      'icmpcode': { edit: true, label: 'ICMP.code', isDisabled: true, desc:'Please specify -1 if you want to allow all ICMP codes', defaultValue:'-1' },
       'traffictype' : {
         label: 'Traffic type',
         select: function(args) {