new UI - volume page - implement delete volume action.

This commit is contained in:
Jessica Wang 2010-09-21 11:55:12 -07:00
parent 7a13f1afe2
commit 0435d99247
2 changed files with 61 additions and 31 deletions

View File

@ -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.
//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);
buildActionLinkForDetailsTab("Create Template", volumeActionMap, $actionMenu, volumeListAPIMap); //show create template
}
else { //jsonObj.type=="DATADISK": "detach disk" is allowed, "create template" is disallowed.
buildActionLinkForDetailsTab("Detach Disk", volumeActionMap, $actionMenu, volumeListAPIMap);
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,6 +113,12 @@ var volumeActionMap = {
dialogBeforeActionFn : doCreateTemplateFromVolume,
inProcessText: "Creating template....",
afterActionSeccessFn: function(){}
},
"Delete Volume": {
api: "deleteVolume",
isAsyncJob: false,
inProcessText: "Deleting volume....",
afterActionSeccessFn: function(){}
}
}

View File

@ -617,6 +617,7 @@ function showStorageTab(domainId, targetTab) {
currentPage = 1;
listSnapshots();
});
if (getHypervisorType() == "kvm") {
$("#dialog_add_pool #pool_cluster_container").hide();
}