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',
'$modalInstance',
'horizon.app.core.openstack-service-api.ironic',
'horizon.app.core.openstack-service-api.glance',
'horizon.dashboard.admin.ironic.enroll-node.service',
'$log'
];
@ -34,11 +35,13 @@
function EnrollNodeController($rootScope,
$modalInstance,
ironic,
glance,
enrollNodeService,
$log) {
var ctrl = this;
ctrl.drivers = null;
ctrl.images = null;
ctrl.loadingDriverProperties = false;
// Object containing the set of properties associated with the currently
// selected driver
@ -57,6 +60,7 @@
function init() {
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
*

View File

@ -5,9 +5,20 @@
<div class="modal-body">
<div class="tabbable"> <!-- Only required for left/right tabs -->
<ul class="nav nav-tabs">
<li class="required active"><a href="" 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>
<li class="required active">
<a href=""
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>
<!--enroll node form-->
@ -168,7 +179,9 @@
<span class="fa fa-question-circle"></span>
</span>
</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"
class="form-control"
id="{$ name $}"
@ -176,6 +189,24 @@
ng-model="property.inputValue"
placeholder="{$ property.getDescription() | translate $}"
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 ng-if="property.getSelectOptions()" class="">
<select id="{$ name $}"