CORD GUI -- Client URL rest requests are no longer hardcoded to "localhost:8080".
Change-Id: I7d41d3df569a7c8dcbbc23d0f13f942303291b5e
diff --git a/apps/demo/cord-gui/src/main/webapp/app/view/bundle/bundle.js b/apps/demo/cord-gui/src/main/webapp/app/view/bundle/bundle.js
index ea7b450..c383b36 100644
--- a/apps/demo/cord-gui/src/main/webapp/app/view/bundle/bundle.js
+++ b/apps/demo/cord-gui/src/main/webapp/app/view/bundle/bundle.js
@@ -17,7 +17,7 @@
(function () {
'use strict';
- var url = 'http://localhost:8080/rs/bundle';
+ var urlSuffix = '/rs/bundle';
var basic = 'basic',
family = 'family';
@@ -32,7 +32,7 @@
getData = function (id) {
if (!id) { id = ''; }
- BundleData = $resource(url + '/' + id);
+ BundleData = $resource($scope.shared.url + urlSuffix + '/' + id);
resource = BundleData.get({},
// success
function () {
diff --git a/apps/demo/cord-gui/src/main/webapp/app/view/home/home.js b/apps/demo/cord-gui/src/main/webapp/app/view/home/home.js
index be600f7..c28cb81 100644
--- a/apps/demo/cord-gui/src/main/webapp/app/view/home/home.js
+++ b/apps/demo/cord-gui/src/main/webapp/app/view/home/home.js
@@ -17,7 +17,7 @@
(function () {
'use strict';
- var url = 'http://localhost:8080/rs/dashboard';
+ var urlSuffix = '/rs/dashboard';
angular.module('cordHome', [])
.controller('CordHomeCtrl', ['$log', '$scope', '$resource',
@@ -25,7 +25,7 @@
var DashboardData, resource;
$scope.page = 'dashboard';
- DashboardData = $resource(url);
+ DashboardData = $resource($scope.shared.url + urlSuffix);
resource = DashboardData.get({},
// success
function () {
diff --git a/apps/demo/cord-gui/src/main/webapp/app/view/user/user.js b/apps/demo/cord-gui/src/main/webapp/app/view/user/user.js
index 3ccfe04..032abea 100644
--- a/apps/demo/cord-gui/src/main/webapp/app/view/user/user.js
+++ b/apps/demo/cord-gui/src/main/webapp/app/view/user/user.js
@@ -17,8 +17,8 @@
(function () {
'use strict';
- var bundleUrl = 'http://localhost:8080/rs/bundle',
- userUrl = 'http://localhost:8080/rs/users',
+ var bundleUrlSuffix = '/rs/bundle',
+ userUrlSuffix = '/rs/users',
family = 'family',
url_filter = 'url_filter';
@@ -33,7 +33,7 @@
// === Get data functions ---
- BundleData = $resource(bundleUrl);
+ BundleData = $resource($scope.shared.url + bundleUrlSuffix);
bundleResource = BundleData.get({},
// success
function () {
@@ -70,12 +70,13 @@
);
}
- getUsers(userUrl);
+ getUsers($scope.shared.url + userUrlSuffix);
// === Form functions ---
function levelUrl(id, level) {
- return userUrl + '/' + id + '/apply/url_filter/level/' + level;
+ return $scope.shared.url +
+ userUrlSuffix + '/' + id + '/apply/url_filter/level/' + level;
}
$scope.applyChanges = function (changeLevels) {
diff --git a/apps/demo/cord-gui/src/main/webapp/cord.js b/apps/demo/cord-gui/src/main/webapp/cord.js
index 81aa565..2d012ae 100644
--- a/apps/demo/cord-gui/src/main/webapp/cord.js
+++ b/apps/demo/cord-gui/src/main/webapp/cord.js
@@ -71,7 +71,10 @@
}
});
}])
- .controller('CordCtrl', [function () {
-
+ .controller('CordCtrl', ['$scope', '$location',
+ function ($scope, $location) {
+ $scope.shared = {
+ url: 'http://' + $location.host() + ':' + $location.port()
+ };
}]);
}());
diff --git a/apps/demo/cord-gui/src/main/webapp/index.html b/apps/demo/cord-gui/src/main/webapp/index.html
index 3a3b686..297e63b 100644
--- a/apps/demo/cord-gui/src/main/webapp/index.html
+++ b/apps/demo/cord-gui/src/main/webapp/index.html
@@ -54,7 +54,7 @@
</head>
<body ng-app="cordGui">
-<div id="frame" ng-controller="CordCtrl as cordCtrl"></div>
+<div id="frame" ng-controller="CordCtrl as cordCtrl">
<mast></mast>
<div id="view" ng-view></div>
@@ -91,6 +91,7 @@
</symbol>
</defs>
</svg>
+</div>
</body>
</html>