mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
new UI - snapshots page - implement delete snapshot action.
This commit is contained in:
parent
e583473252
commit
e8a16e052c
@ -101,20 +101,23 @@ function doActionToDetailsTab(id, $actionLink, apiCommand, listAPIMap) {
|
||||
if (result.jobstatus == 1) { // Succeeded
|
||||
$detailsTab.find("#action_message_box #description").text(label + " action succeeded.");
|
||||
$detailsTab.find("#action_message_box").removeClass("error").show();
|
||||
|
||||
//DestroyVirtualMachine API doesn't return an embedded object on success (Bug 6041)
|
||||
//Before Bug 6041 get fixed, use the temporary solution below.
|
||||
$.ajax({
|
||||
cache: false,
|
||||
data: createURL("command="+listAPI+"&id="+id),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]);
|
||||
}
|
||||
});
|
||||
//After Bug 6037 is fixed, remove temporary solution above and uncomment the line below
|
||||
//afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]);
|
||||
|
||||
if(apiCommand.indexOf("command=delete")!=0) {
|
||||
//DestroyVirtualMachine API doesn't return an embedded object on success (Bug 6041)
|
||||
//Before Bug 6041 get fixed, use the temporary solution below.
|
||||
$.ajax({
|
||||
cache: false,
|
||||
data: createURL("command="+listAPI+"&id="+id),
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]);
|
||||
}
|
||||
});
|
||||
//After Bug 6037 is fixed, remove temporary solution above and uncomment the line below
|
||||
//afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]);
|
||||
}
|
||||
else { //apiCommand is deleteXXXXXXX
|
||||
afterActionSeccessFn(id);
|
||||
}
|
||||
} else if (result.jobstatus == 2) { // Failed
|
||||
$detailsTab.find("#action_message_box #description").text(label + " action failed. Reason: " + sanitizeXSS(result.jobresult));
|
||||
$detailsTab.find("#action_message_box").addClass("error").show();
|
||||
|
||||
@ -24,9 +24,7 @@ function snapshotToRigntPanel($midmenuItem) {
|
||||
|
||||
function snapshotJsonToDetailsTab(jsonObj) {
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
$detailsTab.data("jsonObj", jsonObj);
|
||||
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
$detailsTab.data("jsonObj", jsonObj);
|
||||
$detailsTab.find("#id").text(jsonObj.id);
|
||||
$detailsTab.find("#name").text(fromdb(jsonObj.name));
|
||||
$detailsTab.find("#volume_name").text(fromdb(jsonObj.volumename));
|
||||
@ -38,7 +36,19 @@ function snapshotJsonToDetailsTab(jsonObj) {
|
||||
//actions ***
|
||||
var $actionMenu = $("#right_panel_content #tab_content_details #action_link #action_menu");
|
||||
$actionMenu.find("#action_list").empty();
|
||||
buildActionLinkForDetailsTab("Create Volume", snapshotActionMap, $actionMenu, snapshotListAPIMap);
|
||||
buildActionLinkForDetailsTab("Create Volume", snapshotActionMap, $actionMenu, snapshotListAPIMap);
|
||||
buildActionLinkForDetailsTab("Delete snapshot", snapshotActionMap, $actionMenu, snapshotListAPIMap);
|
||||
}
|
||||
|
||||
function snapshotClearRightPanel() {
|
||||
var $detailsTab = $("#right_panel_content #tab_content_details");
|
||||
$detailsTab.find("#id").text("");
|
||||
$detailsTab.find("#name").text("");
|
||||
$detailsTab.find("#volume_name").text("");
|
||||
$detailsTab.find("#interval_type").text("");
|
||||
$detailsTab.find("#account").text("");
|
||||
$detailsTab.find("#domain").text("");
|
||||
$detailsTab.find("#created").text("");
|
||||
}
|
||||
|
||||
var snapshotActionMap = {
|
||||
@ -47,10 +57,21 @@ var snapshotActionMap = {
|
||||
asyncJobResponse: "createvolumeresponse",
|
||||
dialogBeforeActionFn : doCreateVolumeFromSnapshotInSnapshotPage,
|
||||
inProcessText: "Creating Volume....",
|
||||
afterActionSeccessFn: function(jsonObj) {
|
||||
|
||||
afterActionSeccessFn: function(jsonObj) {}
|
||||
}
|
||||
,
|
||||
"Delete snapshot": {
|
||||
api: "deleteSnapshot",
|
||||
isAsyncJob: true,
|
||||
asyncJobResponse: "deletesnapshotresponse",
|
||||
inProcessText: "Deleting snapshot....",
|
||||
afterActionSeccessFn: function(id) {
|
||||
var $midmenuItem1 = $("#midmenuItem_"+id);
|
||||
$midmenuItem1.remove();
|
||||
clearRightPanel();
|
||||
snapshotClearRightPanel();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var snapshotListAPIMap = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user