diff --git a/client/app/scripts/actions/app-actions.js b/client/app/scripts/actions/app-actions.js index 905aa7e4e..ddc79977b 100644 --- a/client/app/scripts/actions/app-actions.js +++ b/client/app/scripts/actions/app-actions.js @@ -20,31 +20,31 @@ export function selectMetric(metricId) { }); } -export function lockNextMetric(delta) { +export function pinNextMetric(delta) { const metrics = AppStore.getAvailableCanvasMetrics().map(m => m.id); const currentIndex = metrics.indexOf(AppStore.getSelectedMetric()); const nextMetric = metrics[modulo(currentIndex + delta, metrics.length)]; AppDispatcher.dispatch({ - type: ActionTypes.LOCK_METRIC, + type: ActionTypes.PIN_METRIC, metricId: nextMetric, metricType: AppStore.getAvailableCanvasMetricsTypes()[nextMetric] }); updateRoute(); } -export function lockMetric(metricId) { +export function pinMetric(metricId) { AppDispatcher.dispatch({ - type: ActionTypes.LOCK_METRIC, + type: ActionTypes.PIN_METRIC, metricId, metricType: AppStore.getAvailableCanvasMetricsTypes()[metricId] }); updateRoute(); } -export function unlockMetric() { +export function unpinMetric() { AppDispatcher.dispatch({ - type: ActionTypes.UNLOCK_METRIC, + type: ActionTypes.UNPIN_METRIC, }); updateRoute(); } diff --git a/client/app/scripts/charts/nodes-chart.js b/client/app/scripts/charts/nodes-chart.js index 172f82893..ac8578872 100644 --- a/client/app/scripts/charts/nodes-chart.js +++ b/client/app/scripts/charts/nodes-chart.js @@ -135,7 +135,6 @@ export default class NodesChart extends React.Component { const met = node.get('metrics') && node.get('metrics') .filter(m => m.get('id') === this.props.selectedMetric) .first(); - console.log(met); return met; }; diff --git a/client/app/scripts/components/app.js b/client/app/scripts/components/app.js index b85025b31..b257142af 100644 --- a/client/app/scripts/components/app.js +++ b/client/app/scripts/components/app.js @@ -9,7 +9,7 @@ import Status from './status.js'; import Topologies from './topologies.js'; import TopologyOptions from './topology-options.js'; import { getApiDetails, getTopologies } from '../utils/web-api-utils'; -import { lockNextMetric, hitEsc, unlockMetric, +import { pinNextMetric, hitEsc, unpinMetric, selectMetric } from '../actions/app-actions'; import Details from './details'; import Nodes from './nodes'; @@ -39,7 +39,7 @@ function getStateFromStores() { highlightedEdgeIds: AppStore.getHighlightedEdgeIds(), highlightedNodeIds: AppStore.getHighlightedNodeIds(), hostname: AppStore.getHostname(), - lockedMetric: AppStore.getLockedMetric(), + pinnedMetric: AppStore.getPinnedMetric(), availableCanvasMetrics: AppStore.getAvailableCanvasMetrics(), nodeDetails: AppStore.getNodeDetails(), nodes: AppStore.getNodes(), @@ -84,11 +84,11 @@ export default class App extends React.Component { if (ev.keyCode === ESC_KEY_CODE) { hitEsc(); } else if (ev.keyIdentifier === RIGHT_ANGLE_KEY_IDENTIFIER) { - lockNextMetric(-1); + pinNextMetric(-1); } else if (ev.keyIdentifier === LEFT_ANGLE_KEY_IDENTIFIER) { - lockNextMetric(1); + pinNextMetric(1); } else if (ev.keyCode === Q_KEY_CODE) { - unlockMetric(); + unpinMetric(); selectMetric(null); } else if (ev.keyCode === D_KEY_CODE) { toggleDebugToolbar(); @@ -144,7 +144,7 @@ export default class App extends React.Component { websocketClosed={this.state.websocketClosed} /> {this.state.availableCanvasMetrics.length > 0 && } {metric.label} - {isLocked && } + {isPinned && } ); } diff --git a/client/app/scripts/components/metric-selector.js b/client/app/scripts/components/metric-selector.js index 75fa8128c..76878019c 100644 --- a/client/app/scripts/components/metric-selector.js +++ b/client/app/scripts/components/metric-selector.js @@ -16,7 +16,7 @@ export default class MetricSelector extends React.Component { } onMouseOut() { - selectMetric(this.props.lockedMetric); + selectMetric(this.props.pinnedMetric); } render() { diff --git a/client/app/scripts/constants/action-types.js b/client/app/scripts/constants/action-types.js index 151143483..a6b3f5912 100644 --- a/client/app/scripts/constants/action-types.js +++ b/client/app/scripts/constants/action-types.js @@ -23,8 +23,8 @@ const ACTION_TYPES = [ 'ENTER_NODE', 'LEAVE_EDGE', 'LEAVE_NODE', - 'LOCK_METRIC', - 'UNLOCK_METRIC', + 'PIN_METRIC', + 'UNPIN_METRIC', 'OPEN_WEBSOCKET', 'RECEIVE_CONTROL_PIPE', 'RECEIVE_CONTROL_PIPE_STATUS', diff --git a/client/app/scripts/stores/app-store.js b/client/app/scripts/stores/app-store.js index 33f427a50..1f4012ab2 100644 --- a/client/app/scripts/stores/app-store.js +++ b/client/app/scripts/stores/app-store.js @@ -60,8 +60,8 @@ let updatePausedAt = null; // Date let websocketClosed = true; let selectedMetric = null; -let lockedMetric = selectedMetric; -let lockedMetricType = null; +let pinnedMetric = selectedMetric; +let pinnedMetricType = null; let availableCanvasMetrics = []; @@ -144,7 +144,7 @@ export class AppStore extends Store { controlPipe: this.getControlPipe(), nodeDetails: this.getNodeDetailsState(), selectedNodeId, - lockedMetricType, + pinnedMetricType, topologyId: currentTopologyId, topologyOptions: topologyOptions.toJS() // all options }; @@ -171,8 +171,8 @@ export class AppStore extends Store { return adjacentNodes; } - getLockedMetric() { - return lockedMetric; + getPinnedMetric() { + return pinnedMetric; } getSelectedMetric() { @@ -431,16 +431,16 @@ export class AppStore extends Store { this.__emitChange(); break; } - case ActionTypes.LOCK_METRIC: { - lockedMetric = payload.metricId; - lockedMetricType = payload.metricType; + case ActionTypes.PIN_METRIC: { + pinnedMetric = payload.metricId; + pinnedMetricType = payload.metricType; selectedMetric = payload.metricId; this.__emitChange(); break; } - case ActionTypes.UNLOCK_METRIC: { - lockedMetric = null; - lockedMetricType = null; + case ActionTypes.UNPIN_METRIC: { + pinnedMetric = null; + pinnedMetricType = null; this.__emitChange(); break; } @@ -617,11 +617,11 @@ export class AppStore extends Store { .sortBy(m => m.get('label')) .toJS(); - const similarTypeMetric = availableCanvasMetrics.find(m => m.label === lockedMetricType); - lockedMetric = similarTypeMetric && similarTypeMetric.id; + const similarTypeMetric = availableCanvasMetrics.find(m => m.label === pinnedMetricType); + pinnedMetric = similarTypeMetric && similarTypeMetric.id; // if something in the current topo is not already selected, select it. if (availableCanvasMetrics.map(m => m.id).indexOf(selectedMetric) === -1) { - selectedMetric = lockedMetric; + selectedMetric = pinnedMetric; } if (emitChange) { @@ -669,7 +669,7 @@ export class AppStore extends Store { setTopology(payload.state.topologyId); setDefaultTopologyOptions(topologies); selectedNodeId = payload.state.selectedNodeId; - lockedMetricType = payload.state.lockedMetricType; + pinnedMetricType = payload.state.pinnedMetricType; if (payload.state.controlPipe) { controlPipes = makeOrderedMap({ [payload.state.controlPipe.id]: