mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
new UI - volume page - implement delete volume action.
This commit is contained in:
parent
7a13f1afe2
commit
0435d99247
@ -67,13 +67,36 @@ function volumeJsonToDetailsTab(jsonObj){
|
||||
//actions ***
|
||||
var $actionMenu = $("#right_panel_content #tab_content_details #action_link #action_menu");
|
||||
$actionMenu.find("#action_list").empty();
|
||||
if(jsonObj.type=="ROOT") { //"create template" is allowed(when stopped), "detach disk" is disallowed.
|
||||
if (jsonObj.vmstate == "Stopped")
|
||||
buildActionLinkForDetailsTab("Create Template", volumeActionMap, $actionMenu, volumeListAPIMap);
|
||||
}
|
||||
else { //jsonObj.type=="DATADISK": "detach disk" is allowed, "create template" is disallowed.
|
||||
buildActionLinkForDetailsTab("Detach Disk", volumeActionMap, $actionMenu, volumeListAPIMap);
|
||||
}
|
||||
|
||||
//buildActionLinkForDetailsTab("Take Snapshot", volumeActionMap, $actionMenu, volumeListAPIMap); //show take snapshot
|
||||
//buildActionLinkForDetailsTab("Recurring Snapshot", volumeActionMap, $actionMenu, volumeListAPIMap); //show Recurring Snapshot
|
||||
|
||||
if(jsonObj.type=="ROOT") {
|
||||
if (jsonObj.vmstate == "Stopped")
|
||||
buildActionLinkForDetailsTab("Create Template", volumeActionMap, $actionMenu, volumeListAPIMap); //show create template
|
||||
}
|
||||
else {
|
||||
if (jsonObj.virtualmachineid != null) {
|
||||
if (jsonObj.storagetype == "shared" && (jsonObj.vmstate == "Running" || jsonObj.vmstate == "Stopped")) {
|
||||
buildActionLinkForDetailsTab("Detach Disk", volumeActionMap, $actionMenu, volumeListAPIMap); //show detach disk
|
||||
}
|
||||
} else {
|
||||
// Disk not attached
|
||||
if (jsonObj.storagetype == "shared") {
|
||||
buildActionLinkForDetailsTab("Detach Disk", volumeActionMap, $actionMenu, volumeListAPIMap); //show attach disk
|
||||
|
||||
if(jsonObj.vmname == null || jsonObj.vmname == "none")
|
||||
buildActionLinkForDetailsTab("Delete Volume", volumeActionMap, $actionMenu, volumeListAPIMap); //show delete volume
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if(jsonObj.state == "Creating" || jsonObj.state == "Corrupted" || jsonObj.name == "attaching")
|
||||
template.find("#grid_links_container").hide(); //hide actions panel
|
||||
else
|
||||
template.find("#grid_links_container").show(); //show actions panel
|
||||
*/
|
||||
}
|
||||
|
||||
var volumeActionMap = {
|
||||
@ -90,7 +113,13 @@ var volumeActionMap = {
|
||||
dialogBeforeActionFn : doCreateTemplateFromVolume,
|
||||
inProcessText: "Creating template....",
|
||||
afterActionSeccessFn: function(){}
|
||||
}
|
||||
},
|
||||
"Delete Volume": {
|
||||
api: "deleteVolume",
|
||||
isAsyncJob: false,
|
||||
inProcessText: "Deleting volume....",
|
||||
afterActionSeccessFn: function(){}
|
||||
}
|
||||
}
|
||||
|
||||
var volumeListAPIMap = {
|
||||
|
||||
@ -595,28 +595,29 @@ function showStorageTab(domainId, targetTab) {
|
||||
}
|
||||
});
|
||||
|
||||
$("#volume_action_snapshot_grid, #volume_action_take_snapshot_container, #volume_action_recurring_snapshot_container").show();
|
||||
$("#submenu_snapshot").show().bind("click", function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
currentSubMenu.addClass("submenu_links_off").removeClass("submenu_links_on");
|
||||
$(this).addClass("submenu_links_on").removeClass("submenu_links_off");
|
||||
currentSubMenu = $(this);
|
||||
|
||||
$("#submenu_content_snapshot").show();
|
||||
$("#submenu_content_pool").hide();
|
||||
$("#submenu_content_storage").hide();
|
||||
$("#submenu_content_volume").hide();
|
||||
|
||||
var submenuContent = $("#submenu_content_snapshot");
|
||||
if (isAdmin)
|
||||
submenuContent.find("#adv_search_domain_li, #adv_search_account_li").show();
|
||||
else //There are no fields in Advanced Search Dialog Box for non-admin user. So, hide Advanced Search Link.
|
||||
submenuContent.find("#advanced_search_link").hide();
|
||||
|
||||
currentPage = 1;
|
||||
listSnapshots();
|
||||
});
|
||||
$("#volume_action_snapshot_grid, #volume_action_take_snapshot_container, #volume_action_recurring_snapshot_container").show();
|
||||
$("#submenu_snapshot").show().bind("click", function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
currentSubMenu.addClass("submenu_links_off").removeClass("submenu_links_on");
|
||||
$(this).addClass("submenu_links_on").removeClass("submenu_links_off");
|
||||
currentSubMenu = $(this);
|
||||
|
||||
$("#submenu_content_snapshot").show();
|
||||
$("#submenu_content_pool").hide();
|
||||
$("#submenu_content_storage").hide();
|
||||
$("#submenu_content_volume").hide();
|
||||
|
||||
var submenuContent = $("#submenu_content_snapshot");
|
||||
if (isAdmin)
|
||||
submenuContent.find("#adv_search_domain_li, #adv_search_account_li").show();
|
||||
else //There are no fields in Advanced Search Dialog Box for non-admin user. So, hide Advanced Search Link.
|
||||
submenuContent.find("#advanced_search_link").hide();
|
||||
|
||||
currentPage = 1;
|
||||
listSnapshots();
|
||||
});
|
||||
|
||||
if (getHypervisorType() == "kvm") {
|
||||
$("#dialog_add_pool #pool_cluster_container").hide();
|
||||
}
|
||||
@ -982,7 +983,7 @@ function showStorageTab(domainId, targetTab) {
|
||||
rowContainer.hide();
|
||||
|
||||
$.ajax({
|
||||
data: createURL("command=deleteVolume&id="+volumeId+"&response=json"),
|
||||
data: createURL("command=deleteVolume&id="+volumeId+"&response=json"),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
volumeTemplate.slideUp("slow", function(){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user