Skip to content

Commit

Permalink
Merge pull request #2616 from weaveworks/use-report-persistence-flag-…
Browse files Browse the repository at this point in the history
…in-the-ui

Time Travel: remove the feature flag and make the availability depend on historic reports capability
  • Loading branch information
fbarl authored Aug 8, 2017
2 parents 0823e2e + f988276 commit ff6d314
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 41 deletions.
2 changes: 2 additions & 0 deletions client/app/scripts/actions/app-actions.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import debug from 'debug';
import { find } from 'lodash';
import { fromJS } from 'immutable';

import ActionTypes from '../constants/action-types';
import { saveGraph } from '../utils/file-utils';
Expand Down Expand Up @@ -657,6 +658,7 @@ export function receiveTopologies(topologies) {
export function receiveApiDetails(apiDetails) {
return {
type: ActionTypes.RECEIVE_API_DETAILS,
capabilities: fromJS(apiDetails.capabilities),
hostname: apiDetails.hostname,
version: apiDetails.version,
newVersion: apiDetails.newVersion,
Expand Down
20 changes: 10 additions & 10 deletions client/app/scripts/components/time-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import moment from 'moment';
import classNames from 'classnames';
import { connect } from 'react-redux';

import CloudFeature from './cloud-feature';
import TimeTravelButton from './time-travel-button';
import { trackMixpanelEvent } from '../utils/tracking-utils';
import { pauseTimeAtNow, resumeTime, startTimeTravel } from '../actions/app-actions';

Expand Down Expand Up @@ -65,7 +63,8 @@ class TimeControl extends React.Component {
}

render() {
const { showingTimeTravel, pausedAt, timeTravelTransitioning, topologiesLoaded } = this.props;
const { showingTimeTravel, pausedAt, timeTravelTransitioning, topologiesLoaded,
hasHistoricReports } = this.props;

const isPausedNow = pausedAt && !showingTimeTravel;
const isTimeTravelling = showingTimeTravel;
Expand Down Expand Up @@ -95,13 +94,13 @@ class TimeControl extends React.Component {
{isPausedNow && <span className="fa fa-pause" />}
<span className="label">{isPausedNow ? 'Paused' : 'Pause'}</span>
</span>
<CloudFeature>
<TimeTravelButton
className={className(isTimeTravelling)}
onClick={this.handleTravelClick}
isTimeTravelling={isTimeTravelling}
/>
</CloudFeature>
{hasHistoricReports && <span
className={className(isTimeTravelling)}
onClick={this.handleTravelClick}
title="Travel back in time">
{isTimeTravelling && <span className="fa fa-clock-o" />}
<span className="label">Time Travel</span>
</span>}
</div>
</div>
{(isPausedNow || isTimeTravelling) && <span
Expand All @@ -120,6 +119,7 @@ class TimeControl extends React.Component {

function mapStateToProps(state) {
return {
hasHistoricReports: state.getIn(['capabilities', 'historic_reports']),
topologyViewMode: state.get('topologyViewMode'),
topologiesLoaded: state.get('topologiesLoaded'),
currentTopology: state.get('currentTopology'),
Expand Down
29 changes: 0 additions & 29 deletions client/app/scripts/components/time-travel-button.js

This file was deleted.

6 changes: 4 additions & 2 deletions client/app/scripts/reducers/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const topologySorter = topology => topology.get('rank');
// Initial values

export const initialState = makeMap({
capabilities: makeMap(),
contrastMode: false,
controlPipes: makeOrderedMap(), // pipeId -> controlPipe
controlStatus: makeMap(),
Expand Down Expand Up @@ -658,10 +659,11 @@ export function rootReducer(state = initialState, action) {
state = state.set('errorUrl', null);

return state.merge({
capabilities: action.capabilities,
hostname: action.hostname,
version: action.version,
plugins: action.plugins,
versionUpdate: action.newVersion
version: action.version,
versionUpdate: action.newVersion,
});
}

Expand Down

0 comments on commit ff6d314

Please sign in to comment.