Skip to content

Commit

Permalink
Added control status icon to Terminal header
Browse files Browse the repository at this point in the history
  • Loading branch information
jpellizzari committed Dec 12, 2016
1 parent 70960cc commit a27319c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion client/app/scripts/actions/app-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,8 @@ export function doControl(nodeId, control) {
return (dispatch) => {
dispatch({
type: ActionTypes.DO_CONTROL,
nodeId
nodeId,
control
});
doControlRequest(nodeId, control, dispatch);
};
Expand Down
21 changes: 19 additions & 2 deletions client/app/scripts/components/terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ class Terminal extends React.Component {
<span title="Close" className="terminal-header-tools-item-icon fa fa-close"
onClick={this.handleCloseClick} />
</div>
{this.getControlStatusIcon()}
<span className="terminal-header-title">{this.getTitle()}</span>
</div>
);
Expand Down Expand Up @@ -382,12 +383,28 @@ class Terminal extends React.Component {
</div>
);
}
getControlStatusIcon() {
const icon = this.props.controlStatus && this.props.controlStatus.get('raw')
? 'terminal'
: 'desktop';
return (
<span
style={{marginRight: '8px', width: '14px'}}
className={classNames('fa', {[`fa-${icon}`]: icon})}
/>
);
}
}

function mapStateToProps(state, ownProps) {
const controlStatus = state.get('controlPipes').find((pipe) =>
pipe.get('nodeId') === ownProps.pipe.get('nodeId')
);
return { controlStatus };
}

Terminal.defaultProps = {
connect: true
};


export default connect()(Terminal);
export default connect(mapStateToProps)(Terminal);

0 comments on commit a27319c

Please sign in to comment.