Merge "Provide capability to select deploy images"

This commit is contained in:
Jenkins 2016-06-08 15:16:51 +00:00 committed by Gerrit Code Review
commit f4639de8a5
2 changed files with 84 additions and 38 deletions

View File

@ -27,6 +27,7 @@
'$rootScope', '$rootScope',
'$modalInstance', '$modalInstance',
'horizon.app.core.openstack-service-api.ironic', 'horizon.app.core.openstack-service-api.ironic',
'horizon.app.core.openstack-service-api.glance',
'horizon.dashboard.admin.ironic.enroll-node.service', 'horizon.dashboard.admin.ironic.enroll-node.service',
'$log' '$log'
]; ];
@ -34,11 +35,13 @@
function EnrollNodeController($rootScope, function EnrollNodeController($rootScope,
$modalInstance, $modalInstance,
ironic, ironic,
glance,
enrollNodeService, enrollNodeService,
$log) { $log) {
var ctrl = this; var ctrl = this;
ctrl.drivers = null; ctrl.drivers = null;
ctrl.images = null;
ctrl.loadingDriverProperties = false; ctrl.loadingDriverProperties = false;
// Object containing the set of properties associated with the currently // Object containing the set of properties associated with the currently
// selected driver // selected driver
@ -57,6 +60,7 @@
function init() { function init() {
loadDrivers(); loadDrivers();
getImages();
} }
/** /**
@ -70,6 +74,17 @@
}); });
} }
/**
* Get the list of images from Glance
*
* @return {void}
*/
function getImages() {
glance.getImages().then(function(response) {
ctrl.images = response.data.items;
});
}
/** /**
* Get the properties associated with a specified driver * Get the properties associated with a specified driver
* *

View File

@ -5,9 +5,20 @@
<div class="modal-body"> <div class="modal-body">
<div class="tabbable"> <!-- Only required for left/right tabs --> <div class="tabbable"> <!-- Only required for left/right tabs -->
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="required active"><a href="" data-target="#nodeInfo" data-toggle="tab" translate>Node Info</a></li> <li class="required active">
<li ng-if="!ctrl.driverProperties" class="disabled"><a data-target="#driverDetails" translate>Driver Details</a></li> <a href=""
<li ng-if="ctrl.driverProperties"><a href="" data-target="#driverDetails" data-toggle="tab" translate>Driver Details</a></li> data-target="#nodeInfo"
data-toggle="tab"
translate>Node Info</a></li>
<li ng-if="!ctrl.driverProperties"
class="disabled">
<a data-target="#driverDetails"
translate>Driver Details</a></li>
<li ng-if="ctrl.driverProperties">
<a href=""
data-target="#driverDetails"
data-toggle="tab"
translate>Driver Details</a></li>
</ul> </ul>
<!--enroll node form--> <!--enroll node form-->
@ -168,7 +179,9 @@
<span class="fa fa-question-circle"></span> <span class="fa fa-question-circle"></span>
</span> </span>
</label> </label>
<div ng-if="!property.getSelectOptions()" class=""> <div ng-if="!property.getSelectOptions()"
ng-class="name === 'deploy_kernel' ||
name === 'deploy_ramdisk' ? 'input-group' : ''">
<input type="text" <input type="text"
class="form-control" class="form-control"
id="{$ name $}" id="{$ name $}"
@ -176,6 +189,24 @@
ng-model="property.inputValue" ng-model="property.inputValue"
placeholder="{$ property.getDescription() | translate $}" placeholder="{$ property.getDescription() | translate $}"
ng-required="property.isRequired()"/> ng-required="property.isRequired()"/>
<div ng-if="name === 'deploy_kernel' ||
name === 'deploy_ramdisk'"
class="input-group-btn">
<button type="button"
class="btn btn-primary dropdown-toggle"
data-toggle="dropdown"
translate>
Choose an Image
</button>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item"
ng-repeat="imageObj in ctrl.images"
href="#"
ng-click="property.inputValue = imageObj.id">{$ imageObj.name + ' [' + imageObj.id + ']' $}</a>
</li>
</ul>
</div>
</div> </div>
<div ng-if="property.getSelectOptions()" class=""> <div ng-if="property.getSelectOptions()" class="">
<select id="{$ name $}" <select id="{$ name $}"