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

This commit is contained in:
Brian Federle 2012-06-28 11:12:26 -07:00
parent 8a94f5c5da
commit 017885b5f1
1 changed files with 19 additions and 14 deletions

View File

@ -40,27 +40,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();
},