From f89e11bb21a0100a70f5755224481b7046dc9741 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Tue, 21 Sep 2010 15:37:22 -0700 Subject: [PATCH] new UI - volume page - implement take snapshot action. --- ui/new/jsp/volume.jsp | 6 +++++ ui/new/scripts/cloud.core2.volume.js | 35 ++++++++++++++++++++++++---- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/ui/new/jsp/volume.jsp b/ui/new/jsp/volume.jsp index 179a6f4052d..0b0cd193cda 100644 --- a/ui/new/jsp/volume.jsp +++ b/ui/new/jsp/volume.jsp @@ -218,3 +218,9 @@ + + + diff --git a/ui/new/scripts/cloud.core2.volume.js b/ui/new/scripts/cloud.core2.volume.js index a7739cdbf18..bba2752634f 100644 --- a/ui/new/scripts/cloud.core2.volume.js +++ b/ui/new/scripts/cloud.core2.volume.js @@ -5,7 +5,11 @@ function afterLoadVolumeJSP() { modal: true, zIndex: 2000 })); - + activateDialog($("#dialog_create_snapshot").dialog({ + autoOpen: false, + modal: true, + zIndex: 2000 + })); $.ajax({ data: createURL("command=listOsTypes&response=json"), @@ -68,7 +72,7 @@ function volumeJsonToDetailsTab(jsonObj){ var $actionMenu = $("#right_panel_content #tab_content_details #action_link #action_menu"); $actionMenu.find("#action_list").empty(); - //buildActionLinkForDetailsTab("Take Snapshot", volumeActionMap, $actionMenu, volumeListAPIMap); //show take snapshot + buildActionLinkForDetailsTab("Take Snapshot", volumeActionMap, $actionMenu, volumeListAPIMap); //show take snapshot //buildActionLinkForDetailsTab("Recurring Snapshot", volumeActionMap, $actionMenu, volumeListAPIMap); //show Recurring Snapshot if(jsonObj.state != "Creating" && jsonObj.state != "Corrupted" && jsonObj.name != "attaching") { @@ -134,7 +138,14 @@ var volumeActionMap = { clearRightPanel(); volumeClearRightPanel(); } - } + }, + "Take Snapshot": { + isAsyncJob: true, + asyncJobResponse: "createsnapshotresponse", + dialogBeforeActionFn : doTakeSnapshot, + inProcessText: "Taking Snapshot....", + afterActionSeccessFn: function(){} + } } var volumeListAPIMap = { @@ -173,4 +184,20 @@ function doCreateTemplateFromVolume($actionLink, listAPIMap, $detailsTab) { $(this).dialog("close"); } }).dialog("open"); -} \ No newline at end of file +} + +function doTakeSnapshot($actionLink, listAPIMap, $detailsTab) { + $("#dialog_create_snapshot") + .dialog('option', 'buttons', { + "Confirm": function() { + $(this).dialog("close"); + + var id = $detailsTab.data("jsonObj").id; + var apiCommand = "command=createSnapshot&volumeid="+id; + doActionToDetailsTab(id, $actionLink, apiCommand, listAPIMap); + }, + "Cancel": function() { + $(this).dialog("close"); + } + }).dialog("open"); +}