From ed87e4f1170618a38de697bddbef5c1d8784003b Mon Sep 17 00:00:00 2001 From: Peter Piela Date: Fri, 27 Jan 2017 12:30:00 -0500 Subject: [PATCH] Improvements to enroll-node service - Rename the modal function to enrollNode which better desribes its role - The enrollNode function returns a promise that when successfully resolved will contain the newly enrolled node. This change can be used to support more efficient UI updates. Change-Id: Id8f46cf85b6a1adb65c87d3c10729aea123241e7 --- .../admin/ironic/enroll-node/enroll-node.controller.js | 9 +-------- .../admin/ironic/enroll-node/enroll-node.service.js | 6 +++--- .../admin/ironic/node-list/node-list.controller.js | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/ironic_ui/static/dashboard/admin/ironic/enroll-node/enroll-node.controller.js b/ironic_ui/static/dashboard/admin/ironic/enroll-node/enroll-node.controller.js index 577eec35..e3622e35 100644 --- a/ironic_ui/static/dashboard/admin/ironic/enroll-node/enroll-node.controller.js +++ b/ironic_ui/static/dashboard/admin/ironic/enroll-node/enroll-node.controller.js @@ -74,15 +74,8 @@ ironic.createNode(ctrl.node).then( function(response) { $log.info("create node response = " + JSON.stringify(response)); - $uibModalInstance.close(); $rootScope.$emit(ironicEvents.ENROLL_NODE_SUCCESS); - if (ctrl.moveNodeToManageableState) { - $log.info("Setting node provision state"); - ironic.setNodeProvisionState(response.data.uuid, 'manage'); - } - }, - function() { - // No additional error processing for now + $uibModalInstance.close(response.data); }); $log.debug("<< EnrollNodeController.submit()"); }; diff --git a/ironic_ui/static/dashboard/admin/ironic/enroll-node/enroll-node.service.js b/ironic_ui/static/dashboard/admin/ironic/enroll-node/enroll-node.service.js index 4e162e7d..9e953808 100644 --- a/ironic_ui/static/dashboard/admin/ironic/enroll-node/enroll-node.service.js +++ b/ironic_ui/static/dashboard/admin/ironic/enroll-node/enroll-node.service.js @@ -28,16 +28,16 @@ function enrollNodeService($uibModal, basePath) { var service = { - modal: modal + enrollNode: enrollNode }; - function modal() { + function enrollNode() { var options = { controller: 'EnrollNodeController as ctrl', backdrop: 'static', templateUrl: basePath + '/base-node/base-node.html' }; - return $uibModal.open(options); + return $uibModal.open(options).result; } return service; diff --git a/ironic_ui/static/dashboard/admin/ironic/node-list/node-list.controller.js b/ironic_ui/static/dashboard/admin/ironic/node-list/node-list.controller.js index a130cc98..3a031266 100755 --- a/ironic_ui/static/dashboard/admin/ironic/node-list/node-list.controller.js +++ b/ironic_ui/static/dashboard/admin/ironic/node-list/node-list.controller.js @@ -181,7 +181,7 @@ } function enrollNode() { - enrollNodeService.modal(); + enrollNodeService.enrollNode(); } function editNode(node) {