mirror of https://github.com/apache/cloudstack.git
new UI - StartVM, StopVM, RebootVM, DestroyVM, RestoreVM - related UI change for bug 7061 (Latest queryAsyncJobResult returns object name instead of repsonseName for the embedded object - UI has to handle it)
This commit is contained in:
parent
9deaf66a2b
commit
59a3c4e62e
|
|
@ -113,7 +113,7 @@ function initStartVMButton() {
|
|||
inProcessText: "Starting Instance....",
|
||||
asyncJobResponse: "startvirtualmachineresponse",
|
||||
afterActionSeccessFn: function(json, $midmenuItem1, id) {
|
||||
var jsonObj = json.queryasyncjobresultresponse.jobresult.startvirtualmachineresponse;
|
||||
var jsonObj = json.queryasyncjobresultresponse.jobresult.virtualmachine;
|
||||
|
||||
vmToMidmenu(jsonObj, $midmenuItem1);
|
||||
if( ($("#right_panel_content #tab_content_details").length > 0)
|
||||
|
|
@ -162,18 +162,8 @@ function initStopVMButton() {
|
|||
isAsyncJob: true,
|
||||
inProcessText: "Stopping Instance....",
|
||||
asyncJobResponse: "stopvirtualmachineresponse",
|
||||
afterActionSeccessFn: function(json, $midmenuItem1, id) {
|
||||
//call listVirtualMachine to get embedded object until bug 6486 ("StopVirtualMachine API should return an embedded object on success") is fixed.
|
||||
var jsonObj;
|
||||
$.ajax({
|
||||
data: createURL("command=listVirtualMachines&id="+id),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
jsonObj = json.listvirtualmachinesresponse.virtualmachine[0];
|
||||
}
|
||||
});
|
||||
|
||||
afterActionSeccessFn: function(json, $midmenuItem1, id) {
|
||||
var jsonObj = json.queryasyncjobresultresponse.jobresult.virtualmachine;
|
||||
vmToMidmenu(jsonObj, $midmenuItem1);
|
||||
if( ($("#right_panel_content #tab_content_details").length > 0)
|
||||
&& ($("#right_panel_content #tab_content_details").data("jsonObj") != null )
|
||||
|
|
@ -222,17 +212,7 @@ function initRebootVMButton() {
|
|||
inProcessText: "Rebooting Instance....",
|
||||
asyncJobResponse: "rebootvirtualmachineresponse",
|
||||
afterActionSeccessFn: function(json, $midmenuItem1, id) {
|
||||
//call listVirtualMachine to get embedded object until Bug 6751("rebootVirtualMachine API should return an embedded object") is fixed.
|
||||
var jsonObj;
|
||||
$.ajax({
|
||||
data: createURL("command=listVirtualMachines&id="+id),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
jsonObj = json.listvirtualmachinesresponse.virtualmachine[0];
|
||||
}
|
||||
});
|
||||
|
||||
var jsonObj = json.queryasyncjobresultresponse.jobresult.virtualmachine;
|
||||
vmToMidmenu(jsonObj, $midmenuItem1);
|
||||
if( ($("#right_panel_content #tab_content_details").length > 0)
|
||||
&& ($("#right_panel_content #tab_content_details").data("jsonObj") != null )
|
||||
|
|
@ -281,17 +261,7 @@ function initDestroyVMButton() {
|
|||
inProcessText: "Destroying Instance....",
|
||||
asyncJobResponse: "destroyvirtualmachineresponse",
|
||||
afterActionSeccessFn: function(json, $midmenuItem1, id) {
|
||||
//call listVirtualMachine to get embedded object until bug 6041 ("DestroyVirtualMachine API should return an embedded object on success") is fixed.
|
||||
var jsonObj;
|
||||
$.ajax({
|
||||
data: createURL("command=listVirtualMachines&id="+id),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
jsonObj = json.listvirtualmachinesresponse.virtualmachine[0];
|
||||
}
|
||||
});
|
||||
|
||||
var jsonObj = json.queryasyncjobresultresponse.jobresult.virtualmachine;
|
||||
vmToMidmenu(jsonObj, $midmenuItem1);
|
||||
if( ($("#right_panel_content #tab_content_details").length > 0)
|
||||
&& ($("#right_panel_content #tab_content_details").data("jsonObj") != null )
|
||||
|
|
@ -924,7 +894,7 @@ var vmActionMap = {
|
|||
inProcessText: "Starting Instance....",
|
||||
dialogBeforeActionFn : doStartVM,
|
||||
afterActionSeccessFn: function(json, $midmenuItem1, id) {
|
||||
var jsonObj = json.queryasyncjobresultresponse.jobresult.startvirtualmachineresponse;
|
||||
var jsonObj = json.queryasyncjobresultresponse.jobresult.virtualmachine;
|
||||
vmToMidmenu(jsonObj, $midmenuItem1);
|
||||
vmToRightPanel($midmenuItem1);
|
||||
}
|
||||
|
|
@ -935,17 +905,7 @@ var vmActionMap = {
|
|||
inProcessText: "Stopping Instance....",
|
||||
dialogBeforeActionFn : doStopVM,
|
||||
afterActionSeccessFn: function(json, $midmenuItem1, id) {
|
||||
//call listVirtualMachine to get embedded object until bug 6486 ("StopVirtualMachine API should return an embedded object on success") is fixed.
|
||||
var jsonObj;
|
||||
$.ajax({
|
||||
data: createURL("command=listVirtualMachines&id="+id),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
jsonObj = json.listvirtualmachinesresponse.virtualmachine[0];
|
||||
}
|
||||
});
|
||||
|
||||
var jsonObj = json.queryasyncjobresultresponse.jobresult.virtualmachine;
|
||||
vmToMidmenu(jsonObj, $midmenuItem1);
|
||||
vmToRightPanel($midmenuItem1);
|
||||
}
|
||||
|
|
@ -956,17 +916,7 @@ var vmActionMap = {
|
|||
inProcessText: "Rebooting Instance....",
|
||||
dialogBeforeActionFn : doRebootVM,
|
||||
afterActionSeccessFn: function(json, $midmenuItem1, id) {
|
||||
//call listVirtualMachine to get embedded object until Bug 6751("rebootVirtualMachine API should return an embedded object") is fixed.
|
||||
var jsonObj;
|
||||
$.ajax({
|
||||
data: createURL("command=listVirtualMachines&id="+id),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
jsonObj = json.listvirtualmachinesresponse.virtualmachine[0];
|
||||
}
|
||||
});
|
||||
|
||||
var jsonObj = json.queryasyncjobresultresponse.jobresult.virtualmachine;
|
||||
vmToMidmenu(jsonObj, $midmenuItem1);
|
||||
vmToRightPanel($midmenuItem1);
|
||||
}
|
||||
|
|
@ -976,19 +926,8 @@ var vmActionMap = {
|
|||
asyncJobResponse: "destroyvirtualmachineresponse",
|
||||
inProcessText: "Destroying Instance....",
|
||||
dialogBeforeActionFn : doDestroyVM,
|
||||
afterActionSeccessFn: function(json, $midmenuItem1, id) {
|
||||
//call listVirtualMachine to get embedded object until bug 6041 ("DestroyVirtualMachine API should return an embedded object on success") is fixed.
|
||||
var id = $midmenuItem1.data("jsonObj").id;
|
||||
var jsonObj;
|
||||
$.ajax({
|
||||
data: createURL("command=listVirtualMachines&id="+id),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
jsonObj = json.listvirtualmachinesresponse.virtualmachine[0];
|
||||
}
|
||||
});
|
||||
|
||||
afterActionSeccessFn: function(json, $midmenuItem1, id) {
|
||||
var jsonObj = json.queryasyncjobresultresponse.jobresult.virtualmachine;
|
||||
vmToMidmenu(jsonObj, $midmenuItem1);
|
||||
vmToRightPanel($midmenuItem1);
|
||||
}
|
||||
|
|
@ -998,18 +937,7 @@ var vmActionMap = {
|
|||
inProcessText: "Restoring Instance....",
|
||||
dialogBeforeActionFn : doRestoreVM,
|
||||
afterActionSeccessFn: function(json, $midmenuItem1, id) {
|
||||
//call listVirtualMachine to get embedded object until bug 6037 ("RecoverVirtualMachine API should return an embedded object on success") is fixed.
|
||||
var id = $midmenuItem1.data("jsonObj").id;
|
||||
var jsonObj;
|
||||
$.ajax({
|
||||
data: createURL("command=listVirtualMachines&id="+id),
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(json) {
|
||||
jsonObj = json.listvirtualmachinesresponse.virtualmachine[0];
|
||||
}
|
||||
});
|
||||
|
||||
var jsonObj = json.queryasyncjobresultresponse.jobresult.virtualmachine;
|
||||
vmToMidmenu(jsonObj, $midmenuItem1);
|
||||
vmToRightPanel($midmenuItem1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,8 +93,8 @@ function doActionToTab(id, $actionLink, apiCommand, $midmenuItem1, $thisTab) {
|
|||
$afterActionInfoContainer.removeClass("errorbox").show();
|
||||
afterActionSeccessFn(json, $midmenuItem1, id);
|
||||
} else if (result.jobstatus == 2) { // Failed
|
||||
handleMidMenuItemAfterDetailsTabAction($midmenuItem1, false, (label + " action failed. Reason: " + fromdb(result.jobresult)));
|
||||
$afterActionInfoContainer.find("#after_action_info").text(label + " action failed. Reason: " + fromdb(result.jobresult));
|
||||
handleMidMenuItemAfterDetailsTabAction($midmenuItem1, false, (label + " action failed. Reason: " + fromdb(result.jobresult.errortext)));
|
||||
$afterActionInfoContainer.find("#after_action_info").text(label + " action failed. Reason: " + fromdb(result.jobresult.errortext));
|
||||
$afterActionInfoContainer.addClass("errorbox").show();
|
||||
}
|
||||
}
|
||||
|
|
@ -242,7 +242,7 @@ function doActionToSubgridItem(id, $actionLink, apiCommand, $subgridItem) {
|
|||
$subgridItem.find("#after_action_info_container").removeClass("error").addClass("success").show();
|
||||
afterActionSeccessFn(json, id, $subgridItem);
|
||||
} else if (result.jobstatus == 2) { // Failed
|
||||
$subgridItem.find("#after_action_info").text(label + " action failed. Reason: " + fromdb(result.jobresult));
|
||||
$subgridItem.find("#after_action_info").text(label + " action failed. Reason: " + fromdb(result.jobresult.errortext));
|
||||
$subgridItem.find("#after_action_info_container").removeClass("success").addClass("error").show();
|
||||
}
|
||||
}
|
||||
|
|
@ -397,7 +397,7 @@ function doActionToMidMenu(id, apiInfo, apiCommand) {
|
|||
afterActionSeccessFn(json, $midmenuItem1, id);
|
||||
} else if (result.jobstatus == 2) { // Failed
|
||||
$midmenuItem1.find("#info_icon").addClass("error").show();
|
||||
$midmenuItem1.data("afterActionInfo", (label + " action failed. Reason: " + fromdb(result.jobresult)));
|
||||
$midmenuItem1.data("afterActionInfo", (label + " action failed. Reason: " + fromdb(result.jobresult.errortext)));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue