CS-15329: Instances with Error states appear in Instances list after creating.

This commit is contained in:
olgasmola 2012-06-25 14:41:47 +03:00 committed by Jessica Wang
parent 8a7e525aa9
commit efc45f9ee9
3 changed files with 33 additions and 3 deletions

View File

@ -537,6 +537,7 @@
dataType: "json",
success: function(json) {
var jid = json.deployvirtualmachineresponse.jobid;
var vmid = json.deployvirtualmachineresponse.id;
args.response.success(
{_custom:
{jobId: jid,
@ -548,7 +549,19 @@
},
getActionFilter: function() {
return vmActionfilter;
}
},
getUpdatedData: function() {
var item;
$.ajax({
url: createURL("listVirtualMachines&id="+vmid),
dataType: "json",
async: false,
success: function(json) {
item = json.listvirtualmachinesresponse.virtualmachine[0];
}
});
return item;
}
}
}
);

View File

@ -82,7 +82,14 @@ var pollAsyncJobResult = function(args) {
}
else if (result.jobstatus == 2) { // Failed
var msg = (result.jobresult.errortext == null)? "": result.jobresult.errortext;
args.error({message: msg});
if (args._custom.getUpdatedData != null && args._custom.getActionFilter != null) {
args.error({message: msg, updatedData: args._custom.getUpdatedData(), actionFilter: args._custom.getActionFilter()});
} else if (args._custom.getUpdatedData != null && args._custom.getActionFilter == null) {
args.error({message: msg, updatedData: args._custom.getUpdatedData()});
}
else {
args.error({message: msg});
}
}
}
},

View File

@ -93,7 +93,17 @@
// Error
function(args) {
$item.remove();
if (args && args.updatedData) {
if ($item.is(':visible') && !isHeader) {
replaceItem(
$item,
args.updatedData,
args.actionFilter
);
}
} else {
$item.remove();
}
}
);
}