From a27319cf6e50fa9914ae5dbe343fa4319727787e Mon Sep 17 00:00:00 2001 From: jpellizzari Date: Mon, 14 Nov 2016 16:37:01 +0000 Subject: [PATCH] Added control status icon to Terminal header --- client/app/scripts/actions/app-actions.js | 3 ++- client/app/scripts/components/terminal.js | 21 +++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/client/app/scripts/actions/app-actions.js b/client/app/scripts/actions/app-actions.js index d248c33873..672452ba32 100644 --- a/client/app/scripts/actions/app-actions.js +++ b/client/app/scripts/actions/app-actions.js @@ -366,7 +366,8 @@ export function doControl(nodeId, control) { return (dispatch) => { dispatch({ type: ActionTypes.DO_CONTROL, - nodeId + nodeId, + control }); doControlRequest(nodeId, control, dispatch); }; diff --git a/client/app/scripts/components/terminal.js b/client/app/scripts/components/terminal.js index af2ce51da2..599237deea 100644 --- a/client/app/scripts/components/terminal.js +++ b/client/app/scripts/components/terminal.js @@ -316,6 +316,7 @@ class Terminal extends React.Component { + {this.getControlStatusIcon()} {this.getTitle()} ); @@ -382,12 +383,28 @@ class Terminal extends React.Component { ); } + getControlStatusIcon() { + const icon = this.props.controlStatus && this.props.controlStatus.get('raw') + ? 'terminal' + : 'desktop'; + return ( + + ); + } } +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);