From 8f083e70ab2e7609e44634bef02227c497bd7b5b Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 7 Oct 2010 09:36:45 -0700 Subject: [PATCH] new UI - IP address page - implement acquire IP action. --- .../classes/resources/resource.properties | 2 + ui/new/jsp/ipaddress.jsp | 21 ++++++++ ui/new/scripts/cloud.core2.ipaddress.js | 54 +++++++++++++++++++ ui/new/scripts/cloud.core2.iso.js | 3 +- 4 files changed, 78 insertions(+), 2 deletions(-) diff --git a/client/WEB-INF/classes/resources/resource.properties b/client/WEB-INF/classes/resources/resource.properties index 02c986fb4ea..2b969d47afb 100644 --- a/client/WEB-INF/classes/resources/resource.properties +++ b/client/WEB-INF/classes/resources/resource.properties @@ -47,6 +47,7 @@ group = Group disk.offering = Disk Offering copy.ISO.to = Copy ISO to no.available.iso = No Available ISO +please.wait = Please wait your.session.has.expired = Your session has expired internet.name.can.not.be.resolved = Internet name can not be resolved @@ -69,6 +70,7 @@ please.specify.limits.to.the.various.resources.-1.means.the.resource.has.no.limi please.confirm.you.want.to.disable.account.that.will.prevent.account.access.to.the.cloud.and.shut.down.all.existing.virtual.machines = Please confirm you want to disable account that will prevent account access to the cloud and shut down all existing virtual machines. please.confirm.you.want.to.lock.account.that.will.prevent.account.access.to.the.cloud = Please confirm you want to lock account that will prevent account access to the cloud. please.confirm.you.want.to.enable.account = Please confirm you want to enable account. +please.select.an.available.zone.to.associate.your.new.ip.with..acquiring.additional.ip.may.cost.you.an.additional.dollars.per.month. = Please select an availability zone to associate your new IP with. Acquiring additional IP may cost you an additional dollars per month. diff --git a/ui/new/jsp/ipaddress.jsp b/ui/new/jsp/ipaddress.jsp index 04668767a48..0f6a20481d2 100644 --- a/ui/new/jsp/ipaddress.jsp +++ b/ui/new/jsp/ipaddress.jsp @@ -433,3 +433,24 @@ + + + + diff --git a/ui/new/scripts/cloud.core2.ipaddress.js b/ui/new/scripts/cloud.core2.ipaddress.js index 40b99182e1c..22079015cf3 100644 --- a/ui/new/scripts/cloud.core2.ipaddress.js +++ b/ui/new/scripts/cloud.core2.ipaddress.js @@ -23,6 +23,60 @@ function afterLoadIpJSP() { return false; }); + //dialogs + initDialog("dialog_acquire_public_ip", 325); + + //*** Acquire New IP (begin) *** + $.ajax({ + data: createURL("command=listZones&available=true"+maxPageSize), + dataType: "json", + success: function(json) { + var zones = json.listzonesresponse.zone; + var zoneSelect = $("#dialog_acquire_public_ip #acquire_zone").empty(); + if (zones != null && zones.length > 0) { + for (var i = 0; i < zones.length; i++) { + zoneSelect.append(""); + } + } + } + }); + + + $("#midmenu_add_link").show(); + $("#midmenu_add_link").unbind("click").bind("click", function(event) { + var submenuContent = $("#submenu_content_network"); + $("#dialog_acquire_public_ip").dialog('option', 'buttons', { + "Acquire": function() { + var thisDialog = $(this); + thisDialog.dialog("close"); + + var zoneid = thisDialog.find("#acquire_zone").val(); + + var $midmenuItem1 = beforeAddingMidMenuItem() ; + + $.ajax({ + data: createURL("command=associateIpAddress&zoneid="+zoneid), + dataType: "json", + success: function(json) { + var items = json.associateipaddressresponse.publicipaddress; + //$("#dialog_info").html("

The IP address "+items[0].ipaddress+" has been assigned to your account

").dialog("open"); + ipToMidmenu(items[0], $midmenuItem1); + bindClickToMidMenu($midmenuItem1, ipToRigntPanel); + afterAddingMidMenuItem($midmenuItem1, true); + + }, + error: function(XMLHttpResponse) { + handleErrorInMidMenu(XMLHttpResponse, $midmenuItem1); + } + }); + }, + "Cancel": function() { + $(this).dialog("close"); + } + }).dialog("open"); + return false; + }); + //*** Acquire New IP (end) *** //Port Fowording tab var $createPortForwardingRow = $("#tab_content_port_forwarding #create_port_forwarding_row"); diff --git a/ui/new/scripts/cloud.core2.iso.js b/ui/new/scripts/cloud.core2.iso.js index a0b612709dd..c3635964fd3 100644 --- a/ui/new/scripts/cloud.core2.iso.js +++ b/ui/new/scripts/cloud.core2.iso.js @@ -5,8 +5,7 @@ function afterLoadIsoJSP() { var $detailsTab = $("#right_panel_content #tab_content_details"); //add button *** - $("#midmenu_add_link").show(); - + $("#midmenu_add_link").show(); $("#midmenu_add_link").unbind("click").bind("click", function(event) { $("#dialog_add_iso") .dialog('option', 'buttons', {