diff --git a/client/app/scripts/actions/app-actions.js b/client/app/scripts/actions/app-actions.js index 893d55c5a..daa825787 100644 --- a/client/app/scripts/actions/app-actions.js +++ b/client/app/scripts/actions/app-actions.js @@ -367,7 +367,8 @@ export function doControl(nodeId, control) { return (dispatch) => { dispatch({ type: ActionTypes.DO_CONTROL, - nodeId + nodeId, + control }); doControlRequest(nodeId, control, dispatch); }; @@ -591,7 +592,7 @@ export function receiveControlPipeFromParams(pipeId, rawTty, resizeTtyControl) { }; } -export function receiveControlPipe(pipeId, nodeId, rawTty, resizeTtyControl) { +export function receiveControlPipe(pipeId, nodeId, rawTty, resizeTtyControl, control) { return (dispatch, getState) => { const state = getState(); if (state.get('nodeDetails').last() @@ -611,7 +612,8 @@ export function receiveControlPipe(pipeId, nodeId, rawTty, resizeTtyControl) { nodeId, pipeId, rawTty, - resizeTtyControl + resizeTtyControl, + control }); updateRoute(getState); diff --git a/client/app/scripts/components/terminal.js b/client/app/scripts/components/terminal.js index 6cd28052e..087131b7a 100644 --- a/client/app/scripts/components/terminal.js +++ b/client/app/scripts/components/terminal.js @@ -315,6 +315,7 @@ class Terminal extends React.Component { title="Close" className="terminal-header-tools-item-icon fa fa-close" onClick={this.handleCloseClick} /> + {this.getControlStatusIcon()} {this.getTitle()} ); @@ -386,12 +387,26 @@ class Terminal extends React.Component { ); } + getControlStatusIcon() { + const icon = this.props.controlStatus && this.props.controlStatus.get('control').icon; + 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); diff --git a/client/app/scripts/reducers/root.js b/client/app/scripts/reducers/root.js index 051f7b886..235f578ff 100644 --- a/client/app/scripts/reducers/root.js +++ b/client/app/scripts/reducers/root.js @@ -469,6 +469,7 @@ export function rootReducer(state = initialState, action) { nodeId: action.nodeId, raw: action.rawTty, resizeTtyControl: action.resizeTtyControl, + control: action.control })); } diff --git a/client/app/scripts/utils/web-api-utils.js b/client/app/scripts/utils/web-api-utils.js index 76bdad377..3f1899c33 100644 --- a/client/app/scripts/utils/web-api-utils.js +++ b/client/app/scripts/utils/web-api-utils.js @@ -238,7 +238,9 @@ export function doControlRequest(nodeId, control, dispatch) { res.pipe, nodeId, res.raw_tty, - resizeTtyControl)); + resizeTtyControl, + control + )); } if (res.removedNode) { dispatch(receiveControlNodeRemoved(nodeId));