mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
new UI - instance page - implement Stop VM action for multiple-selection middle menu items.
This commit is contained in:
parent
1e32ae0871
commit
c2fb123fd8
@ -81,7 +81,7 @@ function afterLoadInstanceJSP() {
|
|||||||
}
|
}
|
||||||
if(itemCounts == 0) {
|
if(itemCounts == 0) {
|
||||||
$("#dialog_info_please_select_one_item_in_middle_menu").dialog("open");
|
$("#dialog_info_please_select_one_item_in_middle_menu").dialog("open");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(var id in selectedItemsInMidMenu) {
|
for(var id in selectedItemsInMidMenu) {
|
||||||
@ -102,6 +102,45 @@ function afterLoadInstanceJSP() {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//Stop VM button
|
||||||
|
$("#midmenu_stopvm_link").show();
|
||||||
|
$("#midmenu_stopvm_link").bind("click", function(event) {
|
||||||
|
var itemCounts = 0;
|
||||||
|
for(var id in selectedItemsInMidMenu) {
|
||||||
|
itemCounts ++;
|
||||||
|
}
|
||||||
|
if(itemCounts == 0) {
|
||||||
|
$("#dialog_info_please_select_one_item_in_middle_menu").dialog("open");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(var id in selectedItemsInMidMenu) {
|
||||||
|
var apiCommand = "command=stopVirtualMachine&id="+id;
|
||||||
|
var apiInfo = {
|
||||||
|
label: "Stop Instance",
|
||||||
|
isAsyncJob: true,
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
vmToMidmenu(jsonObj, $midmenuItem1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
doActionForMidMenu(id, apiInfo, apiCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedItemsInMidMenu = {}; //clear selected items for action
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
// switch between different tabs
|
// switch between different tabs
|
||||||
var tabArray = [$("#tab_details"), $("#tab_volume"), $("#tab_statistics"), $("#tab_router")];
|
var tabArray = [$("#tab_details"), $("#tab_volume"), $("#tab_statistics"), $("#tab_router")];
|
||||||
var tabContentArray = [$("#tab_content_details"), $("#tab_content_volume"), $("#tab_content_statistics"), $("#tab_content_router")];
|
var tabContentArray = [$("#tab_content_details"), $("#tab_content_volume"), $("#tab_content_statistics"), $("#tab_content_router")];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user