Merge "Add manage nodes button to nodes list page"

This commit is contained in:
Jenkins 2017-07-17 19:28:27 +00:00 committed by Gerrit Code Review
commit 15e261a1ae
6 changed files with 94 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixes `bug 1639262 <https://launchpad.net/bugs/1639262>`__
Add manage nodes button to nodes list page

View File

@ -335,6 +335,73 @@ export default {
};
},
startManageNodes(nodeIds) {
return (dispatch, getState) => {
dispatch(this.startOperation(nodeIds));
dispatch(this.pollNodeslistDuringProgress());
MistralApiService.runWorkflow(MistralConstants.BAREMETAL_MANAGE, {
node_uuids: nodeIds
})
.then(response => {
if (response.state === 'ERROR') {
dispatch(
NotificationActions.notify({
title: 'Error',
message: response.state_info
})
);
dispatch(this.finishOperation(nodeIds));
}
})
.catch(error => {
logger.error(
'Error in NodesActions.startManageNodes',
error.stack || error
);
let errorHandler = new MistralApiErrorHandler(error);
errorHandler.errors.forEach(error => {
dispatch(NotificationActions.notify(error));
});
dispatch(this.finishOperation(nodeIds));
});
};
},
manageNodesFinished(messagePayload) {
return (dispatch, getState) => {
const nodeIds = messagePayload.execution.input.node_uuids;
dispatch(this.finishOperation(nodeIds));
dispatch(this.fetchNodes());
switch (messagePayload.status) {
case 'SUCCESS': {
dispatch(
NotificationActions.notify({
type: 'success',
title: 'Nodes are manageable',
message: messagePayload.message
})
);
break;
}
case 'FAILED': {
messagePayload.message.map(message => {
dispatch(
NotificationActions.notify({
type: 'error',
title: 'Error',
message: message.result
})
);
});
break;
}
default:
break;
}
};
},
updateNode(nodePatch) {
return (dispatch, getState) => {
dispatch(this.updateNodePending(nodePatch.uuid));

View File

@ -46,6 +46,10 @@ export default {
dispatch(NodesActions.provideNodesFinished(payload));
break;
case MistralConstants.BAREMETAL_MANAGE:
dispatch(NodesActions.manageNodesFinished(payload));
break;
case MistralConstants.VALIDATIONS_RUN: {
dispatch(ValidationsActions.runValidationMessage(payload));
break;

View File

@ -56,6 +56,9 @@ class NodesListForm extends React.Component {
case 'provide':
this.props.provideNodes(nodeIds);
break;
case 'manage':
this.props.manageNodes(nodeIds);
break;
case 'tag':
this.props.tagNodes(nodeIds, formData.tag);
break;
@ -86,6 +89,7 @@ NodesListForm.propTypes = {
handleSubmit: PropTypes.func.isRequired,
intl: PropTypes.object,
introspectNodes: PropTypes.func.isRequired,
manageNodes: PropTypes.func.isRequired,
nodes: ImmutablePropTypes.map.isRequired,
provideNodes: PropTypes.func.isRequired,
reset: PropTypes.func.isRequired,
@ -121,6 +125,7 @@ const mapDispatchToProps = dispatch => ({
deleteNodes: nodeIds => dispatch(NodesActions.deleteNodes(nodeIds)),
introspectNodes: nodeIds =>
dispatch(NodesActions.startNodesIntrospection(nodeIds)),
manageNodes: nodeIds => dispatch(NodesActions.startManageNodes(nodeIds)),
provideNodes: nodeIds => dispatch(NodesActions.startProvideNodes(nodeIds)),
tagNodes: (nodeIds, tag) => dispatch(NodesActions.tagNodes(nodeIds, tag))
});

View File

@ -39,6 +39,12 @@ const messages = defineMessages({
description: '"Providing" the nodes changes the provisioning state to "available" so that ' +
'they can be used in a deployment.'
},
manageNodes: {
id: 'NodesToolbarActions.manageNodes',
defaultMessage: 'Manage Nodes',
description: '"Managing" the nodes changes the provisioning state to "manageable" so that ' +
'they can be introspected.'
},
deleteNodes: {
id: 'NodesToolbarActions.deleteNodes',
defaultMessage: 'Delete Nodes'
@ -97,6 +103,12 @@ class NodesToolbarActions extends React.Component {
<FormattedMessage {...messages.provideNodes} />
</Button>
<DropdownKebab id="nodesActionsKebab" pullRight>
<MenuItem
disabled={this.props.disabled}
onClick={this.submitForm.bind(this, 'manage')}
>
<FormattedMessage {...messages.manageNodes} />
</MenuItem>
<MenuItem
disabled={this.props.disabled}
onClick={() => this.setState({ showTagNodesModal: true })}

View File

@ -16,6 +16,7 @@
export default {
BAREMETAL_INTROSPECT: 'tripleo.baremetal.v1.introspect',
BAREMETAL_MANAGE: 'tripleo.baremetal.v1.manage',
BAREMETAL_PROVIDE: 'tripleo.baremetal.v1.provide',
BAREMETAL_REGISTER_OR_UPDATE: 'tripleo.baremetal.v1.register_or_update',
CAPABILITIES_GET: 'tripleo.heat_capabilities.get',