Merge "Minor state-machine fixes/updates"
This commit is contained in:
commit
4568ad8a3a
@ -143,8 +143,8 @@ class StatesProvision(generic.View):
|
||||
:param node_id: Node uuid
|
||||
:return: Return code
|
||||
"""
|
||||
state = request.DATA.get('state')
|
||||
return ironic.node_set_provision_state(request, node_uuid, state)
|
||||
verb = request.DATA.get('verb')
|
||||
return ironic.node_set_provision_state(request, node_uuid, verb)
|
||||
|
||||
|
||||
@urls.register
|
||||
|
@ -70,99 +70,113 @@
|
||||
</div>
|
||||
</div>
|
||||
<!--properties-->
|
||||
<div class="form-group">
|
||||
<label for="properties"
|
||||
<form id="AddPropertyForm"
|
||||
name="AddPropertyForm">
|
||||
<div class="form-group">
|
||||
<label for="properties"
|
||||
class="control-label"
|
||||
translate>Properties</label>
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-addon"
|
||||
style="width:25%;text-align:right"
|
||||
translate>
|
||||
Add New Property:</span>
|
||||
<input class="form-control"
|
||||
id="properties"
|
||||
type="text"
|
||||
ng-model="propertyName"
|
||||
validate-unique="ctrl.checkPropertyUnique"
|
||||
placeholder="{$ 'Property Name' | translate $}"/>
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary"
|
||||
type="button"
|
||||
ng-disabled="!propertyName || AddPropertyForm.$invalid"
|
||||
ng-click="ctrl.node.properties[propertyName] = null;
|
||||
propertyName = null">
|
||||
<span class="fa fa-plus"> </span>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<!--properties list-->
|
||||
<div class="form-group">
|
||||
<div class="input-group input-group-sm"
|
||||
ng-repeat="(propertyName, propertyValue) in ctrl.node.properties">
|
||||
<span class="input-group-addon"
|
||||
style="width:25%;text-align:right">
|
||||
{$ propertyName $}
|
||||
</span>
|
||||
<input class="form-control"
|
||||
type="text"
|
||||
name="{$ propertyName $}"
|
||||
ng-model="ctrl.node.properties[propertyName]"
|
||||
ng-required="true"/>
|
||||
<div class="input-group-btn">
|
||||
<a class="btn btn-default"
|
||||
ng-click="ctrl.deleteProperty(propertyName)">
|
||||
<span class="fa fa-minus"> </span>
|
||||
</a>
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-addon"
|
||||
style="width:25%;text-align:right"
|
||||
translate>
|
||||
Add New Property:</span>
|
||||
<input class="form-control"
|
||||
id="properties"
|
||||
type="text"
|
||||
ng-model="propertyName"
|
||||
validate-unique="ctrl.checkPropertyUnique"
|
||||
placeholder="{$ 'Property Name' | translate $}"/>
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary"
|
||||
type="button"
|
||||
ng-disabled="!propertyName || AddPropertyForm.$invalid"
|
||||
ng-click="ctrl.node.properties[propertyName] = null;
|
||||
propertyName = null">
|
||||
<span class="fa fa-plus"> </span>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!--properties list-->
|
||||
<form id="PropertiesForm"
|
||||
name="PropertiesForm">
|
||||
<div class="form-group">
|
||||
<div class="input-group input-group-sm"
|
||||
ng-repeat="(propertyName, propertyValue) in ctrl.node.properties">
|
||||
<span class="input-group-addon"
|
||||
style="width:25%;text-align:right">
|
||||
{$ propertyName $}
|
||||
</span>
|
||||
<input class="form-control"
|
||||
type="text"
|
||||
name="{$ propertyName $}"
|
||||
ng-model="ctrl.node.properties[propertyName]"
|
||||
ng-required="true"/>
|
||||
<div class="input-group-btn">
|
||||
<a class="btn btn-default"
|
||||
ng-click="ctrl.deleteProperty(propertyName)">
|
||||
<span class="fa fa-minus"> </span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!--extras-->
|
||||
<div class="form-group">
|
||||
<label for="extras"
|
||||
<form id="AddExtraForm"
|
||||
name="AddExtraForm">
|
||||
<div class="form-group">
|
||||
<label for="extras"
|
||||
class="control-label"
|
||||
translate>Extras</label>
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-addon"
|
||||
style="width:25%;text-align:right"
|
||||
translate>
|
||||
Add Extra:</span>
|
||||
<input class="form-control"
|
||||
id="extras"
|
||||
type="text"
|
||||
ng-model="extraName"
|
||||
validate-unique="ctrl.checkExtraUnique"
|
||||
placeholder="{$ 'Extra Property Name' | translate $}"/>
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary"
|
||||
type="button"
|
||||
ng-disabled="!extraName || AddExtraForm.$invalid"
|
||||
ng-click="ctrl.node.extra[extraName] = null;
|
||||
extraName = null">
|
||||
<span class="fa fa-plus"> </span>
|
||||
</button>
|
||||
</span>
|
||||
<div class="input-group input-group-sm">
|
||||
<span class="input-group-addon"
|
||||
style="width:25%;text-align:right"
|
||||
translate>
|
||||
Add Extra:</span>
|
||||
<input class="form-control"
|
||||
id="extras"
|
||||
type="text"
|
||||
ng-model="extraName"
|
||||
validate-unique="ctrl.checkExtraUnique"
|
||||
placeholder="{$ 'Extra Property Name' | translate $}"/>
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary"
|
||||
type="button"
|
||||
ng-disabled="!extraName || AddExtraForm.$invalid"
|
||||
ng-click="ctrl.node.extra[extraName] = null;
|
||||
extraName = null">
|
||||
<span class="fa fa-plus"> </span>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!--extras list-->
|
||||
<div class="input-group input-group-sm"
|
||||
ng-repeat="(propertyName, propertyValue) in ctrl.node.extra">
|
||||
<span class="input-group-addon"
|
||||
style="width:25%;text-align:right">
|
||||
{$ propertyName $}
|
||||
</span>
|
||||
<input class="form-control"
|
||||
type="text"
|
||||
name="{$ propertyName $}"
|
||||
ng-model="ctrl.node.extra[propertyName]"
|
||||
ng-required="true"/>
|
||||
<div class="input-group-btn">
|
||||
<a class="btn btn-default"
|
||||
ng-click="ctrl.deleteExtra(propertyName)">
|
||||
<span class="fa fa-minus"> </span>
|
||||
</a>
|
||||
<form id="ExtraForm"
|
||||
name="ExtraForm">
|
||||
<div class="form-group">
|
||||
<div class="input-group input-group-sm"
|
||||
ng-repeat="(propertyName, propertyValue) in ctrl.node.extra">
|
||||
<span class="input-group-addon"
|
||||
style="width:25%;text-align:right">
|
||||
{$ propertyName $}
|
||||
</span>
|
||||
<input class="form-control"
|
||||
type="text"
|
||||
name="{$ propertyName $}"
|
||||
ng-model="ctrl.node.extra[propertyName]"
|
||||
ng-required="true"/>
|
||||
<div class="input-group-btn">
|
||||
<a class="btn btn-default"
|
||||
ng-click="ctrl.deleteExtra(propertyName)">
|
||||
<span class="fa fa-minus"> </span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!--end node info tab-->
|
||||
|
||||
@ -268,7 +282,10 @@
|
||||
|
||||
<button type="submit"
|
||||
ng-disabled="!ctrl.driverProperties ||
|
||||
enrollNodeForm.$invalid"
|
||||
enrollNodeForm.$invalid ||
|
||||
PropertiesForm.$invalid ||
|
||||
ExtraForm.$invalid ||
|
||||
InstanceInfoForm.$invalid"
|
||||
ng-click="ctrl.enroll()"
|
||||
class="btn btn-primary"
|
||||
translate>
|
||||
|
@ -243,19 +243,20 @@
|
||||
* put--v1-nodes-(node_ident)-states-provision
|
||||
*
|
||||
* @param {string} uuid – UUID of a node.
|
||||
* @param {string} state – Target provision state
|
||||
* @param {string} verb – Provisioning verb used to move node to desired
|
||||
* target state
|
||||
* @return {promise} Promise
|
||||
*/
|
||||
function setNodeProvisionState(uuid, state) {
|
||||
function setNodeProvisionState(uuid, verb) {
|
||||
var data = {
|
||||
state: state
|
||||
verb: verb
|
||||
};
|
||||
return apiService.put('/api/ironic/nodes/' + uuid + '/states/provision',
|
||||
data)
|
||||
.success(function() {
|
||||
toastService.add(
|
||||
'success',
|
||||
gettext('Successfully set target node provision state'));
|
||||
var msg = gettext(
|
||||
'A request has been made to change the provisioning state of node %s');
|
||||
toastService.add('success', interpolate(msg, [uuid], false));
|
||||
})
|
||||
.error(function(reason) {
|
||||
var msg = gettext('Unable to set node provision state: %s');
|
||||
|
@ -24,6 +24,7 @@
|
||||
IronicNodeListController.$inject = [
|
||||
'$scope',
|
||||
'$rootScope',
|
||||
'$q',
|
||||
'horizon.framework.widgets.toast.service',
|
||||
'horizon.app.core.openstack-service-api.ironic',
|
||||
'horizon.dashboard.admin.ironic.events',
|
||||
@ -35,6 +36,7 @@
|
||||
|
||||
function IronicNodeListController($scope,
|
||||
$rootScope,
|
||||
$q,
|
||||
toastService,
|
||||
ironic,
|
||||
ironicEvents,
|
||||
@ -135,9 +137,10 @@
|
||||
}
|
||||
|
||||
function onGetNodes(response) {
|
||||
var promises = [];
|
||||
angular.forEach(response.data.items, function (node) {
|
||||
node.id = node.uuid;
|
||||
retrievePorts(node);
|
||||
promises.push(retrievePorts(node));
|
||||
|
||||
// Report any changes in last-error
|
||||
if (node.last_error !== "" &&
|
||||
@ -147,11 +150,13 @@
|
||||
"Node " + node.name + ". " + node.last_error);
|
||||
}
|
||||
});
|
||||
ctrl.nodesSrc = response.data.items;
|
||||
$q.all(promises).then(function() {
|
||||
ctrl.nodesSrc = response.data.items;
|
||||
});
|
||||
}
|
||||
|
||||
function retrievePorts(node) {
|
||||
ironic.getPortsWithNode(node.uuid).then(
|
||||
return ironic.getPortsWithNode(node.uuid).then(
|
||||
function (response) {
|
||||
node.ports = response.data.items;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user