Files
weave-scope/client/app/scripts/components/node-details/node-details-control-button.js
David Kaltschmidt 96aae9bc99 Migrate from Flux to Redux
* better state visibility
* pure state changes
* state debug panel (show: crtl-h, move: ctrl-w)
2016-04-27 17:21:46 +02:00

29 lines
770 B
JavaScript

import React from 'react';
import { connect } from 'react-redux';
import { doControl } from '../../actions/app-actions';
class NodeDetailsControlButton extends React.Component {
constructor(props, context) {
super(props, context);
this.handleClick = this.handleClick.bind(this);
}
render() {
let className = `node-control-button fa ${this.props.control.icon}`;
if (this.props.pending) {
className += ' node-control-button-pending';
}
return (
<span className={className} title={this.props.control.human} onClick={this.handleClick} />
);
}
handleClick(ev) {
ev.preventDefault();
this.props.dispatch(doControl(this.props.nodeId, this.props.control));
}
}
export default connect()(NodeDetailsControlButton);