From f44bb4940efaaa10486afe79c89935068b28a545 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Fri, 2 Mar 2012 13:37:02 +0100 Subject: [PATCH] Feature #1109: Add SelfService support in ozones Add self service end point when creating a zone. Show self service public link when showing VDC information. --- .../Server/public/js/plugins/vdcs-tab.js | 12 ++++++--- .../Server/public/js/plugins/zones-tab.js | 27 ++++++++++++++++--- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/ozones/Server/public/js/plugins/vdcs-tab.js b/src/ozones/Server/public/js/plugins/vdcs-tab.js index d03b75c7f8..4a4f8cbb1f 100644 --- a/src/ozones/Server/public/js/plugins/vdcs-tab.js +++ b/src/ozones/Server/public/js/plugins/vdcs-tab.js @@ -282,12 +282,14 @@ function updateVDCInfo(req,vdc_json){ var zone_host = ""; var zone_port = ""; var sun_link = ""; + var self_link = ""; var zone_match = zone_endpoint.match(/^https?:\/\/([\w.-]+):(\d+)\/([\W\w]+)$/); if (zone_match){ zone_host = zone_match[1]; zone_port = zone_match[2]; sun_link = "http://" + zone_host +"/sunstone_"+ vdc.NAME+"/"; + self_link = "http://" + zone_host +"/self_"+ vdc.NAME+"/"; }; var info_tab = { @@ -330,6 +332,10 @@ function updateVDCInfo(req,vdc_json){ Sunstone public link\ '+(sun_link.length? ''+sun_link+'' : "")+'\ \ + \ + SelfService public link\ + '+(self_link.length? ''+self_link+'' : "")+'\ + \ \ ONE_XMLPRC (to export for CLI access)\ \ @@ -501,12 +507,10 @@ function setupCreateVDCDialog(){ "ZONEID" : zoneid, "VDCADMINNAME" : vdcadminname, "VDCADMINPASS" : vdcadminpass, - "FORCE" : force + "FORCE" : force, + "HOSTS" : hosts } }; - if (hosts.length){ - vdc_json["VDC"]["HOSTS"]=hosts; - }; Sunstone.runAction("VDC.create",vdc_json); dialog.dialog('close'); diff --git a/src/ozones/Server/public/js/plugins/zones-tab.js b/src/ozones/Server/public/js/plugins/zones-tab.js index 4fbb8daeb4..d7430e75ad 100644 --- a/src/ozones/Server/public/js/plugins/zones-tab.js +++ b/src/ozones/Server/public/js/plugins/zones-tab.js @@ -53,6 +53,12 @@ var create_zone_tmpl = /\ \
\ + \ + ://\ + :\ + /\ + \ +
\ \ \
\ @@ -310,8 +316,12 @@ function updateZoneInfo(req,zone_json){ '+zone.ENDPOINT+'\ \ \ - Sunstone endpoint\ -'+ (zone.SUNSENDPOINT.length? ''+zone.SUNSENDPOINT+'' : "") +'\ + Sunstone endpoint\ + '+ (zone.SUNSENDPOINT.length? ''+zone.SUNSENDPOINT+'' : "") +'\ + \ + \ + SelfService endpoint\ + '+ (zone.SELFENDPOINT.length? ''+zone.SELFENDPOINT+'' : "") +'\ \ \ #VDCs\ @@ -557,11 +567,17 @@ function setupCreateZoneDialog(){ var endpoint_port = $('#endpoint_port',this).val(); var onename = $('#onename',this).val(); var onepass = $('#onepass',this).val(); + var se = $('#sunsendpoint',this).val(); var se_ptc = $('#sunsendpoint_ptc',this).val(); var se_port = $('#sunsendpoint_port',this).val(); var se_path = $('#sunsendpoint_path',this).val(); + var ss = $('#selfsendpoint',this).val(); + var ss_ptc = $('#selfsendpoint_ptc',this).val(); + var ss_port = $('#selfsendpoint_port',this).val(); + var ss_path = $('#selfsendpoint_path',this).val(); + if (!name.length || !endpoint.length || !onename.length || !onepass.length){ notifyError("Please fill in all fields"); @@ -575,13 +591,18 @@ function setupCreateZoneDialog(){ se = se_ptc + "://" + se + ":" + se_port + "/" + se_path; + if (ss.length) + ss = ss_ptc + "://" + ss + ":" + ss_port + + "/" + ss_path; + var zone_json = { "ZONE": { "NAME": name, "ENDPOINT": endpoint, "ONENAME": onename, "ONEPASS": onepass, - "SUNSENDPOINT" : se + "SUNSENDPOINT" : se, + "SELFENDPOINT" : ss, } };