mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 02:00:43 +00:00
Terminology change from lock -> pin
In meetings etc the term pin is more often used.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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 && <MetricSelector
|
||||
availableCanvasMetrics={this.state.availableCanvasMetrics}
|
||||
lockedMetric={this.state.lockedMetric}
|
||||
pinnedMetric={this.state.pinnedMetric}
|
||||
selectedMetric={this.state.selectedMetric}
|
||||
/>}
|
||||
<TopologyOptions options={this.state.currentTopologyOptions}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { selectMetric, lockMetric, unlockMetric } from '../actions/app-actions';
|
||||
import { selectMetric, pinMetric, unpinMetric } from '../actions/app-actions';
|
||||
|
||||
|
||||
export class MetricSelectorItem extends React.Component {
|
||||
@@ -19,22 +19,21 @@ export class MetricSelectorItem extends React.Component {
|
||||
|
||||
onMouseClick() {
|
||||
const k = this.props.metric.id;
|
||||
const lockedMetric = this.props.lockedMetric;
|
||||
const pinnedMetric = this.props.pinnedMetric;
|
||||
|
||||
if (k === lockedMetric) {
|
||||
unlockMetric(k);
|
||||
if (k === pinnedMetric) {
|
||||
unpinMetric(k);
|
||||
} else {
|
||||
lockMetric(k);
|
||||
pinMetric(k);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {metric, selectedMetric, lockedMetric} = this.props;
|
||||
const {metric, selectedMetric, pinnedMetric} = this.props;
|
||||
const id = metric.id;
|
||||
const isLocked = (id === lockedMetric);
|
||||
const isPinned = (id === pinnedMetric);
|
||||
const isSelected = (id === selectedMetric);
|
||||
const className = classNames('metric-selector-action', {
|
||||
'metric-selector-action-locked': isLocked,
|
||||
'metric-selector-action-selected': isSelected
|
||||
});
|
||||
|
||||
@@ -45,7 +44,7 @@ export class MetricSelectorItem extends React.Component {
|
||||
onMouseOver={this.onMouseOver}
|
||||
onClick={this.onMouseClick}>
|
||||
{metric.label}
|
||||
{isLocked && <span className="fa fa-thumb-tack"></span>}
|
||||
{isPinned && <span className="fa fa-thumb-tack"></span>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ export default class MetricSelector extends React.Component {
|
||||
}
|
||||
|
||||
onMouseOut() {
|
||||
selectMetric(this.props.lockedMetric);
|
||||
selectMetric(this.props.pinnedMetric);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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]:
|
||||
|
||||
Reference in New Issue
Block a user