From 80d4beebf2e74a07a9b118f9139f713906187819 Mon Sep 17 00:00:00 2001 From: Seshu-Kumar-M Date: Wed, 5 Oct 2016 19:15:31 +0800 Subject: Dynamic config for the server IP and port Change-Id: I49d1f9bbbfb1b69765cf87c1250e9a76cefa5f1d Signed-off-by: Seshu-Kumar-M --- .../main/webapp/extsys/sdncontroller/conf/dataconfig.json | 4 ++++ .../src/main/webapp/extsys/sdncontroller/js/controller.js | 12 +++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 openo-portal/portal-extsys/src/main/webapp/extsys/sdncontroller/conf/dataconfig.json (limited to 'openo-portal/portal-extsys') diff --git a/openo-portal/portal-extsys/src/main/webapp/extsys/sdncontroller/conf/dataconfig.json b/openo-portal/portal-extsys/src/main/webapp/extsys/sdncontroller/conf/dataconfig.json new file mode 100644 index 00000000..87e36cfd --- /dev/null +++ b/openo-portal/portal-extsys/src/main/webapp/extsys/sdncontroller/conf/dataconfig.json @@ -0,0 +1,4 @@ +{ + "url": "http://localhost", + "port": "8080" +} \ No newline at end of file diff --git a/openo-portal/portal-extsys/src/main/webapp/extsys/sdncontroller/js/controller.js b/openo-portal/portal-extsys/src/main/webapp/extsys/sdncontroller/js/controller.js index fa2f88f1..04437df9 100644 --- a/openo-portal/portal-extsys/src/main/webapp/extsys/sdncontroller/js/controller.js +++ b/openo-portal/portal-extsys/src/main/webapp/extsys/sdncontroller/js/controller.js @@ -13,6 +13,12 @@ * limitations under the License. */ +var url = ""; +$.getJSON("./conf/dataconfig.json", function (jsonData){ + url = jsonData.url +":"+ jsonData.port; + console.log("URL = " + url); +}); + $('.siteDeleteImg').click( function () { var data = $(this).parent().parent().parent().find('td:last').find( @@ -29,7 +35,7 @@ $('.siteDeleteImg').click( }); function deleteController(objectId) { - var requestUrl = "/openoapi/extsys/v1/sdncontrollers/" + objectId; + var requestUrl = url + "/openoapi/extsys/v1/sdncontrollers/" + objectId; $.ajax({ type: "DELETE", url: requestUrl, @@ -48,7 +54,7 @@ function deleteController(objectId) { } function loadControllerData() { - var requestUrl = "/openoapi/extsys/v1/sdncontrollers"; + var requestUrl = url + "/openoapi/extsys/v1/sdncontrollers"; $.ajax({ type: "GET", url: requestUrl, @@ -148,7 +154,7 @@ $(function () { "topologicalController": jsonobj }; formData = JSON.stringify(newJson); - var requestUrl = "/openoapi/extsys/v1/sdncontrollers"; + var requestUrl = url + "/openoapi/extsys/v1/sdncontrollers"; $.ajax({ type: "POST", url: requestUrl, -- cgit 1.2.3-korg