Merge "Fix node validation problem"
This commit is contained in:
commit
4b92714bc9
|
@ -180,11 +180,12 @@ def node_validate(request, node_id):
|
|||
|
||||
http://docs.openstack.org/developer/python-ironicclient/api/ironicclient.v1.node.html#ironicclient.v1.node.NodeManager.validate
|
||||
"""
|
||||
node = ironicclient(request).node.validate(node_id)
|
||||
result = {}
|
||||
for interface, status in node.__dict__.iteritems():
|
||||
if isinstance(status, dict) and 'result' in status:
|
||||
result[interface] = status
|
||||
ifaces = ironicclient(request).node.validate(node_id)
|
||||
result = []
|
||||
for interface, status in ifaces.to_dict().items():
|
||||
data = {'interface': interface}
|
||||
data.update(status)
|
||||
result.append(data)
|
||||
return result
|
||||
|
||||
|
||||
|
|
|
@ -355,17 +355,12 @@
|
|||
* http://docs.openstack.org/developer/ironic/webapi/v1.html#
|
||||
* validate--v1-nodes
|
||||
*
|
||||
* @param {string} nodeIdent – UUID or logical name of a node.
|
||||
* @param {string} nodeId – UUID or logical name of a node.
|
||||
* @return {promise} Promise
|
||||
*/
|
||||
function validateNode(nodeIdent) {
|
||||
var data = {
|
||||
node: nodeIdent
|
||||
};
|
||||
return apiService.get('/api/ironic/nodes/' + nodeIdent + '/validate',
|
||||
data)
|
||||
.then(function() {
|
||||
})
|
||||
function validateNode(nodeId) {
|
||||
return apiService.get('/api/ironic/nodes/' + nodeId + '/validate',
|
||||
{node: nodeId})
|
||||
.catch(function(response) {
|
||||
var msg = interpolate(gettext('Unable to validate node %s: %s'),
|
||||
[nodeId, response.data],
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
];
|
||||
|
||||
ctrl.node = null;
|
||||
ctrl.nodeValidation = {};
|
||||
ctrl.nodeValidation = [];
|
||||
ctrl.nodeStateTransitions = [];
|
||||
ctrl.ports = [];
|
||||
ctrl.portsSrc = [];
|
||||
|
@ -127,7 +127,12 @@
|
|||
nodeStateTransitionService.getTransitions(ctrl.node.provision_state);
|
||||
retrievePorts(uuid);
|
||||
ironic.validateNode(uuid).then(function(response) {
|
||||
ctrl.nodeValidation = response.data;
|
||||
var nodeValidation = [];
|
||||
angular.forEach(response.data, function(status) {
|
||||
status.id = status.interface;
|
||||
nodeValidation.push(status);
|
||||
});
|
||||
ctrl.nodeValidation = nodeValidation;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -171,8 +171,8 @@
|
|||
<hr class="header_rule">
|
||||
|
||||
<table hz-table ng-cloak
|
||||
st-table="ctrl.nodeValidation"
|
||||
st-safe-src="ctrl.nodeValidationSrc"
|
||||
st-table="nodeValidation"
|
||||
st-safe-src="ctrl.nodeValidation"
|
||||
class="table table-striped table-rsp table-detail">
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -188,17 +188,17 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="(interface, status) in ctrl.nodeValidation">
|
||||
<tr ng-repeat="item in nodeValidation">
|
||||
<td class="rsp-p1">
|
||||
{$ interface $}
|
||||
{$ item.id $}
|
||||
</td>
|
||||
<td class="rsp-p1" ng-switch="status.result">
|
||||
<td class="rsp-p1" ng-switch="item.result">
|
||||
<span ng-switch-when="true" class="fa fa-check text-success"></span>
|
||||
<span ng-switch-when="false" class="fa fa-close text-danger"></span>
|
||||
<span ng-switch-default class="fa fa-minus"></span>
|
||||
</td>
|
||||
<td class="rsp-p2">
|
||||
{$ status.reason $}
|
||||
{$ item.reason $}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
Loading…
Reference in New Issue