mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 02:00:43 +00:00
Added control status icon to Terminal header
This commit is contained in:
@@ -366,7 +366,8 @@ export function doControl(nodeId, control) {
|
||||
return (dispatch) => {
|
||||
dispatch({
|
||||
type: ActionTypes.DO_CONTROL,
|
||||
nodeId
|
||||
nodeId,
|
||||
control
|
||||
});
|
||||
doControlRequest(nodeId, control, dispatch);
|
||||
};
|
||||
@@ -590,7 +591,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()
|
||||
@@ -610,7 +611,8 @@ export function receiveControlPipe(pipeId, nodeId, rawTty, resizeTtyControl) {
|
||||
nodeId,
|
||||
pipeId,
|
||||
rawTty,
|
||||
resizeTtyControl
|
||||
resizeTtyControl,
|
||||
control
|
||||
});
|
||||
|
||||
updateRoute(getState);
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
@@ -382,12 +383,26 @@ class Terminal extends React.Component {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
getControlStatusIcon() {
|
||||
const icon = this.props.controlStatus && this.props.controlStatus.get('control').icon;
|
||||
return (
|
||||
<span
|
||||
style={{marginRight: '8px', width: '14px'}}
|
||||
className={classNames('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);
|
||||
|
||||
@@ -469,6 +469,7 @@ export function rootReducer(state = initialState, action) {
|
||||
nodeId: action.nodeId,
|
||||
raw: action.rawTty,
|
||||
resizeTtyControl: action.resizeTtyControl,
|
||||
control: action.control
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user