Bri Prebilic Cole

CORD GUI -- Client URL rest requests are no longer hardcoded to "localhost:8080".

Change-Id: I7d41d3df569a7c8dcbbc23d0f13f942303291b5e
......@@ -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 () {
......
......@@ -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 () {
......
......@@ -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) {
......
......@@ -71,7 +71,10 @@
}
});
}])
.controller('CordCtrl', [function () {
.controller('CordCtrl', ['$scope', '$location',
function ($scope, $location) {
$scope.shared = {
url: 'http://' + $location.host() + ':' + $location.port()
};
}]);
}());
......
......@@ -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>
......