You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2012/07/11 22:18:07 UTC

[6/17] git commit: Implement static NAT tier select UI

Implement static NAT tier select UI

Adds a new drop-down to the enable static NAT dialog to allow selecting a tier to be associated with the VM. This is in the header of the list view.

It is defined as follows:

enableStaticNAT: {
  ...
    action: {
      noAdd: true,
      custom: cloudStack.uiCustom.enableStaticNAT({
        // VPC
        tierSelect: function(args) {
          args.response.success({
            data: [
              { id: '1', description: 'VPC 1' },
              { id: '2', description: 'VPC 2' }
            ]
          });
        },
    ...


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

Branch: refs/heads/vpc
Commit: 9f093817f36f3b07883c19528e1144ffa1c52e93
Parents: c87501d
Author: Brian Federle <br...@citrix.com>
Authored: Tue Jul 10 15:31:55 2012 -0700
Committer: Brian Federle <br...@citrix.com>
Committed: Tue Jul 10 15:41:23 2012 -0700

----------------------------------------------------------------------
 ui/css/cloudstack3.css                  |   28 ++++++++++++++++++++++
 ui/scripts/network.js                   |   11 ++++++++
 ui/scripts/ui-custom/enableStaticNAT.js |   33 ++++++++++++++++++++++++++
 3 files changed, 72 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9f093817/ui/css/cloudstack3.css
----------------------------------------------------------------------
diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css
index 8e924bb..8188a01 100644
--- a/ui/css/cloudstack3.css
+++ b/ui/css/cloudstack3.css
@@ -9266,6 +9266,34 @@ div.panel.ui-dialog div.list-view div.fixed-header {
   width: 46px;
 }
 
+/*VPC: Enable Static NAT fields*/
+.list-view.instances .filters.tier-select {
+  width: 246px;
+  /*+border-radius:4px;*/
+  -moz-border-radius: 4px;
+  -webkit-border-radius: 4px;
+  -khtml-border-radius: 4px;
+  border-radius: 4px;
+  background: #8F98A1;
+  padding: 2px 20px 2px 13px;
+  margin: 1px 120px 0 19px;
+  border: 1px solid #000000;
+}
+
+.list-view.instances .filters.tier-select label {
+  color: #FFFFFF;
+  /*+text-shadow:0px 1px 3px #000000;*/
+  -moz-text-shadow: 0px 1px 3px #000000;
+  -webkit-text-shadow: 0px 1px 3px #000000;
+  -o-text-shadow: 0px 1px 3px #000000;
+  text-shadow: 0px 1px 3px #000000;
+}
+
+.list-view.instances .filters.tier-select select {
+  width: 166px;
+  float: left;
+}
+
 /*Configure ACL dialog*/
 .ui-dialog.configure-acl {
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9f093817/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index 4e0be67..bb9f4f9 100644
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -1230,9 +1230,20 @@
               },
               enableStaticNAT: {
                 label: 'label.action.enable.static.NAT',
+                
                 action: {
                   noAdd: true,
                   custom: cloudStack.uiCustom.enableStaticNAT({
+                    // VPC
+                    tierSelect: function(args) {
+                      args.response.success({
+                        data: [
+                          { id: '1', description: 'VPC 1' },
+                          { id: '2', description: 'VPC 2' }
+                        ]
+                      });
+                    },
+
                     listView: $.extend(true, {}, cloudStack.sections.instances, {
                       listView: {
                         dataProvider: function(args) {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/9f093817/ui/scripts/ui-custom/enableStaticNAT.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/enableStaticNAT.js b/ui/scripts/ui-custom/enableStaticNAT.js
index ad4fbc4..f3fbfad 100644
--- a/ui/scripts/ui-custom/enableStaticNAT.js
+++ b/ui/scripts/ui-custom/enableStaticNAT.js
@@ -18,6 +18,7 @@
   cloudStack.uiCustom.enableStaticNAT = function(args) {
     var listView = args.listView;
     var action = args.action;
+    var tierSelect = args.tierSelect;
 
     return function(args) {
       var context = args.context;
@@ -86,6 +87,7 @@
 
               $dataList.fadeOut(function() {
                 action({
+                  tierID: $dataList.find('.tier-select select').val(),
                   context: $.extend(true, {}, context, {
                     instances: [
                       $dataList.find('tr.multi-edit-selected').data('json-obj')
@@ -124,6 +126,37 @@
           }
         ]
       }).parent('.ui-dialog').overlay();
+
+      // Add tier select dialog
+      if (tierSelect) {
+        var $toolbar = $dataList.find('.toolbar');
+        var $tierSelect = $('<div>').addClass('filters tier-select').prependTo($toolbar);
+        var $tierSelectLabel = $('<label>').html('Select tier').appendTo($tierSelect);
+        var $tierSelectInput = $('<select>').appendTo($tierSelect);
+
+        // Get tier data
+        tierSelect({
+          context: context,
+          response: {
+            success: function(args) {
+              var data = args.data;
+
+              $(data).map(function(index, item) {
+                var $option = $('<option>');
+
+                $option.attr('value', item.id);
+                $option.html(item.description);
+                $option.appendTo($tierSelectInput);
+              });
+            },
+            error: function(message) {
+              cloudStack.dialog.notice({
+                message: message ? message : 'Could not retrieve VPC tiers'
+              });
+            }
+          }
+        });
+      }
     };
   };
 }(cloudStack, jQuery));
\ No newline at end of file