CORD GUI -- Client URL rest requests are no longer hardcoded to "localhost:8080".
Change-Id: I7d41d3df569a7c8dcbbc23d0f13f942303291b5e
Showing
5 changed files
with
17 additions
and
12 deletions
| ... | @@ -17,7 +17,7 @@ | ... | @@ -17,7 +17,7 @@ |
| 17 | (function () { | 17 | (function () { |
| 18 | 'use strict'; | 18 | 'use strict'; |
| 19 | 19 | ||
| 20 | - var url = 'http://localhost:8080/rs/bundle'; | 20 | + var urlSuffix = '/rs/bundle'; |
| 21 | 21 | ||
| 22 | var basic = 'basic', | 22 | var basic = 'basic', |
| 23 | family = 'family'; | 23 | family = 'family'; |
| ... | @@ -32,7 +32,7 @@ | ... | @@ -32,7 +32,7 @@ |
| 32 | getData = function (id) { | 32 | getData = function (id) { |
| 33 | if (!id) { id = ''; } | 33 | if (!id) { id = ''; } |
| 34 | 34 | ||
| 35 | - BundleData = $resource(url + '/' + id); | 35 | + BundleData = $resource($scope.shared.url + urlSuffix + '/' + id); |
| 36 | resource = BundleData.get({}, | 36 | resource = BundleData.get({}, |
| 37 | // success | 37 | // success |
| 38 | function () { | 38 | function () { | ... | ... |
| ... | @@ -17,7 +17,7 @@ | ... | @@ -17,7 +17,7 @@ |
| 17 | (function () { | 17 | (function () { |
| 18 | 'use strict'; | 18 | 'use strict'; |
| 19 | 19 | ||
| 20 | - var url = 'http://localhost:8080/rs/dashboard'; | 20 | + var urlSuffix = '/rs/dashboard'; |
| 21 | 21 | ||
| 22 | angular.module('cordHome', []) | 22 | angular.module('cordHome', []) |
| 23 | .controller('CordHomeCtrl', ['$log', '$scope', '$resource', | 23 | .controller('CordHomeCtrl', ['$log', '$scope', '$resource', |
| ... | @@ -25,7 +25,7 @@ | ... | @@ -25,7 +25,7 @@ |
| 25 | var DashboardData, resource; | 25 | var DashboardData, resource; |
| 26 | $scope.page = 'dashboard'; | 26 | $scope.page = 'dashboard'; |
| 27 | 27 | ||
| 28 | - DashboardData = $resource(url); | 28 | + DashboardData = $resource($scope.shared.url + urlSuffix); |
| 29 | resource = DashboardData.get({}, | 29 | resource = DashboardData.get({}, |
| 30 | // success | 30 | // success |
| 31 | function () { | 31 | function () { | ... | ... |
| ... | @@ -17,8 +17,8 @@ | ... | @@ -17,8 +17,8 @@ |
| 17 | (function () { | 17 | (function () { |
| 18 | 'use strict'; | 18 | 'use strict'; |
| 19 | 19 | ||
| 20 | - var bundleUrl = 'http://localhost:8080/rs/bundle', | 20 | + var bundleUrlSuffix = '/rs/bundle', |
| 21 | - userUrl = 'http://localhost:8080/rs/users', | 21 | + userUrlSuffix = '/rs/users', |
| 22 | family = 'family', | 22 | family = 'family', |
| 23 | url_filter = 'url_filter'; | 23 | url_filter = 'url_filter'; |
| 24 | 24 | ||
| ... | @@ -33,7 +33,7 @@ | ... | @@ -33,7 +33,7 @@ |
| 33 | 33 | ||
| 34 | // === Get data functions --- | 34 | // === Get data functions --- |
| 35 | 35 | ||
| 36 | - BundleData = $resource(bundleUrl); | 36 | + BundleData = $resource($scope.shared.url + bundleUrlSuffix); |
| 37 | bundleResource = BundleData.get({}, | 37 | bundleResource = BundleData.get({}, |
| 38 | // success | 38 | // success |
| 39 | function () { | 39 | function () { |
| ... | @@ -70,12 +70,13 @@ | ... | @@ -70,12 +70,13 @@ |
| 70 | ); | 70 | ); |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | - getUsers(userUrl); | 73 | + getUsers($scope.shared.url + userUrlSuffix); |
| 74 | 74 | ||
| 75 | // === Form functions --- | 75 | // === Form functions --- |
| 76 | 76 | ||
| 77 | function levelUrl(id, level) { | 77 | function levelUrl(id, level) { |
| 78 | - return userUrl + '/' + id + '/apply/url_filter/level/' + level; | 78 | + return $scope.shared.url + |
| 79 | + userUrlSuffix + '/' + id + '/apply/url_filter/level/' + level; | ||
| 79 | } | 80 | } |
| 80 | 81 | ||
| 81 | $scope.applyChanges = function (changeLevels) { | 82 | $scope.applyChanges = function (changeLevels) { | ... | ... |
| ... | @@ -71,7 +71,10 @@ | ... | @@ -71,7 +71,10 @@ |
| 71 | } | 71 | } |
| 72 | }); | 72 | }); |
| 73 | }]) | 73 | }]) |
| 74 | - .controller('CordCtrl', [function () { | 74 | + .controller('CordCtrl', ['$scope', '$location', |
| 75 | - | 75 | + function ($scope, $location) { |
| 76 | + $scope.shared = { | ||
| 77 | + url: 'http://' + $location.host() + ':' + $location.port() | ||
| 78 | + }; | ||
| 76 | }]); | 79 | }]); |
| 77 | }()); | 80 | }()); | ... | ... |
| ... | @@ -54,7 +54,7 @@ | ... | @@ -54,7 +54,7 @@ |
| 54 | 54 | ||
| 55 | </head> | 55 | </head> |
| 56 | <body ng-app="cordGui"> | 56 | <body ng-app="cordGui"> |
| 57 | -<div id="frame" ng-controller="CordCtrl as cordCtrl"></div> | 57 | +<div id="frame" ng-controller="CordCtrl as cordCtrl"> |
| 58 | 58 | ||
| 59 | <mast></mast> | 59 | <mast></mast> |
| 60 | <div id="view" ng-view></div> | 60 | <div id="view" ng-view></div> |
| ... | @@ -91,6 +91,7 @@ | ... | @@ -91,6 +91,7 @@ |
| 91 | </symbol> | 91 | </symbol> |
| 92 | </defs> | 92 | </defs> |
| 93 | </svg> | 93 | </svg> |
| 94 | +</div> | ||
| 94 | 95 | ||
| 95 | </body> | 96 | </body> |
| 96 | </html> | 97 | </html> | ... | ... |
-
Please register or login to post a comment