From cb3eb2e16b8bc8fa51bba532b1cb962771c72d74 Mon Sep 17 00:00:00 2001 From: Kenji Ishii Date: Fri, 2 Dec 2016 10:57:16 +0900 Subject: [PATCH] Use initAction() instead initScope() initScope() for actions is deprecated in Ocata.[1] This patch use initAction() instead initScope(). New scope is now provided as the second argument of perform(). [1]:https://review.openstack.org/#/c/345145/ Change-Id: Ie96f24fe7a892da29e4e2d80cfb100d2f3105c49 --- .../container/containers/create/create.service.js | 15 ++++++--------- .../container/containers/delete/delete.service.js | 10 ++++------ .../containers/operations/pause.service.js | 4 ++-- .../containers/operations/reboot.service.js | 4 ++-- .../containers/operations/start.service.js | 4 ++-- .../containers/operations/stop.service.js | 4 ++-- .../containers/operations/unpause.service.js | 4 ++-- 7 files changed, 20 insertions(+), 25 deletions(-) diff --git a/zun_ui/static/dashboard/container/containers/create/create.service.js b/zun_ui/static/dashboard/container/containers/create/create.service.js index b3e421f..10e4306 100644 --- a/zun_ui/static/dashboard/container/containers/create/create.service.js +++ b/zun_ui/static/dashboard/container/containers/create/create.service.js @@ -41,14 +41,13 @@ function createService( $location, policy, actionResult, gettext, $qExtensions, wizardModalService, toast, model, events, resourceType, createWorkflow ) { - var scope; var message = { success: gettext('Container %s was successfully created.') }; var service = { - initScope: initScope, + initAction: initAction, perform: perform, allowed: allowed }; @@ -57,15 +56,13 @@ ////////////// - function initScope($scope) { - scope = $scope; - scope.workflow = createWorkflow; - scope.model = model; - scope.$on('$destroy', function() { - }); + function initAction() { } - function perform(selected) { + function perform(selected, newScope) { + scope = newScope; + scope.workflow = createWorkflow; + scope.model = model; scope.model.init(); // for creation according to selected item scope.selected = selected; diff --git a/zun_ui/static/dashboard/container/containers/delete/delete.service.js b/zun_ui/static/dashboard/container/containers/delete/delete.service.js index b53640b..3782b8f 100644 --- a/zun_ui/static/dashboard/container/containers/delete/delete.service.js +++ b/zun_ui/static/dashboard/container/containers/delete/delete.service.js @@ -51,7 +51,7 @@ successEvent: events.DELETE_SUCCESS }; var service = { - initScope: initScope, + initAction: initAction, allowed: allowed, perform: perform }; @@ -61,10 +61,7 @@ ////////////// - // include this function in your service - // if you plan to emit events to the parent controller - function initScope($scope) { - scope = $scope; + function initAction() { } function allowed() { @@ -72,7 +69,8 @@ } // delete selected resource objects - function perform(selected) { + function perform(selected, newScope) { + scope = newScope; var selected = angular.isArray(selected) ? selected : [selected]; context.labels = labelize(selected.length); return $qExtensions.allSettled(selected.map(checkPermission)).then(afterCheck); diff --git a/zun_ui/static/dashboard/container/containers/operations/pause.service.js b/zun_ui/static/dashboard/container/containers/operations/pause.service.js index 637c597..5d2e8a4 100644 --- a/zun_ui/static/dashboard/container/containers/operations/pause.service.js +++ b/zun_ui/static/dashboard/container/containers/operations/pause.service.js @@ -39,7 +39,7 @@ }; var service = { - initScope: initScope, + initAction: initAction, allowed: allowed, perform: perform }; @@ -50,7 +50,7 @@ // include this function in your service // if you plan to emit events to the parent controller - function initScope() { + function initAction() { } function allowed() { diff --git a/zun_ui/static/dashboard/container/containers/operations/reboot.service.js b/zun_ui/static/dashboard/container/containers/operations/reboot.service.js index e9ea40d..8b7749f 100644 --- a/zun_ui/static/dashboard/container/containers/operations/reboot.service.js +++ b/zun_ui/static/dashboard/container/containers/operations/reboot.service.js @@ -40,7 +40,7 @@ }; var service = { - initScope: initScope, + initAction: initAction, allowed: allowed, perform: perform }; @@ -51,7 +51,7 @@ // include this function in your service // if you plan to emit events to the parent controller - function initScope() { + function initAction() { } function allowed() { diff --git a/zun_ui/static/dashboard/container/containers/operations/start.service.js b/zun_ui/static/dashboard/container/containers/operations/start.service.js index 6e2f6da..d80d864 100644 --- a/zun_ui/static/dashboard/container/containers/operations/start.service.js +++ b/zun_ui/static/dashboard/container/containers/operations/start.service.js @@ -40,7 +40,7 @@ }; var service = { - initScope: initScope, + initAction: initAction, allowed: allowed, perform: perform }; @@ -51,7 +51,7 @@ // include this function in your service // if you plan to emit events to the parent controller - function initScope() { + function initAction() { } function allowed() { diff --git a/zun_ui/static/dashboard/container/containers/operations/stop.service.js b/zun_ui/static/dashboard/container/containers/operations/stop.service.js index 11683b0..d7faac1 100644 --- a/zun_ui/static/dashboard/container/containers/operations/stop.service.js +++ b/zun_ui/static/dashboard/container/containers/operations/stop.service.js @@ -40,7 +40,7 @@ }; var service = { - initScope: initScope, + initAction: initAction, allowed: allowed, perform: perform }; @@ -51,7 +51,7 @@ // include this function in your service // if you plan to emit events to the parent controller - function initScope() { + function initAction() { } function allowed() { diff --git a/zun_ui/static/dashboard/container/containers/operations/unpause.service.js b/zun_ui/static/dashboard/container/containers/operations/unpause.service.js index 42cff41..b86d2e7 100644 --- a/zun_ui/static/dashboard/container/containers/operations/unpause.service.js +++ b/zun_ui/static/dashboard/container/containers/operations/unpause.service.js @@ -40,7 +40,7 @@ }; var service = { - initScope: initScope, + initAction: initAction, allowed: allowed, perform: perform }; @@ -51,7 +51,7 @@ // include this function in your service // if you plan to emit events to the parent controller - function initScope() { + function initAction() { } function allowed() {