ironic-ui/ironic_ui/static/dashboard/admin/ironic/enroll-node/enroll-node.service.js
Peter Piela 50ebb92e4b Eliminate unnecessary event handling code
The following changes are part of a larger cleanup/refactoring
project.
- Eliminate the use of certain event handlers in the node-list
and node-details controllers, and replace with linear promise
chaining. I believe the use of promise chaining is more performant,
and reduces code complexity.
- Provide more descriptive names for several functions
- Add documentation for several functions

Change-Id: Iba184e4aaf79c7f7c99b3012175f1d8a1bfc79f0
2017-05-03 15:31:52 +00:00

52 lines
1.4 KiB
JavaScript

/*
* Copyright 2016 Cray Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function() {
'use strict';
angular
.module('horizon.dashboard.admin.ironic')
.factory('horizon.dashboard.admin.ironic.enroll-node.service',
enrollNodeService);
enrollNodeService.$inject = [
'$uibModal',
'horizon.dashboard.admin.ironic.basePath'
];
function enrollNodeService($uibModal, basePath) {
var service = {
enrollNode: enrollNode
};
/**
* @description Launch a modal dialog that will guide the user
* in enrolling a new node
*
* @return {promise} Object describing the enrolled node
*/
function enrollNode() {
var options = {
controller: 'EnrollNodeController as ctrl',
backdrop: 'static',
templateUrl: basePath + '/base-node/base-node.html'
};
return $uibModal.open(options).result;
}
return service;
}
})();