mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 18:20:27 +00:00
Revert "Current topo follows details panel!"
This reverts commit 7a5e04f44f46b3fc94dc0f67b68b4633659b88a9.
This commit is contained in:
@@ -286,7 +286,6 @@ export function clickRelative(nodeId, topologyId, label, origin) {
|
||||
topologyId
|
||||
});
|
||||
updateRoute(getState);
|
||||
resetUpdateBuffer();
|
||||
const state = getState();
|
||||
getNodeDetails(
|
||||
state.get('topologyUrlsById'),
|
||||
@@ -295,11 +294,6 @@ export function clickRelative(nodeId, topologyId, label, origin) {
|
||||
state.get('nodeDetails'),
|
||||
dispatch
|
||||
);
|
||||
getNodesDelta(
|
||||
getCurrentTopologyUrl(state),
|
||||
getActiveTopologyOptions(state),
|
||||
dispatch
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -467,7 +461,7 @@ export function hitEsc() {
|
||||
} else if (state.get('showingHelp')) {
|
||||
dispatch(hideHelp());
|
||||
} else if (state.get('nodeDetails').last() && !controlPipe) {
|
||||
dispatch({ type: ActionTypes.CLICK_CLOSE_DETAILS });
|
||||
dispatch({ type: ActionTypes.DESELECT_NODE });
|
||||
updateRoute(getState);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -69,7 +69,6 @@ export const initialState = makeMap({
|
||||
exportingGraph: false
|
||||
});
|
||||
|
||||
|
||||
// adds ID field to topology (based on last part of URL path) and save urls in
|
||||
// map for easy lookup
|
||||
function processTopologies(state, nextTopologies) {
|
||||
@@ -88,14 +87,12 @@ function processTopologies(state, nextTopologies) {
|
||||
return state.mergeDeepIn(['topologies'], immNextTopologies);
|
||||
}
|
||||
|
||||
|
||||
function setTopology(state, topologyId) {
|
||||
state = state.set('currentTopology', findTopologyById(
|
||||
state.get('topologies'), topologyId));
|
||||
return state.set('currentTopologyId', topologyId);
|
||||
}
|
||||
|
||||
|
||||
function setDefaultTopologyOptions(state, topologyList) {
|
||||
topologyList.forEach(topology => {
|
||||
let defaultOptions = makeOrderedMap();
|
||||
@@ -116,7 +113,6 @@ function setDefaultTopologyOptions(state, topologyList) {
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
function closeNodeDetails(state, nodeId) {
|
||||
const nodeDetails = state.get('nodeDetails');
|
||||
if (nodeDetails.size > 0) {
|
||||
@@ -132,7 +128,6 @@ function closeNodeDetails(state, nodeId) {
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
function closeAllNodeDetails(state) {
|
||||
while (state.get('nodeDetails').size) {
|
||||
state = closeNodeDetails(state);
|
||||
@@ -140,33 +135,10 @@ function closeAllNodeDetails(state) {
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
function resumeUpdate(state) {
|
||||
return state.set('updatePausedAt', null);
|
||||
}
|
||||
|
||||
|
||||
function setSelectedNode(state, {nodeId, label, origin, topologyId}) {
|
||||
state = resumeUpdate(state);
|
||||
if (state.hasIn(['nodeDetails', nodeId])) {
|
||||
// bring to front
|
||||
const details = state.getIn(['nodeDetails', nodeId]);
|
||||
state = state.deleteIn(['nodeDetails', nodeId]);
|
||||
state = state.setIn(['nodeDetails', nodeId], details);
|
||||
} else {
|
||||
state = state.setIn(['nodeDetails', nodeId], {id: nodeId, label, origin, topologyId});
|
||||
}
|
||||
state = state.set('selectedNodeId', nodeId);
|
||||
if (topologyId !== state.get('currentTopologyId')) {
|
||||
state = setTopology(state, topologyId);
|
||||
state = state.update('nodes', nodes => nodes.clear());
|
||||
state = state.set('availableCanvasMetrics', makeList());
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
|
||||
export function rootReducer(state = initialState, action) {
|
||||
if (!action.type) {
|
||||
error('Payload missing a type!', action);
|
||||
@@ -221,17 +193,7 @@ export function rootReducer(state = initialState, action) {
|
||||
}
|
||||
|
||||
case ActionTypes.CLICK_CLOSE_DETAILS: {
|
||||
state = closeNodeDetails(state, action.nodeId);
|
||||
const topCard = state.get('nodeDetails').last();
|
||||
if (!topCard) {
|
||||
return state;
|
||||
}
|
||||
|
||||
return setSelectedNode(state, {
|
||||
nodeId: topCard.id,
|
||||
label: topCard.label,
|
||||
topologyId: topCard.topologyId,
|
||||
});
|
||||
return closeNodeDetails(state, action.nodeId);
|
||||
}
|
||||
|
||||
case ActionTypes.CLICK_CLOSE_TERMINAL: {
|
||||
@@ -271,7 +233,22 @@ export function rootReducer(state = initialState, action) {
|
||||
}
|
||||
|
||||
case ActionTypes.CLICK_RELATIVE: {
|
||||
return setSelectedNode(state, action);
|
||||
if (state.hasIn(['nodeDetails', action.nodeId])) {
|
||||
// bring to front
|
||||
const details = state.getIn(['nodeDetails', action.nodeId]);
|
||||
state = state.deleteIn(['nodeDetails', action.nodeId]);
|
||||
state = state.setIn(['nodeDetails', action.nodeId], details);
|
||||
} else {
|
||||
state = state.setIn(['nodeDetails', action.nodeId],
|
||||
{
|
||||
id: action.nodeId,
|
||||
label: action.label,
|
||||
origin: action.origin,
|
||||
topologyId: action.topologyId
|
||||
}
|
||||
);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
case ActionTypes.CLICK_RESUME_UPDATE: {
|
||||
|
||||
Reference in New Issue
Block a user