From 756e963cd3d2d202217399aaeb5976b35fe5f1e7 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Sun, 7 Nov 2010 11:35:53 -0800 Subject: [PATCH] new UI - remove "no items available" after adding a new item in middle menu. --- ui/scripts/cloud.core.ipaddress.js | 8 ++++---- ui/scripts/cloud.core.js | 7 +++++++ ui/scripts/cloud.core.volume.js | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ui/scripts/cloud.core.ipaddress.js b/ui/scripts/cloud.core.ipaddress.js index 2a4663f4c13..1382a89d4e6 100644 --- a/ui/scripts/cloud.core.ipaddress.js +++ b/ui/scripts/cloud.core.ipaddress.js @@ -919,7 +919,7 @@ function portForwardingJsonToTemplate(jsonObj, $template) { $rowContainer.show(); } else if (result.jobstatus == 2) { //Fail $spinningWheel.hide(); - $("#dialog_alert").text(fromdb(result.jobresult)).dialog("open"); + $("#dialog_alert").text(fromdb(result.jobresult.errortext)).dialog("open"); } } }, @@ -1139,7 +1139,7 @@ function loadBalancerJsonToTemplate(jsonObj, $template) { $spinningWheel.hide(); $rowContainerEdit.hide(); $rowContainer.show(); - $("#dialog_alert").text(fromdb(result.jobresult)).dialog("open"); + $("#dialog_alert").text(fromdb(result.jobresult.errortext)).dialog("open"); } } }, @@ -1204,7 +1204,7 @@ function loadBalancerJsonToTemplate(jsonObj, $template) { $spinningWheel.hide(); } else if (result.jobstatus == 2) { // Failed //fail reason ("jobresult") is not returned any more after API refactor.... - //$("#dialog_error").text(fromdb(result.jobresult)).dialog("open"); + //$("#dialog_error").text(fromdb(result.jobresult.errortext)).dialog("open"); $("#dialog_error").text("Assigning instance to load balancer rule failed").dialog("open"); $spinningWheel.hide(); } @@ -1271,7 +1271,7 @@ function lbVmObjToTemplate(obj, $template) { $(this).remove(); }); } else if (result.jobstatus == 2) { // Failed - $("#dialog_error").text(fromdb(result.jobresult)).dialog("open"); + $("#dialog_error").text(fromdb(result.jobresult.errortext)).dialog("open"); $spinningWheel.hide(); } } diff --git a/ui/scripts/cloud.core.js b/ui/scripts/cloud.core.js index 2dea4de296b..15b1740c7d6 100644 --- a/ui/scripts/cloud.core.js +++ b/ui/scripts/cloud.core.js @@ -665,6 +665,13 @@ function afterAddingMidMenuItem($midmenuItem1, isSuccessful, extraMessage) { if(isSuccessful == true) { $midmenuItem1.find("#info_icon").removeClass("error").show(); $midmenuItem1.data("afterActionInfo", ("Adding succeeded.")); + + var $noItemsAvailable = $("#midmenu_container").find("#midmenu_container_no_items_available"); + if($noItemsAvailable.length > 0) { + $noItemsAvailable.slideUp("slow", function() { + $(this).remove(); + }); + } } else { $midmenuItem1.find("#content").addClass("addingfailed"); diff --git a/ui/scripts/cloud.core.volume.js b/ui/scripts/cloud.core.volume.js index e3a36b7913e..4d160f2d256 100644 --- a/ui/scripts/cloud.core.volume.js +++ b/ui/scripts/cloud.core.volume.js @@ -115,7 +115,7 @@ function afterLoadVolumeJSP() { bindClickToMidMenu($midmenuItem1, volumeToRightPanel, getMidmenuId); afterAddingMidMenuItem($midmenuItem1, true); } else if (result.jobstatus == 2) { - afterAddingMidMenuItem($midmenuItem1, false, fromdb(result.jobresult)); + afterAddingMidMenuItem($midmenuItem1, false, fromdb(result.jobresult.errortext)); } } },