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

Added mixpanel tracking for some basic events #2462

Merged
merged 6 commits into from
Apr 27, 2017
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Disable 'r' keyboard shortcut when Resource View is disabled
fbarl committed Apr 27, 2017
commit 170ea385b98eeb881ea67cb3299ec848a5de196d
25 changes: 14 additions & 11 deletions client/app/scripts/actions/app-actions.js
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ import {
import {
activeTopologyOptionsSelector,
isResourceViewModeSelector,
resourceViewAvailableSelector,
} from '../selectors/topology';
import {
GRAPH_VIEW_MODE,
@@ -321,18 +322,20 @@ export function setTableView() {

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.
const state = getState();
if (!pinnedMetricSelector(state)) {
const firstAvailableMetricType = availableMetricTypesSelector(state).first();
dispatch(pinMetric(firstAvailableMetricType));
if (resourceViewAvailableSelector(getState())) {
dispatch({
type: ActionTypes.SET_VIEW_MODE,
viewMode: RESOURCE_VIEW_MODE,
});
// Pin the first metric if none of the visible ones is pinned.
const state = getState();
if (!pinnedMetricSelector(state)) {
const firstAvailableMetricType = availableMetricTypesSelector(state).first();
dispatch(pinMetric(firstAvailableMetricType));
}
getResourceViewNodesSnapshot(getState, dispatch);
updateRoute(getState);
}
getResourceViewNodesSnapshot(getState, dispatch);
updateRoute(getState);
};
}

8 changes: 5 additions & 3 deletions client/app/scripts/components/view-mode-selector.js
Original file line number Diff line number Diff line change
@@ -5,9 +5,11 @@ import classNames from 'classnames';
import MetricSelector from './metric-selector';
import { trackMixpanelEvent } from '../utils/tracking-utils';
import { setGraphView, setTableView, setResourceView } from '../actions/app-actions';
import { layersTopologyIdsSelector } from '../selectors/resource-view/layout';
import { availableMetricsSelector } from '../selectors/node-metric';
import { isResourceViewModeSelector } from '../selectors/topology';
import {
isResourceViewModeSelector,
resourceViewAvailableSelector,
} from '../selectors/topology';
import {
GRAPH_VIEW_MODE,
TABLE_VIEW_MODE,
@@ -68,7 +70,7 @@ class ViewModeSelector extends React.Component {
function mapStateToProps(state) {
return {
isResourceViewMode: isResourceViewModeSelector(state),
hasResourceView: !layersTopologyIdsSelector(state).isEmpty(),
hasResourceView: resourceViewAvailableSelector(state),
showingMetricsSelector: availableMetricsSelector(state).count() > 0,
topologyViewMode: state.get('topologyViewMode'),
currentTopology: state.get('currentTopology'),
8 changes: 8 additions & 0 deletions client/app/scripts/selectors/topology.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createSelector } from 'reselect';

import { layersTopologyIdsSelector } from './resource-view/layout';
import {
RESOURCE_VIEW_MODE,
GRAPH_VIEW_MODE,
@@ -30,6 +31,13 @@ export const isResourceViewModeSelector = createSelector(
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(