From f98827698feb176c04b7ccc0a1c25c48e32a3f62 Mon Sep 17 00:00:00 2001 From: Filip Barl Date: Fri, 16 Jun 2017 18:10:46 +0200 Subject: [PATCH] Replaced the feature flag with historic reports capability flag. --- client/app/scripts/actions/app-actions.js | 2 ++ client/app/scripts/components/time-control.js | 20 ++++++------- .../scripts/components/time-travel-button.js | 29 ------------------- client/app/scripts/reducers/root.js | 6 ++-- 4 files changed, 16 insertions(+), 41 deletions(-) delete mode 100644 client/app/scripts/components/time-travel-button.js diff --git a/client/app/scripts/actions/app-actions.js b/client/app/scripts/actions/app-actions.js index cecbefab66..009f8a3308 100644 --- a/client/app/scripts/actions/app-actions.js +++ b/client/app/scripts/actions/app-actions.js @@ -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'; @@ -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, diff --git a/client/app/scripts/components/time-control.js b/client/app/scripts/components/time-control.js index de50001254..ed63562c52 100644 --- a/client/app/scripts/components/time-control.js +++ b/client/app/scripts/components/time-control.js @@ -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'; @@ -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; @@ -95,13 +94,13 @@ class TimeControl extends React.Component { {isPausedNow && } {isPausedNow ? 'Paused' : 'Pause'} - - - + {hasHistoricReports && + {isTimeTravelling && } + Time Travel + } {(isPausedNow || isTimeTravelling) && - {isTimeTravelling && } - Time Travel - - ); - } -} - -function mapStateToProps({ root }, { params }) { - const cloudInstance = root.instances[params.orgId] || {}; - const featureFlags = cloudInstance.featureFlags || []; - return { - hasTimeTravel: featureFlags.includes('time-travel'), - }; -} - -export default connect(mapStateToProps)(TimeTravelButton); diff --git a/client/app/scripts/reducers/root.js b/client/app/scripts/reducers/root.js index 880a6b56ee..9e0c9781e4 100644 --- a/client/app/scripts/reducers/root.js +++ b/client/app/scripts/reducers/root.js @@ -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(), @@ -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, }); }