Fix node validation problem
Fixed an issue in the display of node validation information that cause a javascript runtime error. The fix is in two parts: (1) removed an empty sucess processing function in the ironic.service/validateNode function that caused the response to undefined to callers, and (2) I have found that table widget does not always update correctly when the data is an object. The base validation data is now provided as an array. Change-Id: I0e9c0e0c953d0fbd5d4732aa32975a30933e4a6f
This commit is contained in:
@@ -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
|
http://docs.openstack.org/developer/python-ironicclient/api/ironicclient.v1.node.html#ironicclient.v1.node.NodeManager.validate
|
||||||
"""
|
"""
|
||||||
node = ironicclient(request).node.validate(node_id)
|
ifaces = ironicclient(request).node.validate(node_id)
|
||||||
result = {}
|
result = []
|
||||||
for interface, status in node.__dict__.iteritems():
|
for interface, status in ifaces.to_dict().items():
|
||||||
if isinstance(status, dict) and 'result' in status:
|
data = {'interface': interface}
|
||||||
result[interface] = status
|
data.update(status)
|
||||||
|
result.append(data)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -355,17 +355,12 @@
|
|||||||
* http://docs.openstack.org/developer/ironic/webapi/v1.html#
|
* http://docs.openstack.org/developer/ironic/webapi/v1.html#
|
||||||
* validate--v1-nodes
|
* 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
|
* @return {promise} Promise
|
||||||
*/
|
*/
|
||||||
function validateNode(nodeIdent) {
|
function validateNode(nodeId) {
|
||||||
var data = {
|
return apiService.get('/api/ironic/nodes/' + nodeId + '/validate',
|
||||||
node: nodeIdent
|
{node: nodeId})
|
||||||
};
|
|
||||||
return apiService.get('/api/ironic/nodes/' + nodeIdent + '/validate',
|
|
||||||
data)
|
|
||||||
.then(function() {
|
|
||||||
})
|
|
||||||
.catch(function(response) {
|
.catch(function(response) {
|
||||||
var msg = interpolate(gettext('Unable to validate node %s: %s'),
|
var msg = interpolate(gettext('Unable to validate node %s: %s'),
|
||||||
[nodeId, response.data],
|
[nodeId, response.data],
|
||||||
|
|||||||
@@ -68,7 +68,7 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
ctrl.node = null;
|
ctrl.node = null;
|
||||||
ctrl.nodeValidation = {};
|
ctrl.nodeValidation = [];
|
||||||
ctrl.nodeStateTransitions = [];
|
ctrl.nodeStateTransitions = [];
|
||||||
ctrl.ports = [];
|
ctrl.ports = [];
|
||||||
ctrl.portsSrc = [];
|
ctrl.portsSrc = [];
|
||||||
@@ -127,7 +127,12 @@
|
|||||||
nodeStateTransitionService.getTransitions(ctrl.node.provision_state);
|
nodeStateTransitionService.getTransitions(ctrl.node.provision_state);
|
||||||
retrievePorts(uuid);
|
retrievePorts(uuid);
|
||||||
ironic.validateNode(uuid).then(function(response) {
|
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">
|
<hr class="header_rule">
|
||||||
|
|
||||||
<table hz-table ng-cloak
|
<table hz-table ng-cloak
|
||||||
st-table="ctrl.nodeValidation"
|
st-table="nodeValidation"
|
||||||
st-safe-src="ctrl.nodeValidationSrc"
|
st-safe-src="ctrl.nodeValidation"
|
||||||
class="table table-striped table-rsp table-detail">
|
class="table table-striped table-rsp table-detail">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -188,17 +188,17 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="(interface, status) in ctrl.nodeValidation">
|
<tr ng-repeat="item in nodeValidation">
|
||||||
<td class="rsp-p1">
|
<td class="rsp-p1">
|
||||||
{$ interface $}
|
{$ item.id $}
|
||||||
</td>
|
</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="true" class="fa fa-check text-success"></span>
|
||||||
<span ng-switch-when="false" class="fa fa-close text-danger"></span>
|
<span ng-switch-when="false" class="fa fa-close text-danger"></span>
|
||||||
<span ng-switch-default class="fa fa-minus"></span>
|
<span ng-switch-default class="fa fa-minus"></span>
|
||||||
</td>
|
</td>
|
||||||
<td class="rsp-p2">
|
<td class="rsp-p2">
|
||||||
{$ status.reason $}
|
{$ item.reason $}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user