cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject git commit: updated refs/heads/ui-vpc-redesign to 40dc221
Date Mon, 13 May 2013 21:04:11 GMT
Updated Branches:
  refs/heads/ui-vpc-redesign 57d21051b -> 40dc2211d


Implement 'add tier' action handling


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

Branch: refs/heads/ui-vpc-redesign
Commit: 40dc2211db4062d614ad8690c988ea451628c019
Parents: 57d2105
Author: Brian Federle <brian.federle@citrix.com>
Authored: Mon May 13 14:03:58 2013 -0700
Committer: Brian Federle <brian.federle@citrix.com>
Committed: Mon May 13 14:03:58 2013 -0700

----------------------------------------------------------------------
 ui/modules/vpc/vpc.js |   65 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 63 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/40dc2211/ui/modules/vpc/vpc.js
----------------------------------------------------------------------
diff --git a/ui/modules/vpc/vpc.js b/ui/modules/vpc/vpc.js
index cb712bc..22a8250 100644
--- a/ui/modules/vpc/vpc.js
+++ b/ui/modules/vpc/vpc.js
@@ -62,10 +62,69 @@
       return $router;
     },
 
-    tierPlaceholder: function() {
+    tierPlaceholder: function(args) {
+      var context = args.context;
       var $placeholder = $('<div>').addClass('tier-placeholder');
 
       $placeholder.append($('<span>').append('Create network'));
+      $placeholder.click(function() {
+        var addAction = cloudStack.vpc.tiers.actions.add;
+        var form = cloudStack.dialog.createForm({
+          context: context,
+          form: addAction.createForm,
+          after: function(args) {
+            var $loading = $('<div>').addClass('loading-overlay')
+              .prependTo($placeholder);
+
+            addAction.action({
+              context: context,
+              data: args.data,
+              response: {
+                success: function(args) {
+                  var tier = args.data;
+
+                  cloudStack.ui.notifications.add(
+                    // Notification
+                    {
+                      desc: addAction.label
+                    },
+
+                    // Success
+                    function(args) {
+                      $loading.remove();
+                      // addNewTier({
+                      //   ipAddresses: ipAddresses,
+                      //   $browser: $browser,
+                      //   tierDetailView: tierDetailView,
+                      //   context: $.extend(true, {}, context, {
+                      //     networks: [tier]
+                      //   }),
+                      //   tier: tier,
+                      //   acl: acl,
+                      //   $tiers: $tiers,
+                      //   actions: actions,
+                      //   actionPreFilter: actionPreFilter,
+                      //   vmListView: vmListView
+                      // });
+                    },
+
+                    {},
+
+                    // Error
+                    function(args) {
+                      $loading.remove();
+                    }
+                  );
+                },
+                error: function(errorMsg) {
+                  cloudStack.dialog.notice({ message: _s(errorMsg) });
+                  $loading.remove();
+                }
+              }
+            });
+          }
+        });
+      });
       
       return $placeholder;
     },
@@ -168,7 +227,9 @@
             });
 
             // Add placeholder tier
-            $tiers.append(elems.tierPlaceholder());
+            $tiers.append(elems.tierPlaceholder({
+              context: context
+            }));
           }
         }
       });


Mime
View raw message