Skip to content

Commit

Permalink
Upgraded to Angular 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Leggett committed Jan 16, 2017
1 parent 491c09f commit 8d809fd
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 53 deletions.
18 changes: 9 additions & 9 deletions client/package.json
Expand Up @@ -33,15 +33,15 @@
"yargs": "^3.20.0"
},
"dependencies": {
"angular": "~1.4.4",
"angular-animate": "~1.4.4",
"angular-aria": "~1.4.4",
"angular-cookies": "~1.4.4",
"angular-messages": "~1.4.4",
"angular-mocks": "~1.4.4",
"angular-resource": "~1.4.4",
"angular-route": "~1.4.4",
"angular-sanitize": "~1.4.4",
"angular": "~1.6.1",
"angular-animate": "~1.6.1",
"angular-aria": "~1.6.1",
"angular-cookies": "~1.6.1",
"angular-messages": "~1.6.1",
"angular-mocks": "~1.6.1",
"angular-resource": "~1.6.1",
"angular-route": "~1.6.1",
"angular-sanitize": "~1.6.1",
"bootstrap-sass": "~3.3.5",
"font-awesome": "~4.4.0"
}
Expand Down
4 changes: 2 additions & 2 deletions client/src/main/webapp/js/custom/config.js
@@ -1,7 +1,7 @@
'use strict';

