mirror of https://github.com/apache/cloudstack.git
new UI - instance page - implement Destroy VM action for multiple-selection middle menu items.
This commit is contained in:
parent
641c7e617f
commit
d1b1a84265
|
|
@ -249,7 +249,7 @@ long milliseconds = new Date().getTime();
|
|||
Reboot VM</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actionpanel_button_wrapper" id="midmenu_destoryvm_link" style="display: none;">
|
||||
<div class="actionpanel_button_wrapper" id="midmenu_destroyvm_link" style="display: none;">
|
||||
<div class="actionpanel_button">
|
||||
<div class="actionpanel_button_icons">
|
||||
<img src="images/destroyvm_actionicon.png" alt="Destroy VM" /></div>
|
||||
|
|
|
|||
|
|
@ -180,6 +180,45 @@ function afterLoadInstanceJSP() {
|
|||
return false;
|
||||
});
|
||||
|
||||
//Destroy VM button
|
||||
$("#midmenu_destroyvm_link").show();
|
||||
$("#midmenu_destroyvm_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=destroyVirtualMachine&id="+id;
|
||||
var apiInfo = {
|
||||
label: "Destroy Instance",
|
||||
isAsyncJob: true,
|
||||
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];
|
||||
}
|
||||
});
|
||||
vmToMidmenu(jsonObj, $midmenuItem1);
|
||||
}
|
||||
}
|
||||
doActionForMidMenu(id, apiInfo, apiCommand);
|
||||
}
|
||||
|
||||
selectedItemsInMidMenu = {}; //clear selected items for action
|
||||
return false;
|
||||
});
|
||||
|
||||
// switch between different tabs
|
||||
var tabArray = [$("#tab_details"), $("#tab_volume"), $("#tab_statistics"), $("#tab_router")];
|
||||
var tabContentArray = [$("#tab_content_details"), $("#tab_content_volume"), $("#tab_content_statistics"), $("#tab_content_router")];
|
||||
|
|
|
|||
|
|
@ -520,7 +520,7 @@ function clearMiddleMenu() {
|
|||
$("#midmenu_startvm_link").unbind("click").hide();
|
||||
$("#midmenu_stopvm_link").unbind("click").hide();
|
||||
$("#midmenu_rebootvm_link").unbind("click").hide();
|
||||
$("#midmenu_destoryvm_link").unbind("click").hide();
|
||||
$("#midmenu_destroyvm_link").unbind("click").hide();
|
||||
}
|
||||
|
||||
function clearRightPanel() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue