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-->
@ -153,43 +164,63 @@
<small><em><i class="fa fa-spin fa-refresh"></i></em></small> <small><em><i class="fa fa-spin fa-refresh"></i></em></small>
</p> </p>
<div class="form-group" <div class="form-group"
ng-repeat="(name, property) in ctrl.driverProperties" ng-repeat="(name, property) in ctrl.driverProperties"
ng-show="property.isActive()"> ng-show="property.isActive()">
<label for="{$ name $}" <label for="{$ name $}"
class="control-label" class="control-label"
style="white-space: nowrap" style="white-space: nowrap"
translate> translate>
{$ name $} {$ name $}
<span class="help-icon" <span class="help-icon"
data-container="body" data-container="body"
title="" title=""
data-toggle="tooltip" data-toggle="tooltip"
data-original-title="{$ property.getDescription() | translate $}"> data-original-title="{$ property.getDescription() | translate $}">
<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()"
<input type="text" ng-class="name === 'deploy_kernel' ||
class="form-control" name === 'deploy_ramdisk' ? 'input-group' : ''">
id="{$ name $}" <input type="text"
name="{$ name $}" class="form-control"
ng-model="property.inputValue" id="{$ name $}"
placeholder="{$ property.getDescription() | translate $}" name="{$ name $}"
ng-required="property.isRequired()"/> ng-model="property.inputValue"
</div> placeholder="{$ property.getDescription() | translate $}"
<div ng-if="property.getSelectOptions()" class=""> ng-required="property.isRequired()"/>
<select id="{$ name $}" <div ng-if="name === 'deploy_kernel' ||
class="form-control" name === 'deploy_ramdisk'"
ng-options="opt for opt in property.getSelectOptions()" class="input-group-btn">
ng-model="property.inputValue" <button type="button"
ng-required="property.isRequired()"> class="btn btn-primary dropdown-toggle"
<option value="" data-toggle="dropdown"
disabled translate>
selected Choose an Image
translate>{$ property.getDescription() $}</option> </button>
</select> <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>
<div ng-if="property.getSelectOptions()" class="">
<select id="{$ name $}"
class="form-control"
ng-options="opt for opt in property.getSelectOptions()"
ng-model="property.inputValue"
ng-required="property.isRequired()">
<option value=""
disabled
selected
translate>{$ property.getDescription() $}</option>
</select>
</div>
</div>
</div> </div>
<!--end driver details tab--> <!--end driver details tab-->
</div> </div>