Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial version of the resource view #2296

Merged
merged 32 commits into from
Mar 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
08f9691
Added resource view selector button
fbarl Mar 2, 2017
7a049c1
Showing resource boxes in the resource view
fbarl Mar 3, 2017
f0e7007
Crude CPU resource view prototype
fbarl Mar 3, 2017
688c0f4
Improved the viewMode state logic
fbarl Mar 3, 2017
e52b123
Extracted zooming into a separate wrapper component
fbarl Mar 3, 2017
1e4dd6d
Split the layout selectors between graph-view and resource-view
fbarl Mar 6, 2017
a11e3a1
Proper zooming logic for the resource view
fbarl Mar 6, 2017
4d36806
Moved all node networks utils to selectors
fbarl Mar 7, 2017
b546acf
Improved the zoom caching logic
fbarl Mar 8, 2017
af0881d
Further refactoring of selectors
fbarl Mar 10, 2017
de3d99f
Added sticky labels to the resource boxes
fbarl Mar 10, 2017
ce1282c
Added panning translation limits in the resource view
fbarl Mar 10, 2017
e05302e
Renamed GridModeSelector -> ViewModeSelector
fbarl Mar 10, 2017
c225993
Polished the topology resource view selection logic
fbarl Mar 10, 2017
04bfca2
Search bar hidden in the resource view
fbarl Mar 10, 2017
7cdfcf7
Added per-layer topology names to the resource view
fbarl Mar 11, 2017
8ac6d8a
Made metric selectors work for the resource view
fbarl Mar 11, 2017
bfd3271
Adjusted the viewport selectors
fbarl Mar 12, 2017
a4a97e4
Renamed viewport selector to canvas (+ maximal zoom fix)
fbarl Mar 12, 2017
feb461c
Showing more useful metric info in the resource box labels
fbarl Mar 14, 2017
c273da2
Fetching only necessary nodes for the resource view
fbarl Mar 15, 2017
a57f043
Refactored the resource view layer component
fbarl Mar 15, 2017
b3eb612
Addressed first batch UI comments (from the Scope meeting)
fbarl Mar 16, 2017
f8348fc
Switch to deep zooming transform in the resource view to avoid SVG pr…
fbarl Mar 17, 2017
287d379
Renamed and moved resource view components
fbarl Mar 17, 2017
a52c979
Polished all the resource view components
fbarl Mar 17, 2017
a8d8e0e
Changing the available metrics selection
fbarl Mar 20, 2017
471251a
Improved and polished the state transition logic for the resource view
fbarl Mar 20, 2017
2373b71
Separated zoom limits from the zoom active state
fbarl Mar 21, 2017
8fec8a3
Renaming and bunch of comments
fbarl Mar 21, 2017
3dc4e9d
Addressed all the UI comments (@davkal + @fons)
fbarl Mar 22, 2017
ca3f74f
Made graph view selectors independent from resource view selectors
fbarl Mar 24, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 77 additions & 36 deletions client/app/scripts/actions/app-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import {
doControlRequest,
getAllNodes,
getResourceViewNodesSnapshot,
getNodesDelta,
getNodeDetails,
getTopologies,
Expand All @@ -23,7 +24,16 @@ import {
import { getCurrentTopologyUrl } from '../utils/topology-utils';
import { storageSet } from '../utils/storage-utils';
import { loadTheme } from '../utils/contrast-utils';
import { activeTopologyOptionsSelector } from '../selectors/topology';
import { availableMetricsSelector, pinnedMetricSelector } from '../selectors/node-metric';
import {
activeTopologyOptionsSelector,
isResourceViewModeSelector,
} from '../selectors/topology';
import {
GRAPH_VIEW_MODE,
TABLE_VIEW_MODE,
RESOURCE_VIEW_MODE,
} from '../constants/naming';

const log = debug('scope:app-actions');

Expand Down Expand Up @@ -141,7 +151,7 @@ export function unpinMetric() {
export function pinNextMetric(delta) {
return (dispatch, getState) => {
const state = getState();
const metrics = state.get('availableCanvasMetrics').map(m => m.get('id'));
const metrics = availableMetricsSelector(state).map(m => m.get('id'));
const currentIndex = metrics.indexOf(state.get('selectedMetric'));
const nextIndex = modulo(currentIndex + delta, metrics.count());
const nextMetric = metrics.get(nextIndex);
Expand Down Expand Up @@ -248,25 +258,57 @@ export function clickForceRelayout() {
};
}

export function doSearch(searchQuery) {
return (dispatch, getState) => {
dispatch({
type: ActionTypes.DO_SEARCH,
searchQuery
});
updateRoute(getState);
};
}

export function setViewportDimensions(width, height) {
return (dispatch) => {
dispatch({ type: ActionTypes.SET_VIEWPORT_DIMENSIONS, width, height });
};
}

export function toggleGridMode(enabledArgument) {
export function setGraphView() {
return (dispatch, getState) => {
const enabled = (enabledArgument === undefined) ?
!getState().get('gridMode') :
enabledArgument;
dispatch({
type: ActionTypes.SET_GRID_MODE,
enabled
type: ActionTypes.SET_VIEW_MODE,
viewMode: GRAPH_VIEW_MODE,
});
updateRoute(getState);
};
}

export function setTableView() {
return (dispatch, getState) => {
dispatch({
type: ActionTypes.SET_VIEW_MODE,
viewMode: TABLE_VIEW_MODE,
});
updateRoute(getState);
};
}

export function setResourceView() {
return (dispatch, getState) => {
dispatch({
type: ActionTypes.SET_VIEW_MODE,
viewMode: RESOURCE_VIEW_MODE,
});
// Pin the first metric if none of the visible ones is pinned.
if (!pinnedMetricSelector(getState())) {
dispatch({ type: ActionTypes.PIN_METRIC });
}
getResourceViewNodesSnapshot(getState, dispatch);
updateRoute(getState);
};
}

export function clickNode(nodeId, label, origin) {
return (dispatch, getState) => {
dispatch({
Expand Down Expand Up @@ -323,22 +365,33 @@ export function clickResumeUpdate() {
};
}

function updateTopology(dispatch, getState) {
const state = getState();
// If we're in the resource view, get the snapshot of all the relevant node topologies.
if (isResourceViewModeSelector(state)) {
getResourceViewNodesSnapshot(getState, dispatch);
}
updateRoute(getState);
// update all request workers with new options
resetUpdateBuffer();
// NOTE: This is currently not needed for our static resource
// view, but we'll need it here later and it's simpler to just
// keep it than to redo the nodes delta updating logic.
getNodesDelta(
getCurrentTopologyUrl(state),
activeTopologyOptionsSelector(state),
dispatch
);
}

export function clickShowTopologyForNode(topologyId, nodeId) {
return (dispatch, getState) => {
dispatch({
type: ActionTypes.CLICK_SHOW_TOPOLOGY_FOR_NODE,
topologyId,
nodeId
});
updateRoute(getState);
// update all request workers with new options
resetUpdateBuffer();
const state = getState();
getNodesDelta(
getCurrentTopologyUrl(state),
activeTopologyOptionsSelector(state),
dispatch
);
updateTopology(dispatch, getState);
};
}

Expand All @@ -348,15 +401,7 @@ export function clickTopology(topologyId) {
type: ActionTypes.CLICK_TOPOLOGY,
topologyId
});
updateRoute(getState);
// update all request workers with new options
resetUpdateBuffer();
const state = getState();
getNodesDelta(
getCurrentTopologyUrl(state),
activeTopologyOptionsSelector(state),
dispatch
);
updateTopology(dispatch, getState);
};
}

Expand Down Expand Up @@ -397,16 +442,6 @@ export function doControl(nodeId, control) {
};
}

export function doSearch(searchQuery) {
return (dispatch, getState) => {
dispatch({
type: ActionTypes.DO_SEARCH,
searchQuery
});
updateRoute(getState);
};
}

export function enterEdge(edgeId) {
return {
type: ActionTypes.ENTER_EDGE,
Expand Down Expand Up @@ -700,6 +735,12 @@ export function route(urlState) {
state.get('nodeDetails'),
dispatch
);
// If we are landing on the resource view page, we need to fetch not only all the
// nodes for the current topology, but also the nodes of all the topologies that make
// the layers in the resource view.
if (isResourceViewModeSelector(state)) {
getResourceViewNodesSnapshot(getState, dispatch);
}
};
}

Expand Down
6 changes: 3 additions & 3 deletions client/app/scripts/charts/nodes-chart-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import {
selectedScaleSelector,
layoutNodesSelector,
layoutEdgesSelector
} from '../selectors/nodes-chart-layout';
} from '../selectors/graph-view/layout';


class NodesChartElements extends React.Component {
render() {
const { layoutNodes, layoutEdges, selectedScale, transform, isAnimated } = this.props;
const { layoutNodes, layoutEdges, selectedScale, isAnimated } = this.props;

return (
<g className="nodes-chart-elements" transform={transform}>
<g className="nodes-chart-elements">
<NodesChartEdges
layoutEdges={layoutEdges}
selectedScale={selectedScale}
Expand Down
Loading