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 ***
|
//actions ***
|
||||||
var $actionMenu = $("#right_panel_content #tab_content_details #action_link #action_menu");
|
var $actionMenu = $("#right_panel_content #tab_content_details #action_link #action_menu");
|
||||||
$actionMenu.find("#action_list").empty();
|
$actionMenu.find("#action_list").empty();
|
||||||
if(jsonObj.type=="ROOT") { //"create template" is allowed(when stopped), "detach disk" is disallowed.
|
|
||||||
if (jsonObj.vmstate == "Stopped")
|
//buildActionLinkForDetailsTab("Take Snapshot", volumeActionMap, $actionMenu, volumeListAPIMap); //show take snapshot
|
||||||
buildActionLinkForDetailsTab("Create Template", volumeActionMap, $actionMenu, volumeListAPIMap);
|
//buildActionLinkForDetailsTab("Recurring Snapshot", volumeActionMap, $actionMenu, volumeListAPIMap); //show Recurring Snapshot
|
||||||
}
|
|
||||||
else { //jsonObj.type=="DATADISK": "detach disk" is allowed, "create template" is disallowed.
|
if(jsonObj.type=="ROOT") {
|
||||||
buildActionLinkForDetailsTab("Detach Disk", volumeActionMap, $actionMenu, volumeListAPIMap);
|
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 = {
|
var volumeActionMap = {
|
||||||
@ -90,6 +113,12 @@ var volumeActionMap = {
|
|||||||
dialogBeforeActionFn : doCreateTemplateFromVolume,
|
dialogBeforeActionFn : doCreateTemplateFromVolume,
|
||||||
inProcessText: "Creating template....",
|
inProcessText: "Creating template....",
|
||||||
afterActionSeccessFn: function(){}
|
afterActionSeccessFn: function(){}
|
||||||
|
},
|
||||||
|
"Delete Volume": {
|
||||||
|
api: "deleteVolume",
|
||||||
|
isAsyncJob: false,
|
||||||
|
inProcessText: "Deleting volume....",
|
||||||
|
afterActionSeccessFn: function(){}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -595,28 +595,29 @@ function showStorageTab(domainId, targetTab) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#volume_action_snapshot_grid, #volume_action_take_snapshot_container, #volume_action_recurring_snapshot_container").show();
|
$("#volume_action_snapshot_grid, #volume_action_take_snapshot_container, #volume_action_recurring_snapshot_container").show();
|
||||||
$("#submenu_snapshot").show().bind("click", function(event) {
|
$("#submenu_snapshot").show().bind("click", function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
currentSubMenu.addClass("submenu_links_off").removeClass("submenu_links_on");
|
currentSubMenu.addClass("submenu_links_off").removeClass("submenu_links_on");
|
||||||
$(this).addClass("submenu_links_on").removeClass("submenu_links_off");
|
$(this).addClass("submenu_links_on").removeClass("submenu_links_off");
|
||||||
currentSubMenu = $(this);
|
currentSubMenu = $(this);
|
||||||
|
|
||||||
$("#submenu_content_snapshot").show();
|
$("#submenu_content_snapshot").show();
|
||||||
$("#submenu_content_pool").hide();
|
$("#submenu_content_pool").hide();
|
||||||
$("#submenu_content_storage").hide();
|
$("#submenu_content_storage").hide();
|
||||||
$("#submenu_content_volume").hide();
|
$("#submenu_content_volume").hide();
|
||||||
|
|
||||||
var submenuContent = $("#submenu_content_snapshot");
|
var submenuContent = $("#submenu_content_snapshot");
|
||||||
if (isAdmin)
|
if (isAdmin)
|
||||||
submenuContent.find("#adv_search_domain_li, #adv_search_account_li").show();
|
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.
|
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();
|
submenuContent.find("#advanced_search_link").hide();
|
||||||
|
|
||||||
|
currentPage = 1;
|
||||||
|
listSnapshots();
|
||||||
|
});
|
||||||
|
|
||||||
currentPage = 1;
|
|
||||||
listSnapshots();
|
|
||||||
});
|
|
||||||
if (getHypervisorType() == "kvm") {
|
if (getHypervisorType() == "kvm") {
|
||||||
$("#dialog_add_pool #pool_cluster_container").hide();
|
$("#dialog_add_pool #pool_cluster_container").hide();
|
||||||
}
|
}
|
||||||
@ -982,7 +983,7 @@ function showStorageTab(domainId, targetTab) {
|
|||||||
rowContainer.hide();
|
rowContainer.hide();
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data: createURL("command=deleteVolume&id="+volumeId+"&response=json"),
|
data: createURL("command=deleteVolume&id="+volumeId+"&response=json"),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
volumeTemplate.slideUp("slow", function(){
|
volumeTemplate.slideUp("slow", function(){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user