mirror of
https://github.com/weaveworks/scope.git
synced 2026-08-19 04:16:21 +00:00
Fixes pipes again
- Treat control objects that come back from the server as little black boxes. - Pass our local client nodeId around more instead, use that for comparisons etc, (vs. inspecting the control object and doing brittle magic w/ the ids).
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import debug from 'debug';
|
||||
|
||||
import AppDispatcher from '../dispatcher/app-dispatcher';
|
||||
import ActionTypes from '../constants/action-types';
|
||||
import { updateRoute } from '../utils/router-utils';
|
||||
@@ -5,6 +7,8 @@ import { doControlRequest, getNodesDelta, getNodeDetails,
|
||||
getTopologies, deletePipe } from '../utils/web-api-utils';
|
||||
import AppStore from '../stores/app-store';
|
||||
|
||||
const log = debug('scope:app-actions');
|
||||
|
||||
export function changeTopologyOption(option, value, topologyId) {
|
||||
AppDispatcher.dispatch({
|
||||
type: ActionTypes.CHANGE_TOPOLOGY_OPTION,
|
||||
|
||||
@@ -4,7 +4,7 @@ import { getNodeColor, getNodeColorDark } from '../utils/color-utils';
|
||||
import Terminal from './terminal';
|
||||
|
||||
export default function EmeddedTerminal({pipe, nodeId, nodes}) {
|
||||
const node = nodes.get(nodeId && nodeId.split(';').pop());
|
||||
const node = nodes.get(nodeId);
|
||||
const titleBarColor = node && getNodeColorDark(node.get('rank'), node.get('label_major'));
|
||||
const statusBarColor = node && getNodeColor(node.get('rank'), node.get('label_major'));
|
||||
const title = node && node.get('label_major');
|
||||
|
||||
@@ -166,7 +166,8 @@ export class AppStore extends Store {
|
||||
}
|
||||
|
||||
getControlPipe() {
|
||||
return controlPipes.last();
|
||||
const cp = controlPipes.last();
|
||||
return cp && cp.toJS();
|
||||
}
|
||||
|
||||
getCurrentTopology() {
|
||||
@@ -437,11 +438,11 @@ export class AppStore extends Store {
|
||||
break;
|
||||
|
||||
case ActionTypes.RECEIVE_CONTROL_PIPE:
|
||||
controlPipes = controlPipes.set(payload.pipeId, {
|
||||
controlPipes = controlPipes.set(payload.pipeId, makeOrderedMap({
|
||||
id: payload.pipeId,
|
||||
nodeId: payload.nodeId,
|
||||
raw: payload.rawTty
|
||||
});
|
||||
}));
|
||||
this.__emitChange();
|
||||
break;
|
||||
|
||||
@@ -549,9 +550,10 @@ export class AppStore extends Store {
|
||||
setDefaultTopologyOptions(topologies);
|
||||
selectedNodeId = payload.state.selectedNodeId;
|
||||
if (payload.state.controlPipe) {
|
||||
controlPipes = makeOrderedMap(
|
||||
[[payload.state.controlPipe.pipeId, payload.state.controlPipe]]
|
||||
);
|
||||
controlPipes = makeOrderedMap({
|
||||
[payload.state.controlPipe.pipeId]:
|
||||
makeOrderedMap(payload.state.controlPipe)
|
||||
});
|
||||
} else {
|
||||
controlPipes = controlPipes.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user