mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-05 19:21:46 +00:00
* Node details fetching reports at proper timestamp. * Corrected all the relevant timestamps in the UI. * Renamed some state variables. * Time travel works for topologies list. * Added a whole screen overlay for time travel. * Polished the backend. * Make time travel work also with the Resource View. * Fixed the jest tests. * Fixed the empty view message for resource view. * Some naming polishing. * Addressed the comments.
63 lines
1.7 KiB
JavaScript
63 lines
1.7 KiB
JavaScript
import { createSelector } from 'reselect';
|
|
import { Map as makeMap } from 'immutable';
|
|
|
|
import { layersTopologyIdsSelector } from './resource-view/layout';
|
|
import {
|
|
RESOURCE_VIEW_MODE,
|
|
GRAPH_VIEW_MODE,
|
|
TABLE_VIEW_MODE,
|
|
} from '../constants/naming';
|
|
|
|
|
|
// TODO: Consider moving more stuff from 'topology-utils' here.
|
|
|
|
export const isGraphViewModeSelector = createSelector(
|
|
[
|
|
state => state.get('topologyViewMode'),
|
|
],
|
|
viewMode => viewMode === GRAPH_VIEW_MODE
|
|
);
|
|
|
|
export const isTableViewModeSelector = createSelector(
|
|
[
|
|
state => state.get('topologyViewMode'),
|
|
],
|
|
viewMode => viewMode === TABLE_VIEW_MODE
|
|
);
|
|
|
|
export const isResourceViewModeSelector = createSelector(
|
|
[
|
|
state => state.get('topologyViewMode'),
|
|
],
|
|
viewMode => viewMode === RESOURCE_VIEW_MODE
|
|
);
|
|
|
|
export const resourceViewAvailableSelector = createSelector(
|
|
[
|
|
layersTopologyIdsSelector
|
|
],
|
|
layersTopologyIds => !layersTopologyIds.isEmpty()
|
|
);
|
|
|
|
// Checks if graph complexity is high. Used to trigger
|
|
// table view on page load and decide on animations.
|
|
export const graphExceedsComplexityThreshSelector = createSelector(
|
|
[
|
|
state => state.getIn(['currentTopology', 'stats', 'node_count']) || 0,
|
|
state => state.getIn(['currentTopology', 'stats', 'edge_count']) || 0,
|
|
],
|
|
(nodeCount, edgeCount) => (nodeCount + (2 * edgeCount)) > 1000
|
|
);
|
|
|
|
// Options for current topology, sub-topologies share options with parent
|
|
export const activeTopologyOptionsSelector = createSelector(
|
|
[
|
|
state => state.getIn(['currentTopology', 'parentId']),
|
|
state => state.get('currentTopologyId'),
|
|
state => state.get('topologyOptions'),
|
|
],
|
|
(parentTopologyId, currentTopologyId, topologyOptions) => (
|
|
topologyOptions.get(parentTopologyId || currentTopologyId, makeMap())
|
|
)
|
|
);
|