From 75217ec1ccfa4a2ea8dd12fb644745ef81b087a1 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Fri, 22 Jul 2011 13:41:19 -0700 Subject: [PATCH] cloudStack - network page - Edit Network action - show spinning wheel in action (Edit Network is async now). --- .../classes/resources/messages.properties | 1 + ui/jsp/network.jsp | 1 + ui/scripts/cloud.core.network.js | 31 ++++++++++++++++--- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties index 36ec57baf7c..2294ba2e7fe 100644 --- a/client/WEB-INF/classes/resources/messages.properties +++ b/client/WEB-INF/classes/resources/messages.properties @@ -125,6 +125,7 @@ label.action.delete.ingress.rule.processing=Deleting Ingress Rule.... label.action.delete.ingress.rule=Delete Ingress Rule label.action.delete.load.balancer.processing=Deleting Load Balancer.... label.action.delete.load.balancer=Delete Load Balancer +label.action.edit.network.processing=Editing Network.... label.action.edit.network=Edit Network label.action.delete.network.processing=Deleting Network.... label.action.delete.network=Delete Network diff --git a/ui/jsp/network.jsp b/ui/jsp/network.jsp index 12ecbc5f0ae..d97ff373223 100644 --- a/ui/jsp/network.jsp +++ b/ui/jsp/network.jsp @@ -14,6 +14,7 @@ dictionary = { 'label.action.delete.load.balancer' : '', 'label.action.delete.load.balancer.processing' : '', 'label.action.edit.network' : '', + 'label.action.edit.network.processing' : '', 'label.action.delete.network' : '', 'label.action.delete.network.processing' : '', 'message.action.delete.network' : '', diff --git a/ui/scripts/cloud.core.network.js b/ui/scripts/cloud.core.network.js index e6aedfb16f6..d93b0b6fd8f 100644 --- a/ui/scripts/cloud.core.network.js +++ b/ui/scripts/cloud.core.network.js @@ -1547,8 +1547,25 @@ function doEditDirectNetwork2($actionLink, $detailsTab, $midmenuItem1, $readonly isValid &= validateString("Display Text", $detailsTab.find("#displaytext_edit"), $detailsTab.find("#displaytext_edit_errormsg"), true); if (!isValid) return; - - //updateNetwork is async job + + var label = "label.action.edit.network"; + var label2; + if(label in dictionary) + label2 = dictionary[label]; + else + label2 = label; + + var inProcessText = "label.action.edit.network.processing"; + var inProcessText2; + if(inProcessText in dictionary) + inProcessText2 = dictionary[inProcessText]; + else + inProcessText2 = inProcessText; + + var $spinningWheel = $detailsTab.find("#spinning_wheel"); + $spinningWheel.find("#description").text(inProcessText2); + $spinningWheel.show(); + var $afterActionInfoContainer = $("#right_panel_content #after_action_info_container_on_top"); $afterActionInfoContainer.removeClass("errorbox").hide(); @@ -1571,7 +1588,8 @@ function doEditDirectNetwork2($actionLink, $detailsTab, $midmenuItem1, $readonly success: function(json) { var jobId = json.updatenetworkresponse.jobid; var timerKey = "updatenetworkJob_"+jobId; - + g_nonCompleteAsyncJob[jobId] = label2; + $("body").everyTime(2000, timerKey, function() { $.ajax({ data: createURL("command=queryAsyncJobResult&jobId="+jobId), @@ -1582,6 +1600,9 @@ function doEditDirectNetwork2($actionLink, $detailsTab, $midmenuItem1, $readonly return; //Job has not completed } else { $("body").stopTime(timerKey); + delete g_nonCompleteAsyncJob[jobId]; + $spinningWheel.hide(); + if (result.jobstatus == 1) { // Succeeded var jsonObj = result.jobresult.network; @@ -1592,7 +1613,7 @@ function doEditDirectNetwork2($actionLink, $detailsTab, $midmenuItem1, $readonly $readonlyFields.show(); $("#save_button, #cancel_button").hide(); } else if (result.jobstatus == 2) { - var errorMsg = dictionary['label.action.edit.network']+ " - " + g_dictionary["label.failed"] + " - " + fromdb(result.jobresult.errortext); + var errorMsg = label2+ " - " + g_dictionary["label.failed"] + " - " + fromdb(result.jobresult.errortext); if($("#middle_menu").css("display") != "none") handleMidMenuItemAfterDetailsTabAction($midmenuItem1, false, errorMsg); else @@ -1603,7 +1624,7 @@ function doEditDirectNetwork2($actionLink, $detailsTab, $midmenuItem1, $readonly error: function(XMLHttpResponse) { $("body").stopTime(timerKey); handleError(XMLHttpResponse, function() { - handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, dictionary['label.action.edit.network'], $afterActionInfoContainer, $midmenuItem1); + handleErrorInDetailsTab(XMLHttpResponse, $detailsTab, label2, $afterActionInfoContainer, $midmenuItem1); }); } });