angular.module('app').config([ '$routeProvider', '$httpProvider', '$locationProvider', function($routeProvider, $httpProvider, $locationProvider) {

angular.module('app').config([ '$routeProvider', '$httpProvider', '$locationProvider',
function($routeProvider, $httpProvider, $locationProvider) {
$locationProvider.html5Mode(true);

var user = ['$rootScope', 'userService','storageService', 'storageConstant', function ($rootScope, userService, storageService, storageConstant) {
Expand Down
@@ -1,7 +1,7 @@
'use strict';

angular.module('app.controllers').controller('CustomerController',['$rootScope', '$scope', '$location', 'customerService', 'messageService', function ($rootScope, $scope, $location, customerService, messageService) {

angular.module('app.controllers').controller('CustomerController',['$rootScope', '$scope', '$location', 'customerService', 'messageService',
function ($rootScope, $scope, $location, customerService, messageService) {
customerService.getCustomers().then(
function success(customers) {
$scope.customers = customers;
Expand Down
@@ -1,6 +1,7 @@
'use strict';

angular.module('app.controllers').controller('LoginController', ['$location', '$rootScope', '$scope', 'authenticationService', 'messageService', function ($location, $rootScope, $scope, authenticationService, messageService) {
angular.module('app.controllers').controller('LoginController', ['$location', '$rootScope', '$scope', 'authenticationService', 'messageService',
function ($location, $rootScope, $scope, authenticationService, messageService) {
$scope.login = function (credentials) {
authenticationService.login(credentials)
.then(function() {
Expand Down
@@ -1,6 +1,7 @@
'use strict';

angular.module('app.controllers').controller('MenuController', ['$location', '$scope', 'authenticationService', 'messageService', function ($location, $scope, authenticationService, messageService) {
angular.module('app.controllers').controller('MenuController', ['$location', '$scope', 'authenticationService', 'messageService',
function ($location, $scope, authenticationService, messageService) {
$scope.logout = function logout() {
authenticationService.logout()
.then(function() {
Expand Down
3 changes: 2 additions & 1 deletion client/src/main/webapp/js/custom/directives/exampleFocus.js
@@ -1,6 +1,7 @@
'use strict';

angular.module('app.directives').directive('exampleFocus', function ($timeout) {
angular.module('app.directives').directive('exampleFocus',
function ($timeout) {
return {
scope: {
trigger: '@exampleFocus'
Expand Down
4 changes: 2 additions & 2 deletions client/src/main/webapp/js/custom/listener.js
@@ -1,7 +1,7 @@
'use strict';

angular.module('app').run(['$rootScope', '$http', '$location', 'titleService', function ($rootScope, $http, $location, titleService) {

angular.module('app').run(['$rootScope', '$http', '$location', 'titleService',
function ($rootScope, $http, $location, titleService) {
$rootScope.navigateTo = "/main";

$rootScope.$on('$routeChangeSuccess', function(event, next, current) {
Expand Down
18 changes: 8 additions & 10 deletions client/src/main/webapp/js/custom/services/authenticationService.js
@@ -1,23 +1,22 @@
'use strict';

angular.module('app.services').service('authenticationService', ['$rootScope', '$http', '$q', 'base64Service', 'storageService', 'storageConstant', 'propertiesConstant', function ($rootScope, $http, $q, base64Service, storageService, storageConstant, propertiesConstant) {
angular.module('app.services').service('authenticationService', ['$rootScope', '$http', '$q', 'base64Service', 'storageService', 'storageConstant', 'propertiesConstant',
function ($rootScope, $http, $q, base64Service, storageService, storageConstant, propertiesConstant) {
this.login = function (credentials) {
var d = $q.defer();

$http.defaults.headers.common.Authorization = 'Basic ' + base64Service.encode(credentials.email + ':' + credentials.password);

$http.post(propertiesConstant.API_URL + '/auth/login', null)
.success(function (data, status, headers, config) {

storageService.setSessionItem(storageConstant.AUTH_TOKEN, headers('X-AUTH-TOKEN'));
.then(function success(response) {
storageService.setSessionItem(storageConstant.AUTH_TOKEN, response.headers('X-AUTH-TOKEN'));

delete $http.defaults.headers.common.Authorization;

d.resolve();
})
.error(function () {
}, function error() {
d.reject();
});
});

return d.promise;
};
Expand All @@ -26,15 +25,14 @@ angular.module('app.services').service('authenticationService', ['$rootScope', '
var d = $q.defer();

$http.post(propertiesConstant.API_URL + '/auth/logout', null)
.success(function () {
.then(function success() {
storageService.removeSessionItem(storageConstant.AUTH_TOKEN);
storageService.removeSessionItem(storageConstant.USER);

delete $rootScope.user;

d.resolve();
})
.error(function () {
}, function error() {
d.reject();
});

Expand Down
3 changes: 2 additions & 1 deletion client/src/main/webapp/js/custom/services/base64Service.js
@@ -1,6 +1,7 @@
'use strict';

angular.module('app.services').service('base64Service', function () {
angular.module('app.services').service('base64Service',
function () {
var keyStr = "ABCDEFGHIJKLMNOP" +
"QRSTUVWXYZabcdef" +
"ghijklmnopqrstuv" +
Expand Down
26 changes: 12 additions & 14 deletions client/src/main/webapp/js/custom/services/customerService.js
@@ -1,15 +1,15 @@
'use strict';

angular.module('app.services').service('customerService', [ '$http', '$q', 'propertiesConstant', function ($http, $q, propertiesConstant) {
angular.module('app.services').service('customerService', [ '$http', '$q', 'propertiesConstant',
function ($http, $q, propertiesConstant) {
this.getCustomers = function () {
var d = $q.defer();

$http.get(propertiesConstant.API_URL + '/customer')
.success(function (customers) {
d.resolve(customers);
})
.error(function (data, status, headers, config) {
d.reject(status);
.then(function success(response) {
d.resolve(response.data);
}, function error(response) {
d.reject(response.status);
});

return d.promise;
Expand All @@ -19,10 +19,9 @@ angular.module('app.services').service('customerService', [ '$http', '$q', 'prop
var d = $q.defer();

$http.delete(propertiesConstant.API_URL + '/customer/' + id)
.success(function (response) {
d.resolve(response);
})
.error(function () {
.then(function success(response) {
d.resolve(response.data);
}, function error() {
d.reject();
});

Expand All @@ -33,10 +32,9 @@ angular.module('app.services').service('customerService', [ '$http', '$q', 'prop
var d = $q.defer();

$http.post(propertiesConstant.API_URL + '/customer', customer)
.success(function (response) {
d.resolve(response);
})
.error(function () {
.then(function success(response) {
d.resolve(response.data);
}, function error() {
d.reject();
});

Expand Down
3 changes: 2 additions & 1 deletion client/src/main/webapp/js/custom/services/messageService.js
@@ -1,6 +1,7 @@
'use strict';

angular.module('app.services').service('messageService', ['$rootScope', function ($rootScope) {
angular.module('app.services').service('messageService', ['$rootScope',
function ($rootScope) {
$rootScope.errors = [];
$rootScope.alerts = [];

Expand Down
3 changes: 2 additions & 1 deletion client/src/main/webapp/js/custom/services/storageService.js
@@ -1,6 +1,7 @@
'use strict';

angular.module('app.services').service('storageService', ['$rootScope', '$window', function ($rootScope, $window) {
angular.module('app.services').service('storageService', ['$rootScope', '$window',
function ($rootScope, $window) {
this.getLocalItem = function (key) {
return JSON.parse($window.localStorage.getItem(key));
};
Expand Down
4 changes: 2 additions & 2 deletions client/src/main/webapp/js/custom/services/titleService.js
@@ -1,7 +1,7 @@
'use strict';

angular.module('app.services').service('titleService', ['$route', '$window', function ($route, $window) {

angular.module('app.services').service('titleService', ['$route', '$window',
function ($route, $window) {
var title = $window.document.title;

this.changeTitle = function () {
Expand Down
7 changes: 3 additions & 4 deletions client/src/main/webapp/js/custom/services/userService.js
Expand Up @@ -5,10 +5,9 @@ angular.module('app.services').service('userService', ['$http', '$q', 'propertie
var d = $q.defer();

$http.get(propertiesConstant.API_URL + '/user')
.success(function (user) {
d.resolve(user);
})
.error(function () {
.then(function success(response) {
d.resolve(response.data);
}, function error() {
d.reject();
});

Expand Down
4 changes: 2 additions & 2 deletions client/src/test/webapp/specs/custom/customerService.spec.js
Expand Up @@ -37,8 +37,8 @@ describe('CustomerService Tests', function (){
$httpBackend.whenGET(propertiesConstant.API_URL + '/customer').respond(customers);

// check result returned from service call
customerService.getCustomers().then(function (data) {
expect(data).toEqual(customers);
customerService.getCustomers().then(function (customers) {
expect(customers).toEqual(customers);
});

$httpBackend.flush();
Expand Down

0 comments on commit 8d809fd

Please sign in to comment.