LP#1739803 Angular 1.6 + dependency updates
authorBill Erickson <berickxx@gmail.com>
Fri, 2 Jun 2017 21:01:32 +0000 (17:01 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Wed, 21 Feb 2018 19:42:07 +0000 (14:42 -0500)
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 <berickxx@gmail.com>
Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/web/js/ui/default/staff/Gruntfile.js
Open-ILS/web/js/ui/default/staff/package.json
Open-ILS/web/js/ui/default/staff/services/hatch.js
Open-ILS/web/js/ui/default/staff/services/print.js
Open-ILS/web/js/ui/default/staff/test/unit/egDate.js

index 13ae1da..b6f8e4b 100644 (file)
@@ -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
index 7ee67d9..26a48a1 100644 (file)
@@ -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"
   }
 }
index 0a27b15..e8107ea 100644 (file)
@@ -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;
index d6ddf59..fee4c8a 100644 (file)
@@ -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;
index 5802e2d..680def5 100644 (file)
@@ -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
-                );
             }
         });
     });