From a2810afaf1ca8ec324b13745e6db0cea2fbdac4f Mon Sep 17 00:00:00 2001 From: Simon Howe Date: Thu, 28 Jul 2016 15:32:35 +0200 Subject: [PATCH] Fixes grid -> topo transition. - Also don't show table borders when no nodes. - 't' toggles table mode on/off, rather than 't'/v' --- client/app/scripts/actions/app-actions.js | 5 ++++- client/app/scripts/charts/nodes-chart.js | 4 ++-- client/app/scripts/charts/nodes-grid.js | 4 ++-- client/app/scripts/components/app.js | 4 +--- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/client/app/scripts/actions/app-actions.js b/client/app/scripts/actions/app-actions.js index c83a8bf48..03646ed96 100644 --- a/client/app/scripts/actions/app-actions.js +++ b/client/app/scripts/actions/app-actions.js @@ -232,8 +232,11 @@ export function clickForceRelayout() { }; } -export function toggleGridMode(enabled) { +export function toggleGridMode(enabledArgument) { return (dispatch, getState) => { + const enabled = (enabledArgument === undefined) ? + !getState().get('gridMode') : + enabledArgument; dispatch({ type: ActionTypes.SET_GRID_MODE, enabled diff --git a/client/app/scripts/charts/nodes-chart.js b/client/app/scripts/charts/nodes-chart.js index 301b36576..943395b83 100644 --- a/client/app/scripts/charts/nodes-chart.js +++ b/client/app/scripts/charts/nodes-chart.js @@ -41,8 +41,8 @@ class NodesChart extends React.Component { scale: 1, selectedNodeScale: d3.scale.linear(), hasZoomed: false, - height: 0, - width: 0, + height: props.height || 0, + width: props.width || 0, zoomCache: {} }; } diff --git a/client/app/scripts/charts/nodes-grid.js b/client/app/scripts/charts/nodes-grid.js index 8e791a3c6..a97e7a98d 100644 --- a/client/app/scripts/charts/nodes-grid.js +++ b/client/app/scripts/charts/nodes-grid.js @@ -121,7 +121,7 @@ class NodesGrid extends React.Component { return (
- 0 && + />}
); } diff --git a/client/app/scripts/components/app.js b/client/app/scripts/components/app.js index 0c22392e3..518026649 100644 --- a/client/app/scripts/components/app.js +++ b/client/app/scripts/components/app.js @@ -87,10 +87,8 @@ class App extends React.Component { dispatch(pinNextMetric(-1)); } else if (char === '>') { dispatch(pinNextMetric(1)); - } else if (char === 'v') { - dispatch(toggleGridMode(false)); } else if (char === 't') { - dispatch(toggleGridMode(true)); + dispatch(toggleGridMode()); } else if (char === 'q') { dispatch(unpinMetric()); dispatch(selectMetric(null));