From: Bill Erickson Date: Fri, 2 Jun 2017 21:01:32 +0000 (-0400) Subject: LP#1739803 Angular 1.6 + dependency updates X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=45e0ae8d3dd4a3e1aa330755f1733a8fa82b8f09;p=working%2FEvergreen.git LP#1739803 Angular 1.6 + dependency updates Rebuild package.json starting with Angular 1.6. This resulted in a number of dependency updates and small changes required to keep the dependencies happy. * Teach print.js to use promise-style $http responses, instead of .success() and .error() * Remove unused '$http' dependency in hatch.js * Fix egDate custom test matcher to work with newer version of karma-jasmine. * Build IDL for test scripts using Grunt/exec "cwd" since Grunt fails to understand "&&" commands, like 'cd foo && bar'. * For correctness, move dev-only depenencies into the package.json devDependencies section. See also https://docs.angularjs.org/guide/migration#migrating-from-1-5-to-1-6 Signed-off-by: Bill Erickson --- diff --git a/Open-ILS/web/js/ui/default/staff/Gruntfile.js b/Open-ILS/web/js/ui/default/staff/Gruntfile.js index 13ae1dabb2..b6f8e4bdd5 100644 --- a/Open-ILS/web/js/ui/default/staff/Gruntfile.js +++ b/Open-ILS/web/js/ui/default/staff/Gruntfile.js @@ -203,7 +203,8 @@ module.exports = function(grunt) { // Generate test/data/IDL2js.js for unit tests. // note: the output of this script is *not* part of the final build. idl2js : { - command : 'cd test/data && perl idl2js.pl' + cwd: 'test/data', + command : 'perl idl2js.pl' }, // Remove the unit test IDL2js.js file. We don't need it after testing diff --git a/Open-ILS/web/js/ui/default/staff/package.json b/Open-ILS/web/js/ui/default/staff/package.json index 7ee67d9c00..26a48a1401 100644 --- a/Open-ILS/web/js/ui/default/staff/package.json +++ b/Open-ILS/web/js/ui/default/staff/package.json @@ -3,45 +3,47 @@ "description": "Evergreen ILS Browser Staff Client", "version": "0.0.1", "license": "GPL", - "homepage": "http://evergreen-ils.org/", + "homepage": "https://evergreen-ils.org/", "devDependencies": { - "angular": "~1.5", - "angular-animate": "~1.5.3", - "angular-ui-bootstrap": "~1.3.3", - "angular-cookies": "~1.5.8", - "angular-file-saver": "~1.1.0", - "angular-hotkeys": "^1.7.0", - "angular-location-update": "~0.0.2", - "angular-mocks": "~1.5.0", - "angular-route": "~1.5.0", - "angular-tree-control": "~0.2.28", - "angular-tablesort": "^1.4.1", - "angular-order-object-by": "rxfork/ngOrderObjectBy#npm", - "lovefield": "*", - "moment": "*", - "moment-timezone": "*", - "bootstrap": "~3.3.6", - "grunt": "~0.4.4", - "grunt-cli": "^0.1.13", - "grunt-contrib-concat": "^0.4.0", - "grunt-contrib-copy": "^0.5.0", - "grunt-contrib-cssmin": "^0.9.0", - "grunt-contrib-jasmine": "^0.6.4", - "grunt-contrib-uglify": "^0.4.0", - "grunt-exec": "^0.4.5", - "grunt-karma": "^0.8.3", - "iframe-resizer": "^3.5.5", - "jquery": "~2.2.1", - "karma": "^0.12.14", - "karma-jasmine": "^0.1.5", - "karma-phantomjs-launcher": "^1.0.0", - "karma-script-launcher": "~0.1.0", - "karma-spec-reporter": "0.0.12", - "karma-story-reporter": "^0.2.2", - "ng-toast": "~2.0.0", - "phantomjs-prebuilt": "^2.1.7" + "angular-mocks": "^1.6.7", + "grunt": "^1.0.1", + "grunt-cli": "^1.2.0", + "grunt-contrib-concat": "^1.0.1", + "grunt-contrib-copy": "^1.0.0", + "grunt-contrib-cssmin": "^2.2.1", + "grunt-contrib-jasmine": "^1.1.0", + "grunt-contrib-uglify": "^3.2.1", + "grunt-exec": "^3.0.0", + "grunt-karma": "^2.0.0", + "karma": "^1.7.1", + "karma-jasmine": "^1.1.1", + "karma-phantomjs-launcher": "^1.0.4", + "karma-script-launcher": "^1.0.0", + "karma-spec-reporter": "0.0.32", + "karma-story-reporter": "^0.3.1", + "phantomjs-prebuilt": "^2.1.16" }, "scripts": { "test": "grunt test" + }, + "dependencies": { + "angular": "^1.6.7", + "angular-animate": "^1.6.7", + "angular-cookies": "^1.6.7", + "angular-file-saver": "^1.1.3", + "angular-hotkeys": "^1.7.0", + "angular-location-update": "0.0.2", + "angular-order-object-by": "github:rxfork/ngOrderObjectBy#npm", + "angular-route": "^1.6.7", + "angular-tablesort": "^1.6.0", + "angular-tree-control": "^0.2.28", + "angular-ui-bootstrap": "^2.5.6", + "bootstrap": "^3.3.7", + "iframe-resizer": "^3.5.15", + "jquery": "^3.2.1", + "lovefield": "^2.1.12", + "moment": "^2.20.1", + "moment-timezone": "^0.5.14", + "ng-toast": "^2.0.0" } } diff --git a/Open-ILS/web/js/ui/default/staff/services/hatch.js b/Open-ILS/web/js/ui/default/staff/services/hatch.js index 0a27b152e6..e8107ea2a2 100644 --- a/Open-ILS/web/js/ui/default/staff/services/hatch.js +++ b/Open-ILS/web/js/ui/default/staff/services/hatch.js @@ -25,8 +25,8 @@ angular.module('egCoreMod') .factory('egHatch', - ['$q','$window','$timeout','$interpolate','$http','$cookies', - function($q , $window , $timeout , $interpolate , $http , $cookies) { + ['$q','$window','$timeout','$interpolate','$cookies', + function($q , $window , $timeout , $interpolate , $cookies) { var service = {}; service.msgId = 1; diff --git a/Open-ILS/web/js/ui/default/staff/services/print.js b/Open-ILS/web/js/ui/default/staff/services/print.js index d6ddf595d6..fee4c8af8a 100644 --- a/Open-ILS/web/js/ui/default/staff/services/print.js +++ b/Open-ILS/web/js/ui/default/staff/services/print.js @@ -223,12 +223,13 @@ function($q , $window , $timeout , $http , egHatch , egAuth , egIDL , egOrg , eg var path = service.template_base_path + name; console.debug('fetching template ' + path); - $http.get(path) - .success(function(data) { deferred.resolve(data) }) - .error(function() { - console.error('unable to locate print template: ' + name); - deferred.reject(); - }); + $http.get(path).then( + function(data) { deferred.resolve(data.data) }, + function() { + console.error('unable to locate print template: ' + name); + deferred.reject(); + } + ); }); return deferred.promise; diff --git a/Open-ILS/web/js/ui/default/staff/test/unit/egDate.js b/Open-ILS/web/js/ui/default/staff/test/unit/egDate.js index 5802e2d90c..680def5a3c 100644 --- a/Open-ILS/web/js/ui/default/staff/test/unit/egDate.js +++ b/Open-ILS/web/js/ui/default/staff/test/unit/egDate.js @@ -4,27 +4,31 @@ describe('egDate', function(){ beforeEach(module('egCoreMod')); beforeEach(function () { - this.addMatchers({ + jasmine.addMatchers({ // "2 days" may be 47, 48, or 49 hours depending on the // proximity to and direction of a time change event. // This does not take leap seconds into account. toBe2DaysOfSeconds: function () { - var actual = this.actual; - var hours_47 = 169200; - var hours_48 = 172800; - var hours_49 = 176400; - - this.message = function () { - return "Expected " + actual + " to be " + - hours_47 + ", " + hours_48 + ", or " + hours_49; + return { + compare : function(actual) { + var hours_47 = 169200; + var hours_48 = 172800; + var hours_49 = 176400; + + var passed = ( + actual == hours_47 || + actual == hours_48 || + actual == hours_49 + ); + + return { + pass: passed, + message: "Expected " + actual + " to be " + + hours_47 + ", " + hours_48 + ", or " + hours_49 + }; + } }; - - return ( - actual == hours_47 || - actual == hours_48 || - actual == hours_49 - ); } }); });