Updated Branches:
  refs/heads/master c347c6bd0 -> 808a3d75d

Instance wizard: Don't try to add a new row if list view isn't present


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

Branch: refs/heads/master
Commit: 808a3d75d9881cd7e058e598c97185bd00f855f1
Parents: c347c6b
Author: Brian Federle <[email protected]>
Authored: Thu Jun 28 11:12:26 2012 -0700
Committer: Brian Federle <[email protected]>
Committed: Thu Jun 28 11:14:02 2012 -0700

----------------------------------------------------------------------
 ui/scripts/ui-custom/instanceWizard.js |   33 +++++++++++++++-----------
 1 files changed, 19 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/808a3d75/ui/scripts/ui-custom/instanceWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/instanceWizard.js 
b/ui/scripts/ui-custom/instanceWizard.js
index 0dfcdf9..13719d4 100644
--- a/ui/scripts/ui-custom/instanceWizard.js
+++ b/ui/scripts/ui-custom/instanceWizard.js
@@ -44,27 +44,32 @@
 
           args.action({
             // Populate data
+            context: context,
             data: data,
             response: {
               success: function(args) {
-                var $loading = $('.list-view').listView('prependItem', {
-                  data: [
-                    {
-                      name: data.displayname ? data.displayname : 
_l('label.new.vm'),
-                      zonename: $wizard.find('select[name=zoneid] 
option').filter(function() {
-                        return $(this).val() == data.zoneid;
-                      }).html(),
-                      state: 'Creating'
-                    }
-                  ],
-                  actionFilter: function(args) { return []; }
-                });
+                var $listView = $('.list-view.instances');
+
+                if ($listView.size()) {
+                  var $loading = 
$('.list-view.instances').listView('prependItem', {
+                    data: [
+                      {
+                        name: data.displayname ? data.displayname : 
_l('label.new.vm'),
+                        zonename: $wizard.find('select[name=zoneid] 
option').filter(function() {
+                          return $(this).val() == data.zoneid;
+                        }).html(),
+                        state: 'Creating'
+                      }
+                    ],
+                    actionFilter: function(args) { return []; }
+                  });
+                }
 
                 listViewArgs.complete({
                   _custom: args._custom,
                   messageArgs: cloudStack.serializeForm($form),
-                  $item: $loading
-                });
+                  $item: $listView.size()? $loading : $('<div>')
+                }); 
 
                 close();
               },

Reply via email to