From 43bbc14c58b242851399a7a4c84889504a0f47c1 Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Sat, 25 Jul 2020 02:23:44 +0300 Subject: [PATCH] feat(app/package): upgrade angularjs to 1.8 (#4073) * chore(yarn): upgrade angularjs * refactor(app): use $onInit instead of initComponent * feat(app/package): remove angular-cookies dependency Co-authored-by: Anthony Lapenna --- app/__module.js | 1 - .../networkMacvlanFormController.js | 5 +-- .../storidgeProfileSelectorController.js | 5 +-- .../porAccessControlFormController.js | 5 +-- .../porAccessControlPanelController.js | 5 +-- .../porEndpointSecurityController.js | 5 +-- package.json | 11 +++-- yarn.lock | 44 +++++++------------ 8 files changed, 32 insertions(+), 49 deletions(-) diff --git a/app/__module.js b/app/__module.js index fc3034f39..489ebe0a3 100644 --- a/app/__module.js +++ b/app/__module.js @@ -14,7 +14,6 @@ angular.module('portainer', [ 'ui.router', 'ui.select', 'isteven-multi-select', - 'ngCookies', 'ngSanitize', 'ngFileUpload', 'ngMessages', diff --git a/app/docker/components/network-macvlan-form/networkMacvlanFormController.js b/app/docker/components/network-macvlan-form/networkMacvlanFormController.js index e3873648a..959adca46 100644 --- a/app/docker/components/network-macvlan-form/networkMacvlanFormController.js +++ b/app/docker/components/network-macvlan-form/networkMacvlanFormController.js @@ -22,7 +22,8 @@ angular.module('portainer.docker').controller('NetworkMacvlanFormController', [ return !ctrl.data.SelectedNetworkConfig; }; - function initComponent() { + this.$onInit = $onInit; + function $onInit() { var isAdmin = Authentication.isAdmin(); ctrl.isAdmin = isAdmin; @@ -44,7 +45,5 @@ angular.module('portainer.docker').controller('NetworkMacvlanFormController', [ Notifications.error('Failure', err, 'Unable to retrieve informations for macvlan'); }); } - - initComponent(); }, ]); diff --git a/app/integrations/storidge/components/profileSelector/storidgeProfileSelectorController.js b/app/integrations/storidge/components/profileSelector/storidgeProfileSelectorController.js index ab47573b2..9c3d2beb6 100644 --- a/app/integrations/storidge/components/profileSelector/storidgeProfileSelectorController.js +++ b/app/integrations/storidge/components/profileSelector/storidgeProfileSelectorController.js @@ -4,7 +4,8 @@ angular.module('portainer.integrations.storidge').controller('StoridgeProfileSel function (StoridgeProfileService, Notifications) { var ctrl = this; - function initComponent() { + this.$onInit = $onInit; + function $onInit() { StoridgeProfileService.profiles() .then(function success(data) { ctrl.profiles = data; @@ -13,7 +14,5 @@ angular.module('portainer.integrations.storidge').controller('StoridgeProfileSel Notifications.error('Failure', err, 'Unable to retrieve Storidge profiles'); }); } - - initComponent(); }, ]); diff --git a/app/portainer/components/accessControlForm/porAccessControlFormController.js b/app/portainer/components/accessControlForm/porAccessControlFormController.js index e65e6f030..97b4b7ee8 100644 --- a/app/portainer/components/accessControlForm/porAccessControlFormController.js +++ b/app/portainer/components/accessControlForm/porAccessControlFormController.js @@ -44,7 +44,8 @@ angular.module('portainer.app').controller('porAccessControlFormController', [ }); } - function initComponent() { + this.$onInit = $onInit; + function $onInit() { var isAdmin = Authentication.isAdmin(); ctrl.isAdmin = isAdmin; @@ -79,7 +80,5 @@ angular.module('portainer.app').controller('porAccessControlFormController', [ Notifications.error('Failure', err, 'Unable to retrieve access control information'); }); } - - initComponent(); }, ]); diff --git a/app/portainer/components/accessControlPanel/porAccessControlPanelController.js b/app/portainer/components/accessControlPanel/porAccessControlPanelController.js index 8667482e5..ce846cb66 100644 --- a/app/portainer/components/accessControlPanel/porAccessControlPanelController.js +++ b/app/portainer/components/accessControlPanel/porAccessControlPanelController.js @@ -86,7 +86,8 @@ angular.module('portainer.app').controller('porAccessControlPanelController', [ }); } - function initComponent() { + this.$onInit = $onInit; + function $onInit() { var userDetails = Authentication.getUserDetails(); var isAdmin = Authentication.isAdmin(); var userId = userDetails.ID; @@ -138,7 +139,5 @@ angular.module('portainer.app').controller('porAccessControlPanelController', [ Notifications.error('Failure', err, 'Unable to retrieve access control information'); }); } - - initComponent(); }, ]); diff --git a/app/portainer/components/endpointSecurity/porEndpointSecurityController.js b/app/portainer/components/endpointSecurity/porEndpointSecurityController.js index 186d2bbe8..1b6bdc0f4 100644 --- a/app/portainer/components/endpointSecurity/porEndpointSecurityController.js +++ b/app/portainer/components/endpointSecurity/porEndpointSecurityController.js @@ -2,7 +2,8 @@ angular.module('portainer.app').controller('porEndpointSecurityController', [ function () { var ctrl = this; - function initComponent() { + this.$onInit = $onInit; + function $onInit() { if (ctrl.endpoint) { var endpoint = ctrl.endpoint; var TLS = endpoint.TLSConfig.TLS; @@ -27,7 +28,5 @@ angular.module('portainer.app').controller('porEndpointSecurityController', [ } } } - - initComponent(); }, ]); diff --git a/package.json b/package.json index 293fd6c14..077ecadc2 100644 --- a/package.json +++ b/package.json @@ -53,21 +53,20 @@ "@babel/polyfill": "^7.2.5", "@fortawesome/fontawesome-free": "^5.11.2", "@uirouter/angularjs": "1.0.11", - "angular": "~1.5.0", + "angular": "1.8.0", "angular-clipboard": "^1.6.2", - "angular-cookies": "~1.5.0", "angular-file-saver": "^1.1.3", "angular-google-analytics": "github:revolunet/angular-google-analytics#semver:~1.1.9", "angular-json-tree": "1.0.1", "angular-jwt": "~0.1.8", "angular-loading-bar": "~0.9.0", "angular-local-storage": "~0.5.2", - "angular-messages": "~1.5.0", - "angular-mocks": "~1.5.0", + "angular-messages": "1.8.0", + "angular-mocks": "1.8.0", "angular-moment-picker": "^0.10.2", "angular-multiselect": "github:portainer/angular-multi-select#semver:~v4.0.1", - "angular-resource": "~1.5.0", - "angular-sanitize": "~1.5.0", + "angular-resource": "1.8.0", + "angular-sanitize": "1.8.0", "angular-ui-bootstrap": "~2.5.0", "angular-utils-pagination": "~0.11.1", "angularjs-scroll-glue": "^2.2.0", diff --git a/yarn.lock b/yarn.lock index 77b495a16..c7cc60ff1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1197,11 +1197,6 @@ angular-clipboard@^1.6.2: resolved "https://registry.yarnpkg.com/angular-clipboard/-/angular-clipboard-1.7.0.tgz#9621a6ce66eab1ea9549aa8bfb3b71352307554f" integrity sha512-4/eg3zZw1MJpIsMc+mWzeVNyWBu8YWpXPTdmbgyPRp/6f0xB6I3XR2iC6Mb4mg/5E9q6exCd0sX2yiIsw+ZLJw== -angular-cookies@~1.5.0: - version "1.5.11" - resolved "https://registry.yarnpkg.com/angular-cookies/-/angular-cookies-1.5.11.tgz#88558de7c5044dcc3abeb79614d7ef8107ba49c0" - integrity sha1-iFWN58UETcw6vreWFNfvgQe6ScA= - angular-file-saver@^1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/angular-file-saver/-/angular-file-saver-1.1.3.tgz#dcaec0695214f226a4caafc8c16d21a9a61f7d1b" @@ -1236,20 +1231,20 @@ angular-local-storage@~0.5.2: resolved "https://registry.yarnpkg.com/angular-local-storage/-/angular-local-storage-0.5.2.tgz#7079beb0aa5ca91386d223125efefd13ca0ecd0c" integrity sha1-cHm+sKpcqROG0iMSXv79E8oOzQw= -angular-messages@~1.5.0: - version "1.5.11" - resolved "https://registry.yarnpkg.com/angular-messages/-/angular-messages-1.5.11.tgz#ea99f0163594fcb0a2db701b3038339250decc90" - integrity sha1-6pnwFjWU/LCi23AbMDgzklDezJA= +angular-messages@1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/angular-messages/-/angular-messages-1.8.0.tgz#dcdb8ea7d85a939526921e8cf05950601dc2b8fb" + integrity sha512-LSlyTv80y1vg8Cfdz+RJ0BrraWkq0qsOZHyrHFT8NyYWC5yp6HQabvZvTpKv9YA+6o05wwAU90qXHSrnUlSflA== angular-mocks@1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/angular-mocks/-/angular-mocks-1.6.1.tgz#2f44a1b3ac608e93751305bce176c274221d8abd" integrity sha1-L0Shs6xgjpN1EwW84XbCdCIdir0= -angular-mocks@~1.5.0: - version "1.5.11" - resolved "https://registry.yarnpkg.com/angular-mocks/-/angular-mocks-1.5.11.tgz#a0e1dd0ea55fd77ee7a757d75536c5e964c86f81" - integrity sha1-oOHdDqVf137np1fXVTbF6WTIb4E= +angular-mocks@1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/angular-mocks/-/angular-mocks-1.8.0.tgz#9d161fe2102e47e46ff78a4226e4dfec27c060c4" + integrity sha512-oFKJIqR6zcsW6V9UQMuUYCXIcTy+n7oYExXxZkvU57hwJQdU1nuNZcSMQA9URiEAPyo7v3bqm0eOP3Ezi7Bigg== angular-moment-picker@^0.10.2: version "0.10.2" @@ -1266,20 +1261,20 @@ angular-moment-picker@^0.10.2: angular-mocks "1.6.1" angular-sanitize "1.6.1" -angular-resource@~1.5.0: - version "1.5.11" - resolved "https://registry.yarnpkg.com/angular-resource/-/angular-resource-1.5.11.tgz#d93ea619184a2e0ee3ae338265758363172929f0" - integrity sha1-2T6mGRhKLg7jrjOCZXWDYxcpKfA= +angular-resource@1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/angular-resource/-/angular-resource-1.8.0.tgz#578ef122e7cb7bcc6c0ad6c2451dc3d27fd570ba" + integrity sha512-9woUq3kDwoT7R6SjKX8vaJMhOplYBm9sqRAxKgDhDIdPyA8iBowqQIusf9+8Q+z/HlXb8ZXvKspJyKXrxmKdvg== angular-sanitize@1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/angular-sanitize/-/angular-sanitize-1.6.1.tgz#cacffec3199ed66297afbb1ef366ec66616b3b3f" integrity sha1-ys/+wxme1mKXr7se82bsZmFrOz8= -angular-sanitize@~1.5.0: - version "1.5.11" - resolved "https://registry.yarnpkg.com/angular-sanitize/-/angular-sanitize-1.5.11.tgz#ebfb3f343e543f9b2ef050fb4c2e9ee048d1772f" - integrity sha1-6/s/ND5UP5su8FD7TC6e4EjRdy8= +angular-sanitize@1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/angular-sanitize/-/angular-sanitize-1.8.0.tgz#9f80782d3afeec3bcc0bb92b3ca6f1f421cfbca6" + integrity sha512-j5GiOPCvfcDWK5svEOVoPb11X3UDVy/mdHPRWuy14Iyw86xaq+Bb+x/em2sAOa5MQQeY5ciLXbF3RRp8iCKcNg== angular-ui-bootstrap@~2.5.0: version "2.5.6" @@ -1291,16 +1286,11 @@ angular-utils-pagination@~0.11.1: resolved "https://registry.yarnpkg.com/angular-utils-pagination/-/angular-utils-pagination-0.11.1.tgz#efad7c8879beb30ad3d77707f93e3d0ef51f2c66" integrity sha1-7618iHm+swrT13cH+T49DvUfLGY= -angular@1.x, angular@^1.3: +angular@1.8.0, angular@1.x, angular@^1.3: version "1.8.0" resolved "https://registry.yarnpkg.com/angular/-/angular-1.8.0.tgz#b1ec179887869215cab6dfd0df2e42caa65b1b51" integrity sha512-VdaMx+Qk0Skla7B5gw77a8hzlcOakwF8mjlW13DpIWIDlfqwAbSSLfd8N/qZnzEmQF4jC4iofInd3gE7vL8ZZg== -angular@~1.5.0: - version "1.5.11" - resolved "https://registry.yarnpkg.com/angular/-/angular-1.5.11.tgz#8c5ba7386f15965c9acf3429f6881553aada30d6" - integrity sha1-jFunOG8VllyazzQp9ogVU6raMNY= - angularjs-scroll-glue@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/angularjs-scroll-glue/-/angularjs-scroll-glue-2.2.0.tgz#07d3399ac16ca874c63b6b5ee2ee30558b37e5d1"