From f75b17383af0aceda265d840bf772967b312101c Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sun, 12 Sep 2010 17:48:55 -0700 Subject: [PATCH] new UI - volume page - implement create template action. --- ui/new/jsp/instance.jsp | 20 ---------- ui/new/jsp/volume.jsp | 51 +++++++++++++++++++++++- ui/new/scripts/cloud.core2.account.js | 4 ++ ui/new/scripts/cloud.core2.alert.js | 4 ++ ui/new/scripts/cloud.core2.event.js | 4 ++ ui/new/scripts/cloud.core2.init.js | 53 +++++++++++++------------ ui/new/scripts/cloud.core2.ipaddress.js | 4 ++ ui/new/scripts/cloud.core2.js | 8 ++-- ui/new/scripts/cloud.core2.snapshot.js | 4 ++ ui/new/scripts/cloud.core2.volume.js | 32 ++++++++++++--- 10 files changed, 128 insertions(+), 56 deletions(-) diff --git a/ui/new/jsp/instance.jsp b/ui/new/jsp/instance.jsp index 18163f88c36..b8456bcc2f9 100644 --- a/ui/new/jsp/instance.jsp +++ b/ui/new/jsp/instance.jsp @@ -870,24 +870,4 @@ - - - \ No newline at end of file diff --git a/ui/new/jsp/volume.jsp b/ui/new/jsp/volume.jsp index dc30712f739..729bb5779b0 100644 --- a/ui/new/jsp/volume.jsp +++ b/ui/new/jsp/volume.jsp @@ -165,5 +165,54 @@ + - \ No newline at end of file + + \ No newline at end of file diff --git a/ui/new/scripts/cloud.core2.account.js b/ui/new/scripts/cloud.core2.account.js index ec9044531c5..1b5db3800a8 100644 --- a/ui/new/scripts/cloud.core2.account.js +++ b/ui/new/scripts/cloud.core2.account.js @@ -1,3 +1,7 @@ +function afterLoadAccountJSP() { + +} + function accountToMidmenu(jsonObj, $midmenuItem1, toRightPanelFn) { $midmenuItem1.attr("id", ("midmenuItem_"+jsonObj.id)); $midmenuItem1.data("id", jsonObj.id); diff --git a/ui/new/scripts/cloud.core2.alert.js b/ui/new/scripts/cloud.core2.alert.js index 04ede572047..46e2d5756c6 100644 --- a/ui/new/scripts/cloud.core2.alert.js +++ b/ui/new/scripts/cloud.core2.alert.js @@ -1,3 +1,7 @@ +function afterLoadAlertJSP() { + +} + function alertToMidmenu(jsonObj, $midmenuItem1, toRightPanelFn) { $midmenuItem1.attr("id", ("midmenuItem_"+jsonObj.id)); $midmenuItem1.data("id", jsonObj.id); diff --git a/ui/new/scripts/cloud.core2.event.js b/ui/new/scripts/cloud.core2.event.js index d5bac6ebabf..b3d86a66e0e 100644 --- a/ui/new/scripts/cloud.core2.event.js +++ b/ui/new/scripts/cloud.core2.event.js @@ -1,3 +1,7 @@ +function afterLoadEventJSP() { + +} + function eventToMidmenu(jsonObj, $midmenuItem1, toRightPanelFn) { $midmenuItem1.attr("id", ("midmenuItem_"+jsonObj.id)); $midmenuItem1.data("id", jsonObj.id); diff --git a/ui/new/scripts/cloud.core2.init.js b/ui/new/scripts/cloud.core2.init.js index 38bce04dbb1..eca3254d4e1 100644 --- a/ui/new/scripts/cloud.core2.init.js +++ b/ui/new/scripts/cloud.core2.init.js @@ -58,37 +58,38 @@ $(document).ready(function() { } var $midmenuItem = $("#midmenu_item"); - function listMidMenuItems(leftmenuId, apiName, jsonResponse1, jsonResponse2, rightPanelJSP, toMidmenu, toRightPanel) { + function listMidMenuItems(leftmenuId, apiName, jsonResponse1, jsonResponse2, rightPanelJSP, afterLoadRightPanelJSP, toMidmenu, toRightPanel) { $("#"+leftmenuId).bind("click", function(event) { - $("#right_panel").load(rightPanelJSP); - $.ajax({ - cache: false, - data: createURL("command="+apiName+"&pagesize="+midmenuItemCount), - dataType: "json", - success: function(json) { - $("#midmenu_container").empty(); - selectedItemsInMidMenu = {}; - - var items = json[jsonResponse1][jsonResponse2]; - if(items != null && items.length > 0) { - for(var i=0; i 0) { + for(var i=0; i 0) { + var select = $("#dialog_create_template #create_template_os_type").empty(); + for (var i = 0; i < types.length; i++) { + select.append(""); + } + } + } + }); +} + function volumeToMidmenu(jsonObj, $midmenuItem1, toRightPanelFn) { $midmenuItem1.attr("id", ("midmenuItem_"+jsonObj.id)); $midmenuItem1.data("id", jsonObj.id); @@ -101,11 +125,9 @@ function doCreateTemplate($actionLink, listAPIMap, $singleObject) { var isPublic = thisDialog.find("#create_template_public").val(); var password = thisDialog.find("#create_template_password").val(); - var id = $singleObject.data("id"); - //for(var id in selectedItemIds) { - var apiCommand = "command=createTemplate&volumeId="+id+"&name="+encodeURIComponent(name)+"&displayText="+encodeURIComponent(desc)+"&osTypeId="+osType+"&isPublic="+isPublic+"&passwordEnabled="+password; - doActionToSingleObject(id, $actionLink, apiCommand, listAPIMap, $singleObject); - //} + var id = $singleObject.data("jsonObj").id; + var apiCommand = "command=createTemplate&volumeId="+id+"&name="+encodeURIComponent(name)+"&displayText="+encodeURIComponent(desc)+"&osTypeId="+osType+"&isPublic="+isPublic+"&passwordEnabled="+password; + doActionToSingleObject(id, $actionLink, apiCommand, listAPIMap, $singleObject); }, "Cancel": function() { $(this).dialog("close");