From dbde0cd39bd5a2142940521e01e243239b3e9237 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 16 Sep 2010 14:50:01 -0700 Subject: [PATCH 1/9] new UI - display boolean field as text instead of icon. make Edit button always show. --- ui/new/jsp/instance.jsp | 12 +++---- ui/new/jsp/iso.jsp | 4 +-- ui/new/jsp/template.jsp | 16 +++------ ui/new/scripts/cloud.core2.instance.js | 46 +++++++++++++++----------- ui/new/scripts/cloud.core2.js | 10 +++--- ui/new/scripts/cloud.core2.template.js | 9 ++--- 6 files changed, 44 insertions(+), 53 deletions(-) diff --git a/ui/new/jsp/instance.jsp b/ui/new/jsp/instance.jsp index d464b3860a6..e8944b43877 100644 --- a/ui/new/jsp/instance.jsp +++ b/ui/new/jsp/instance.jsp @@ -75,12 +75,10 @@
- <%=t.t("HA")%>:
+ <%=t.t("HA.Enabled")%>:
-
-
-
+
@@ -127,12 +125,10 @@
- <%=t.t("ISO")%>:
+ <%=t.t("ISO.attached")%>:
-
-
-
+
diff --git a/ui/new/jsp/iso.jsp b/ui/new/jsp/iso.jsp index 6d24907e893..9b4ae7ece61 100644 --- a/ui/new/jsp/iso.jsp +++ b/ui/new/jsp/iso.jsp @@ -107,9 +107,7 @@ <%=t.t("Bootable")%>:
-
-
-
+
diff --git a/ui/new/jsp/template.jsp b/ui/new/jsp/template.jsp index a6d4a200da3..c62233ec905 100644 --- a/ui/new/jsp/template.jsp +++ b/ui/new/jsp/template.jsp @@ -112,9 +112,7 @@ <%=t.t("Password.Enabled")%>:
-
-
-
+
@@ -144,9 +140,7 @@ <%=t.t("Featured")%>:
-
-
-
+
+
@@ -89,6 +91,8 @@
+ +
@@ -140,8 +144,12 @@
- - + + +
+ + +
diff --git a/ui/new/scripts/cloud.core2.iso.js b/ui/new/scripts/cloud.core2.iso.js index 3a7402a33b1..29d8aa643d9 100644 --- a/ui/new/scripts/cloud.core2.iso.js +++ b/ui/new/scripts/cloud.core2.iso.js @@ -4,6 +4,28 @@ var g_zoneNames = []; function afterLoadIsoJSP() { var $detailsTab = $("#right_panel_content #tab_content_details"); + //edit button *** + var $readonlyFields = $detailsTab.find("#name, #displaytext"); + var $editFields = $detailsTab.find("#name_edit, #displaytext_edit"); + $("#edit_button").bind("click", function(event){ + $readonlyFields.hide(); + $editFields.show(); + $("#cancel_button, #save_button").show() + return false; + }); + $("#cancel_button").bind("click", function(event){ + $editFields.hide(); + $readonlyFields.show(); + $("#save_button, #cancel_button").hide(); + return false; + }); + $("#save_button").bind("click", function(event){ + doUpdateIso(); + $editFields.hide(); + $readonlyFields.show(); + $("#save_button, #cancel_button").hide(); + return false; + }); //populate dropdown *** $.ajax({ @@ -107,8 +129,13 @@ function isoJsonToDetailsTab(jsonObj) { $detailsTab.data("jsonObj", jsonObj); $detailsTab.find("#id").text(fromdb(jsonObj.id)); $detailsTab.find("#zonename").text(fromdb(jsonObj.zonename)); + $detailsTab.find("#name").text(fromdb(jsonObj.name)); + $detailsTab.find("#name_edit").val(fromdb(jsonObj.name)); + $detailsTab.find("#displaytext").text(fromdb(jsonObj.displaytext)); + $detailsTab.find("#displaytext_edit").val(fromdb(jsonObj.displaytext)); + $detailsTab.find("#account").text(fromdb(jsonObj.account)); if(jsonObj.size != null) @@ -197,6 +224,33 @@ var isoListAPIMap = { listAPIResponseObj: "iso" }; +function doUpdateIso() { + var $detailsTab = $("#right_panel_content #tab_content_details"); + + // validate values + var isValid = true; + isValid &= validateString("Name", $detailsTab.find("#name_edit"), $detailsTab.find("#name_edit_errormsg")); + isValid &= validateString("Display Text", $detailsTab.find("#displaytext_edit"), $detailsTab.find("#displaytext_edit_errormsg")); + if (!isValid) + return; + + var jsonObj = $detailsTab.data("jsonObj"); + var id = jsonObj.id; + + var name = trim($detailsTab.find("#name_edit").val()); + var displaytext = trim($detailsTab.find("#displaytext_edit").val()); + + $.ajax({ + data: createURL("command=updateIso&id="+id+"&name="+todb(name)+"&displayText="+todb(displaytext)), + dataType: "json", + success: function(json) { + var jsonObj = json.updateisoresponse; + isoToMidmenu(jsonObj, $("#midmenuItem_"+jsonObj.id)); + isoJsonToDetailsTab(jsonObj); + } + }); +} + function populateZoneFieldExcludeSourceZone(zoneField, excludeZoneId) { zoneField.empty(); if (g_zoneIds != null && g_zoneIds.length > 0) { From 7aa2053df29503bf77f84543fc309b72434c33b4 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 16 Sep 2010 16:06:05 -0700 Subject: [PATCH 4/9] new UI - ISO page - implement deleteISO action. --- ui/new/scripts/cloud.core2.iso.js | 21 +- ui/new/scripts/cloud.core2.js | 318 +++++++++++++------------ ui/new/scripts/cloud.core2.template.js | 8 +- 3 files changed, 182 insertions(+), 165 deletions(-) diff --git a/ui/new/scripts/cloud.core2.iso.js b/ui/new/scripts/cloud.core2.iso.js index 29d8aa643d9..58686de9e63 100644 --- a/ui/new/scripts/cloud.core2.iso.js +++ b/ui/new/scripts/cloud.core2.iso.js @@ -185,7 +185,22 @@ function isoJsonToDetailsTab(jsonObj) { } function isoClearRightPanel() { - + var $detailsTab = $("#right_panel_content #tab_content_details"); + + $detailsTab.find("#id").text(""); + $detailsTab.find("#zonename").text(""); + + $detailsTab.find("#name").text(""); + $detailsTab.find("#name_edit").val(""); + + $detailsTab.find("#displaytext").text(""); + $detailsTab.find("#displaytext_edit").val(""); + + $detailsTab.find("#account").text(""); + $detailsTab.find("#size").text(""); + $detailsTab.find("#status").text(""); + $detailsTab.find("#bootable").text(""); + $detailsTab.find("#created").text(""); } var isoActionMap = { @@ -194,7 +209,7 @@ var isoActionMap = { isAsyncJob: true, asyncJobResponse: "deleteisosresponse", inProcessText: "Deleting ISO....", - afterActionSeccessFn: function(jsonObj) { + afterActionSeccessFn: function(jsonObj) { var $midmenuItem1 = $("#midmenuItem_"+jsonObj.id); $midmenuItem1.remove(); clearRightPanel(); @@ -219,7 +234,7 @@ var isoActionMap = { } var isoListAPIMap = { - listAPI: "listisos&isofilter=self", + listAPI: "listIsos&isofilter=self", listAPIResponse: "listisosresponse", listAPIResponseObj: "iso" }; diff --git a/ui/new/scripts/cloud.core2.js b/ui/new/scripts/cloud.core2.js index f591494b98a..c5484890d10 100644 --- a/ui/new/scripts/cloud.core2.js +++ b/ui/new/scripts/cloud.core2.js @@ -20,6 +20,166 @@ // Version: @VERSION@ + +//***** actions for details tab in right panel (begin) ************************************************************************ +function buildActionLinkForDetailsTab(label, actionMap, $actionMenu, listAPIMap) { + var apiInfo = actionMap[label]; + var $listItem = $("#action_list_item").clone(); + $actionMenu.find("#action_list").append($listItem.show()); + var $link = $listItem.find("#link").text(label); + $link.data("label", label); + $link.data("inProcessText", apiInfo.inProcessText); + $link.data("api", apiInfo.api); + $link.data("isAsyncJob", apiInfo.isAsyncJob); + $link.data("asyncJobResponse", apiInfo.asyncJobResponse); + $link.data("afterActionSeccessFn", apiInfo.afterActionSeccessFn); + $link.data("dialogBeforeActionFn", apiInfo.dialogBeforeActionFn); + + var $detailsTab = $("#right_panel_content #tab_content_details"); + var id = $detailsTab.data("jsonObj").id; + + $link.bind("click", function(event) { + $actionMenu.hide(); + var $actionLink = $(this); + var dialogBeforeActionFn = $actionLink.data("dialogBeforeActionFn"); + if(dialogBeforeActionFn == null) { + var apiCommand = "command="+$actionLink.data("api")+"&id="+id; + doActionToDetailsTab(id, $actionLink, apiCommand, listAPIMap); + } + else { + dialogBeforeActionFn($actionLink, listAPIMap, $detailsTab); + } + return false; + }); +} + +function doActionToDetailsTab(id, $actionLink, apiCommand, listAPIMap) { + var label = $actionLink.data("label"); + var inProcessText = $actionLink.data("inProcessText"); + var isAsyncJob = $actionLink.data("isAsyncJob"); + var asyncJobResponse = $actionLink.data("asyncJobResponse"); + var afterActionSeccessFn = $actionLink.data("afterActionSeccessFn"); + var listAPI = listAPIMap["listAPI"]; + var listAPIResponse = listAPIMap["listAPIResponse"]; + var listAPIResponseObj = listAPIMap["listAPIResponseObj"]; + + var $detailsTab = $("#right_panel_content #tab_content_details"); + var $spinningWheel = $detailsTab.find("#spinning_wheel"); + $spinningWheel.find("#description").text(inProcessText); + $spinningWheel.show(); + + //Async job (begin) ***** + if(isAsyncJob == true) { + $.ajax({ + data: createURL(apiCommand), + dataType: "json", + success: function(json) { + var jobId = json[asyncJobResponse].jobid; + var timerKey = "asyncJob_" + jobId; + $("body").everyTime( + 10000, + timerKey, + function() { + $.ajax({ + data: createURL("command=queryAsyncJobResult&jobId="+jobId), + dataType: "json", + success: function(json) { + var result = json.queryasyncjobresultresponse; + if (result.jobstatus == 0) { + return; //Job has not completed + } else { + $("body").stopTime(timerKey); + $spinningWheel.hide(); + 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]); + + } 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(); + } + } + }, + error: function(XMLHttpResponse) { + $("body").stopTime(timerKey); + handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label); + } + }); + }, + 0 + ); + }, + error: function(XMLHttpResponse) { + handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label); + } + }); + } + //Async job (end) ***** + + //Sync job (begin) ***** + else { + $.ajax({ + data: createURL(apiCommand), + dataType: "json", + async: false, + success: function(json) { + $spinningWheel.hide(); + + //RecoverVirtualMachine API doesn't return an embedded object on success (Bug 6037) + //Before Bug 6037 get fixed, use the temporary solution below. + $.ajax({ + cache: false, + data: createURL("command="+listAPI+"&id="+id), + dataType: "json", + async: false, + success: function(json) { + $detailsTab.find("#action_message_box #description").text(label + " action succeeded."); + $detailsTab.find("#action_message_box").removeClass("error").show(); + + afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]); + } + }); + //After Bug 6037 is fixed, remove temporary solution above and uncomment the line below + //afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]); + }, + error: function(XMLHttpResponse) { + handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label); + } + }); + } + //Sync job (end) ***** +} + +function handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label) { + $detailsTab.find("#spinning_wheel").hide(); + + var errorMsg = ""; + if(XMLHttpResponse.responseText != null & XMLHttpResponse.responseText.length > 0) { + var start = XMLHttpResponse.responseText.indexOf("h1") + 3; + var end = XMLHttpResponse.responseText.indexOf(" 0) + $detailsTab.find("#action_message_box #description").text(label + " action failed. Reason: " + sanitizeXSS(unescape(errorMsg))); + else + $detailsTab.find("#action_message_box #description").text(label + " action failed."); + $detailsTab.find("#action_message_box").addClass("error").show(); +} +//***** actions for details tab in right panel (end) ************************************************************************** + //***** actions for middle menu (begin) ************************************************************************ var selectedItemsInMidMenu = {}; @@ -180,164 +340,6 @@ function handleErrorInMidMenu(XMLHttpResponse, $midmenuItem) { } //***** actions for middle menu (end) ************************************************************************** -//***** actions for details tab in right panel (begin) ************************************************************************ -function buildActionLinkForDetailsTab(label, actionMap, $actionMenu, listAPIMap) { - var apiInfo = actionMap[label]; - var $listItem = $("#action_list_item").clone(); - $actionMenu.find("#action_list").append($listItem.show()); - var $link = $listItem.find("#link").text(label); - $link.data("label", label); - $link.data("inProcessText", apiInfo.inProcessText); - $link.data("api", apiInfo.api); - $link.data("isAsyncJob", apiInfo.isAsyncJob); - $link.data("asyncJobResponse", apiInfo.asyncJobResponse); - $link.data("afterActionSeccessFn", apiInfo.afterActionSeccessFn); - $link.data("dialogBeforeActionFn", apiInfo.dialogBeforeActionFn); - - var $detailsTab = $("#right_panel_content #tab_content_details"); - var id = $detailsTab.data("jsonObj").id; - - $link.bind("click", function(event) { - $actionMenu.hide(); - var $actionLink = $(this); - var dialogBeforeActionFn = $actionLink.data("dialogBeforeActionFn"); - if(dialogBeforeActionFn == null) { - var apiCommand = "command="+$actionLink.data("api")+"&id="+id; - doActionToDetailsTab(id, $actionLink, apiCommand, listAPIMap); - } - else { - dialogBeforeActionFn($actionLink, listAPIMap, $detailsTab); - } - return false; - }); -} - -function doActionToDetailsTab(id, $actionLink, apiCommand, listAPIMap) { - var label = $actionLink.data("label"); - var inProcessText = $actionLink.data("inProcessText"); - var isAsyncJob = $actionLink.data("isAsyncJob"); - var asyncJobResponse = $actionLink.data("asyncJobResponse"); - var afterActionSeccessFn = $actionLink.data("afterActionSeccessFn"); - var listAPI = listAPIMap["listAPI"]; - var listAPIResponse = listAPIMap["listAPIResponse"]; - var listAPIResponseObj = listAPIMap["listAPIResponseObj"]; - - var $detailsTab = $("#right_panel_content #tab_content_details"); - var $spinningWheel = $detailsTab.find("#spinning_wheel"); - $spinningWheel.find("#description").text(inProcessText); - $spinningWheel.show(); - - //Async job (begin) ***** - if(isAsyncJob == true) { - $.ajax({ - data: createURL(apiCommand), - dataType: "json", - success: function(json) { - var jobId = json[asyncJobResponse].jobid; - var timerKey = "asyncJob_" + jobId; - $("body").everyTime( - 10000, - timerKey, - function() { - $.ajax({ - data: createURL("command=queryAsyncJobResult&jobId="+jobId), - dataType: "json", - success: function(json) { - var result = json.queryasyncjobresultresponse; - if (result.jobstatus == 0) { - return; //Job has not completed - } else { - $("body").stopTime(timerKey); - $spinningWheel.hide(); - 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]); - - } 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(); - } - } - }, - error: function(XMLHttpResponse) { - $("body").stopTime(timerKey); - handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label); - } - }); - }, - 0 - ); - }, - error: function(XMLHttpResponse) { - handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label); - } - }); - } - //Async job (end) ***** - - //Sync job (begin) ***** - else { - $.ajax({ - data: createURL(apiCommand), - dataType: "json", - async: false, - success: function(json) { - $spinningWheel.hide(); - - //RecoverVirtualMachine API doesn't return an embedded object on success (Bug 6037) - //Before Bug 6037 get fixed, use the temporary solution below. - $.ajax({ - cache: false, - data: createURL("command="+listAPI+"&id="+id), - dataType: "json", - async: false, - success: function(json) { - $detailsTab.find("#action_message_box #description").text(label + " action succeeded."); - $detailsTab.find("#action_message_box").removeClass("error").show(); - - afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]); - } - }); - //After Bug 6037 is fixed, remove temporary solution above and uncomment the line below - //afterActionSeccessFn(json[listAPIResponse][listAPIResponseObj][0]); - }, - error: function(XMLHttpResponse) { - handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label); - } - }); - } - //Sync job (end) ***** -} - -function handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label) { - $detailsTab.find("#spinning_wheel").hide(); - - var errorMsg = ""; - if(XMLHttpResponse.responseText != null & XMLHttpResponse.responseText.length > 0) { - var start = XMLHttpResponse.responseText.indexOf("h1") + 3; - var end = XMLHttpResponse.responseText.indexOf(" 0) - $detailsTab.find("#action_message_box #description").text(label + " action failed. Reason: " + sanitizeXSS(unescape(errorMsg))); - else - $detailsTab.find("#action_message_box #description").text(label + " action failed."); - $detailsTab.find("#action_message_box").addClass("error").show(); -} -//***** actions for details tab in right panel (end) ************************************************************************** //***** actions for a subgrid item in right panel (begin) ************************************************************************ function buildActionLinkForSubgridItem(label, actionMap, $actionMenu, listAPIMap, $subgridItem) { diff --git a/ui/new/scripts/cloud.core2.template.js b/ui/new/scripts/cloud.core2.template.js index f8f36b89fbb..819d4cd918d 100644 --- a/ui/new/scripts/cloud.core2.template.js +++ b/ui/new/scripts/cloud.core2.template.js @@ -220,16 +220,16 @@ function templateClearRightPanel() { $detailsTab.find("#status").text(""); - setBooleanField(null, $detailsTab.find("#passwordenabled")); + $detailsTab.find("#passwordenabled").text(""); $detailsTab.find("#passwordenabled_edit").val(null); - setBooleanField(null, $detailsTab.find("#ispublic")); + $detailsTab.find("#ispublic").text(""); $detailsTab.find("#ispublic_edit").val(null); - setBooleanField(null, $detailsTab.find("#isfeatured")); + $detailsTab.find("#isfeatured").text(""); $detailsTab.find("#isfeatured_edit").val(null); - setBooleanField(null, $detailsTab.find("#crossZones")); + $detailsTab.find("#crossZones").text(""); $detailsTab.find("#ostypename").text(""); $detailsTab.find("#ostypename_edit").val(null); From b87c5e0222c3ecb1e4261102ca775a1ba23c9f5c Mon Sep 17 00:00:00 2001 From: NIKITA Date: Thu, 16 Sep 2010 16:16:02 -0700 Subject: [PATCH 5/9] New Ui for Dashboard --- ui/new/css/main.css | 90 +++++++++++++++++++++++++++++++++++ ui/new/images/db_usedbox.gif | Bin 0 -> 529 bytes ui/new/images/dbrow_even.gif | Bin 0 -> 124 bytes ui/new/images/dbrow_odd.gif | Bin 0 -> 133 bytes ui/new/jsp/dashboard.jsp | 53 +++++++++++++++++++++ 5 files changed, 143 insertions(+) create mode 100644 ui/new/images/db_usedbox.gif create mode 100644 ui/new/images/dbrow_even.gif create mode 100644 ui/new/images/dbrow_odd.gif create mode 100644 ui/new/jsp/dashboard.jsp diff --git a/ui/new/css/main.css b/ui/new/css/main.css index 872d7cc4068..7f40c2bfe23 100644 --- a/ui/new/css/main.css +++ b/ui/new/css/main.css @@ -2158,6 +2158,26 @@ a:visited { border-right:1px solid #CCC; } +.grid_header_formbox { + width:auto; + height:auto; + float:right; + margin:0; + padding:0; +} + +.grid_header_cell .select { + height:15px; + float:left; + margin:2px 10px 0 0; + display:inline; + padding:0; + border:1px solid #999; + background:#e7e7e7; + color:#333; + font-size:11px; +} + .grid_header_title { width:auto; height:auto; @@ -2389,4 +2409,74 @@ a:visited { margin:0; padding:0; z-index:1002; +} + +.dbrow { + width:100%; + height:44px; + float:left; + border-bottom:1px solid #e2e2e2; + margin:0; + padding:0; +} + +.dbrow.even { + background:url(../images/dbrow_even.gif) repeat-x top left; +} + +.dbrow.odd { + background:url(../images/dbrow_odd.gif) repeat-x top left; +} + +.dbrow_cell { + height:44px; + float:left; + border-right:1px solid #e2e2e2; + margin:0; + padding:0; +} + +.dbgraph_titlebox { + width:95%; + height:auto; + float:left; + margin:5px 0 0 10px; + padding:0; +} + +.dbgraph_titlebox h2{ + width:80%; + height:auto; + float:left; + color:#333; + font-size:11px; + font-weight:normal; + text-align:left; + margin:0; + padding:0; +} + +.dbgraph_title_usedbox { + width:170px; + height:16px; + float:left; + background:url(../images/db_usedbox.gif) no-repeat top left; + margin:3px 0 0 0; + padding:0; +} + +.dbgraph_title_usedbox p { + width: auto; + height:auto; + float:left; + color:#FFF; + font-size:11px; + font-weight:normal; + text-align:left; + margin:2px 0 0 5px; + padding:0; +} + +.dbgraph_title_usedbox span { + font-weight:bold; } \ No newline at end of file diff --git a/ui/new/images/db_usedbox.gif b/ui/new/images/db_usedbox.gif new file mode 100644 index 0000000000000000000000000000000000000000..4370792940fbf245e222601ba2af3ad799555fb2 GIT binary patch literal 529 zcmZ?wbhEHbT*V;3aFu}}GBVQL-90QUEFd7j+S=OR-`~f_Cpb9R)zvjLG}O$@EFvPp z$;s*c`}elCw&CI7&z?QAw6xUI({pxq*3r><{`|RvgM*Qgk*=<;wzhV9dU}3-eo9Kp zlqpksdU`xPJ!j0Av1`{Z6BCnz2M$IM{rS;hu8GhK0`U4C_;Gf7`Igwf5<`sR0I!)7N(^I9E+} z%RR*CH_zc@)X7atPfs@pzqsjXlB>b(}P&+h*3q|v96G%sVpx*Y301wLm=a_>~cy{Vc1=fHzR K4;?oK25SJ7pf?Nv literal 0 HcmV?d00001 diff --git a/ui/new/images/dbrow_odd.gif b/ui/new/images/dbrow_odd.gif new file mode 100644 index 0000000000000000000000000000000000000000..6936525f9d65dd8901a48f5c9f2655dc5e21ec28 GIT binary patch literal 133 zcmV;00DAvNNk%w1VFdsz0J8u9@9*#C=H~0`>*M3&?d|RE?(XdD?CI(0=;-L-;o;=u z%L1IA9QUaINt1g;Qv5}P^c&t2gsz7!DJ?$&j +<%@ page import="com.cloud.utils.*" %> + +<% + Locale browserLocale = request.getLocale(); + CloudResourceBundle t = CloudResourceBundle.getBundle("resources/resource", browserLocale); +%> + + +
+ +
+ Event
+ +

Dashboard +

+
+ + +
+ + +
+
+
+
System Wide Capacity
+
+
+
+ + +
+
+
+
+
+
+

Public IP Addresses

+
+

Used: 2 / 11

+
+
+
+
+
+
+
+
+
+ + From f1cab0525c1c1ed5a1197149269ee841b310e288 Mon Sep 17 00:00:00 2001 From: abhishek Date: Thu, 16 Sep 2010 16:46:55 -0700 Subject: [PATCH 6/9] bug 6021: blocking the deletion of private disk offering from the back end api --- .../src/com/cloud/api/commands/DeleteDiskOfferingCmd.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/api/commands/DeleteDiskOfferingCmd.java b/server/src/com/cloud/api/commands/DeleteDiskOfferingCmd.java index 5c00750146f..8c38a24857b 100644 --- a/server/src/com/cloud/api/commands/DeleteDiskOfferingCmd.java +++ b/server/src/com/cloud/api/commands/DeleteDiskOfferingCmd.java @@ -26,6 +26,7 @@ import org.apache.log4j.Logger; import com.cloud.api.BaseCmd; import com.cloud.api.ServerApiException; +import com.cloud.offering.DiskOffering; import com.cloud.storage.DiskOfferingVO; import com.cloud.user.User; import com.cloud.utils.Pair; @@ -62,7 +63,12 @@ public class DeleteDiskOfferingCmd extends BaseCmd { if (disk == null) { throw new ServerApiException(BaseCmd.PARAM_ERROR, "unable to find a disk offering with id " + id); } - + + if(disk.getName().equals("Private") && disk.getDisplayText().equals("Private Disk")){ + //block deletion of these disks + throw new ServerApiException(BaseCmd.INTERNAL_ERROR,"Cannot delete this diskoffering as it is private"); + } + boolean result = getManagementServer().deleteDiskOffering(userId, id); List> returnValues = new ArrayList>(); From bcfbfa628e95fa2d61cd7a7db98f898fa897d74b Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 16 Sep 2010 16:52:24 -0700 Subject: [PATCH 7/9] new UI - add dashboard link. --- ui/new/index.jsp | 4 ++-- ui/new/scripts/cloud.core2.init.js | 14 ++++++++++---- ui/new/scripts/cloud.core2.js | 12 ++++++++++-- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/ui/new/index.jsp b/ui/new/index.jsp index 14abb69651d..0afb8418fbe 100644 --- a/ui/new/index.jsp +++ b/ui/new/index.jsp @@ -83,7 +83,7 @@ long milliseconds = new Date().getTime();
-
+
  1. @@ -261,7 +261,7 @@ long milliseconds = new Date().getTime();
-
+
-
+
diff --git a/ui/new/scripts/cloud.core2.instance.js b/ui/new/scripts/cloud.core2.instance.js index 7d1ce21df9e..1ceedf983d6 100644 --- a/ui/new/scripts/cloud.core2.instance.js +++ b/ui/new/scripts/cloud.core2.instance.js @@ -377,31 +377,33 @@ function clickInstanceGroupHeader($arrowIcon) { } function vmToRightPanel($midmenuItem) { - var json = $midmenuItem.data("jsonObj"); - vmJsonToDetailsTab(json, $midmenuItem); + var jsonObj = $midmenuItem.data("jsonObj"); + + var vmName = getVmName(jsonObj.name, jsonObj.displayname); + $("right_panel_header").find("#vm_name").text(fromdb(vmName)); + + var $rightPanelContent = $("#right_panel_content"); + if($midmenuItem.find("#info_icon").css("display") != "none") { + $rightPanelContent.find("#after_action_info").text($midmenuItem.data("afterActionInfo")); + if($midmenuItem.find("#info_icon").hasClass("error")) + $rightPanelContent.find("#after_action_info_container").addClass("errorbox"); + else + $rightPanelContent.find("#after_action_info_container").removeClass("errorbox"); + $rightPanelContent.find("#after_action_info_container").show(); + } + else { + $rightPanelContent.find("#after_action_info").text(""); + $rightPanelContent.find("#after_action_info_container").hide(); + } + + vmJsonToDetailsTab(jsonObj, $midmenuItem); } function vmJsonToDetailsTab(jsonObj, $midmenuItem){ var $detailsTab = $("#right_panel_content #tab_content_details"); $detailsTab.data("jsonObj", jsonObj); - //details tab - if($midmenuItem.find("#info_icon").css("display") != "none") { - $detailsTab.find("#after_action_info").text($midmenuItem.data("afterActionInfo")); - if($midmenuItem.find("#info_icon").hasClass("error")) - $detailsTab.find("#after_action_info_container").addClass("errorbox"); - else - $detailsTab.find("#after_action_info_container").removeClass("errorbox"); - $detailsTab.find("#after_action_info_container").show(); - } - else { - $detailsTab.find("#after_action_info").text(""); - $detailsTab.find("#after_action_info_container").hide(); - } - - - var vmName = getVmName(jsonObj.name, jsonObj.displayname); - $rightPanelHeader.find("#vm_name").text(fromdb(vmName)); + //details tab updateVirtualMachineStateInRightPanel(jsonObj.state); $detailsTab.find("#ipAddress").text(jsonObj.ipaddress); $detailsTab.find("#zoneName").text(fromdb(jsonObj.zonename)); @@ -569,13 +571,15 @@ function clickInstanceGroupHeader($arrowIcon) { data: createURL("command=listVirtualMachines&group="+group1+"&pagesize="+midmenuItemCount), dataType: "json", success: function(json) { - var instances = json.listvirtualmachinesresponse.virtualmachine; - for(var i=0; i 0) { + for(var i=0; i Date: Thu, 16 Sep 2010 18:52:02 -0700 Subject: [PATCH 9/9] new UI - error handling when adding VM fails. --- ui/new/jsp/template.jsp | 79 ++++++++++++++++ ui/new/scripts/cloud.core2.instance.js | 45 +++------ ui/new/scripts/cloud.core2.js | 24 ++++- ui/new/scripts/cloud.core2.template.js | 122 +++++++++++++++++++------ 4 files changed, 206 insertions(+), 64 deletions(-) diff --git a/ui/new/jsp/template.jsp b/ui/new/jsp/template.jsp index c62233ec905..0c3e9538a40 100644 --- a/ui/new/jsp/template.jsp +++ b/ui/new/jsp/template.jsp @@ -259,3 +259,82 @@
+ + + + diff --git a/ui/new/scripts/cloud.core2.instance.js b/ui/new/scripts/cloud.core2.instance.js index 1ceedf983d6..1dcfbeddd1e 100644 --- a/ui/new/scripts/cloud.core2.instance.js +++ b/ui/new/scripts/cloud.core2.instance.js @@ -1186,19 +1186,14 @@ function clickInstanceGroupHeader($arrowIcon) { moreCriteria.push("&group="+todb(group)); vmWizardClose(); - - var $t = $("#midmenu_item").clone(); - $t.find("#first_row").text("Adding...."); - $t.find("#content").addClass("inaction"); - $t.find("#spinning_wheel").show(); - $("#midmenu_container").append($t.show()); - + + var $midmenuItem1 = beforeAddingMidMenuItem() ; + $.ajax({ data: createURL("command=deployVirtualMachine"+moreCriteria.join("")), dataType: "json", success: function(json) { - var jobId = json.deployvirtualmachineresponse.jobid; - $t.attr("id","vmNew"+jobId).data("jobId", jobId); + var jobId = json.deployvirtualmachineresponse.jobid; var timerKey = "vmNew"+jobId; // Process the async job @@ -1214,35 +1209,23 @@ function clickInstanceGroupHeader($arrowIcon) { if (result.jobstatus == 0) { return; //Job has not completed } else { - $("body").stopTime(timerKey); - $t.find("#content").removeClass("inaction"); - $t.find("#spinning_wheel").hide(); + $("body").stopTime(timerKey); if (result.jobstatus == 1) { // Succeeded - $t.find("#info_icon").removeClass("error").show(); - $t.data("afterActionInfo", ("Adding succeeded.")); + afterAddingMidMenuItem($midmenuItem1, true); if("virtualmachine" in result) vmToMidmenu(result.virtualmachine[0], $t); } else if (result.jobstatus == 2) { // Failed - $t.find("#first_row").text("Adding failed"); - $t.find("#info_icon").addClass("error").show(); - $t.data("afterActionInfo", ("Adding failed. Reason: " + fromdb(result.jobresult))); - $t.bind("click", function(event) { - $rightPanelContent.find("#after_action_info").text($(this).data("afterActionInfo")); - $rightPanelContent.find("#after_action_info_container").addClass("errorbox"); - $rightPanelContent.find("#after_action_info_container").show(); - vmClearRightPanel(); - return false; - }); + afterAddingMidMenuItem($midmenuItem1, false); + $("#dialog_error").html("

Adding Instance failed


"+fromdb(result.jobresult)+"

").dialog("open"); } } }, error: function(XMLHttpResponse) { - $("body").stopTime(timerKey); - $t.find("#info_icon").addClass("error").show(); - $t.find("#first_row").text("Adding failed"); + $("body").stopTime(timerKey); + afterAddingMidMenuItem($midmenuItem1, false); handleError(XMLHttpResponse); } }); @@ -1250,9 +1233,8 @@ function clickInstanceGroupHeader($arrowIcon) { 0 ); }, - error: function(XMLHttpResponse) { - $t.find("#info_icon").addClass("error").show(); - $t.find("#first_row").text("Adding failed"); + error: function(XMLHttpResponse) { + afterAddingMidMenuItem($midmenuItem1, false); handleError(XMLHttpResponse); } }); @@ -1312,8 +1294,7 @@ function doCreateTemplateFromVmVolume($actionLink, listAPIMap, $subgridItem) { $("#dialog_create_template") .dialog('option', 'buttons', { - "Create": function() { - //debugger; + "Create": function() { var thisDialog = $(this); thisDialog.dialog("close"); diff --git a/ui/new/scripts/cloud.core2.js b/ui/new/scripts/cloud.core2.js index e105eba3c66..1b53ff4f131 100644 --- a/ui/new/scripts/cloud.core2.js +++ b/ui/new/scripts/cloud.core2.js @@ -548,14 +548,34 @@ function hideMiddleMenu() { $("#middle_menu, #search_panel, #middle_menu_pagination").hide(); $("#right_panel").removeClass("main_contentarea").addClass("main_contentarea_dashboard"); } - function showMiddleMenu() { $("#middle_menu, #search_panel, #middle_menu_pagination").show(); $("#right_panel").removeClass("main_contentarea_dashboard").addClass("main_contentarea"); } - +// adding middle menu item *** +function beforeAddingMidMenuItem() { + var $midmenuItem1 = $("#midmenu_item").clone(); + $midmenuItem1.find("#first_row").text("Adding...."); + $midmenuItem1.find("#content").addClass("inaction"); + $midmenuItem1.find("#spinning_wheel").show(); + $("#midmenu_container").append($midmenuItem1.show()); + return $midmenuItem1; +} +function afterAddingMidMenuItem($midmenuItem1, isSuccessful) { + $midmenuItem1.find("#content").removeClass("inaction"); + $midmenuItem1.find("#spinning_wheel").hide(); + + if(isSuccessful == true) { + $midmenuItem1.find("#info_icon").removeClass("error").show(); + $midmenuItem1.data("afterActionInfo", ("Adding succeeded.")); + } + else { + $midmenuItem1.find("#info_icon").addClass("error").show(); + $midmenuItem1.find("#first_row").text("Adding failed"); + } +} diff --git a/ui/new/scripts/cloud.core2.template.js b/ui/new/scripts/cloud.core2.template.js index 819d4cd918d..bb4ebef3427 100644 --- a/ui/new/scripts/cloud.core2.template.js +++ b/ui/new/scripts/cloud.core2.template.js @@ -1,8 +1,63 @@ var g_zoneIds = []; var g_zoneNames = []; -function afterLoadTemplateJSP() { - var $detailsTab = $("#right_panel_content #tab_content_details"); +function afterLoadTemplateJSP() { + var $detailsTab = $("#right_panel_content #tab_content_details"); + + //add button *** + $("#midmenu_add_link").show(); + $("#midmenu_add_link").bind("click", function(event) { + $("#dialog_add_template") + .dialog('option', 'buttons', { + "Create": function() { + var thisDialog = $(this); + thisDialog.dialog("close"); + + debugger; + // validate values + var isValid = true; + isValid &= validateString("Name", thisDialog.find("#add_template_name"), thisDialog.find("#add_template_name_errormsg")); + isValid &= validateString("Display Text", thisDialog.find("#add_template_display_text"), thisDialog.find("#add_template_display_text_errormsg")); + isValid &= validateString("URL", thisDialog.find("#add_template_url"), thisDialog.find("#add_template_url_errormsg")); + if (!isValid) return; + + var name = trim(thisDialog.find("#add_template_name").val()); + var desc = trim(thisDialog.find("#add_template_display_text").val()); + var url = trim(thisDialog.find("#add_template_url").val()); + var zoneId = thisDialog.find("#add_template_zone").val(); + var format = thisDialog.find("#add_template_format").val(); + var password = thisDialog.find("#add_template_password").val(); + var isPublic = thisDialog.find("#add_template_public").val(); + var osType = thisDialog.find("#add_template_os_type").val(); + + var moreCriteria = []; + if(thisDialog.find("#add_template_featured_container").css("display")!="none") { + var isFeatured = thisDialog.find("#add_template_featured").val(); + moreCriteria.push("&isfeatured="+isFeatured); + } + + //middle menu spinning wheel.... + + $.ajax({ + data: createURL("command=registerTemplate&name="+encodeURIComponent(name)+"&displayText="+encodeURIComponent(desc)+"&url="+encodeURIComponent(url)+"&zoneid="+zoneId+"&ispublic="+isPublic+moreCriteria.join("")+"&format="+format+"&passwordEnabled="+password+"&osTypeId="+osType+"&response=json"), + dataType: "json", + success: function(json) { + var result = json.registertemplateresponse; + debugger; + //spinning wheel disappear + }, + error: function(XMLHttpResponse) { + debugger; + + } + }); + }, + "Cancel": function() { + $(this).dialog("close"); + } + }).dialog("open"); + return false; + }); //edit button *** var $readonlyFields = $detailsTab.find("#name, #displaytext, #passwordenabled, #ispublic, #isfeatured, #ostypename"); @@ -28,17 +83,39 @@ function afterLoadTemplateJSP() { }); - //populate dropdown *** + //populate dropdown *** + var addTemplateZoneField = $("#dialog_add_template #add_template_zone"); + if (isAdmin()) + addTemplateZoneField.append(""); + $.ajax({ + data: createURL("command=listZones&available=true"+maxPageSize), + dataType: "json", + success: function(json) { + var zones = json.listzonesresponse.zone; + if (zones != null && zones.length > 0) { + for (var i = 0; i < zones.length; i++) { + addTemplateZoneField.append(""); + g_zoneIds.push(zones[i].id); + g_zoneNames.push(zones[i].name); + } + } + } + }); + $.ajax({ data: createURL("command=listOsTypes&response=json"+maxPageSize), dataType: "json", success: function(json) { types = json.listostypesresponse.ostype; - if (types != null && types.length > 0) { - var osTypeDropdown = $detailsTab.find("#ostypename_edit").empty(); - for (var i = 0; i < types.length; i++) { - var html = ""; - osTypeDropdown.append(html); + if (types != null && types.length > 0) { + var osTypeDropdownAdd = $("#dialog_add_template #add_template_os_type"); + var osTypeDropdownEdit = $detailsTab.find("#ostypename_edit").empty(); + if(types != null && types.length > 0) { + for(var i = 0; i < types.length; i++) { + var html = ""; + osTypeDropdownAdd.append(html); + osTypeDropdownEdit.append(html); + } } } } @@ -72,6 +149,13 @@ function afterLoadTemplateJSP() { }); //initialize dialog box *** + activateDialog($("#dialog_add_template").dialog({ + width:450, + autoOpen: false, + modal: true, + zIndex: 2000 + })); + activateDialog($("#dialog_copy_template").dialog({ width:300, autoOpen: false, @@ -85,28 +169,6 @@ function afterLoadTemplateJSP() { modal: true, zIndex: 2000 })); - - //populate zone dropdown excluding source zone *** - var addTemplateZoneField = $("#dialog_add_template #add_template_zone"); - - // Add default zone - if (isAdmin()) { - addTemplateZoneField.append(""); - } - $.ajax({ - data: createURL("command=listZones&available=true"+maxPageSize), - dataType: "json", - success: function(json) { - var zones = json.listzonesresponse.zone; - if (zones != null && zones.length > 0) { - for (var i = 0; i < zones.length; i++) { - addTemplateZoneField.append(""); - g_zoneIds.push(zones[i].id); - g_zoneNames.push(zones[i].name); - } - } - } - }); } function templateToMidmenu(jsonObj, $midmenuItem1) {