Files
weave-scope/client/app/scripts/components/time-travel-button.js
Filip Barl 8f2d47ce4e Time travel redesign (#2651)
* Initial top level control.

* Added the jump buttons.

* Tiny styling adjustments.

* Massive renaming.

* Pause info

* Added slider marks.

* Improved messaging.

* Freeze all updates when paused.

* Repositioned for Configure button.

* Improved the flow.

* Working browsing through slider.

* Small styling.

* Hide time travel button behind the feature flag.

* Fixed actions.

* Elements positioning corner cases.

* Removed nodes delta buffering code.

* Fixed the flow.

* Fixed almost all API call cases.

* Final touches

* Fixed the tests.

* Fix resource view updates when time travelling.

* Added some comments.

* Addressed some of @foot's comments.
2017-07-06 16:06:55 +02:00

30 lines
873 B
JavaScript

import React from 'react';
import { connect } from 'react-redux';
// TODO: Move this back into TimeTravelControls once we move away from CloudFeature.
class TimeTravelButton extends React.Component {
render() {
const { className, onClick, isTimeTravelling, hasTimeTravel } = this.props;
if (!hasTimeTravel) return null;
return (
<span className={className} onClick={onClick} title="Travel back in time">
{isTimeTravelling && <span className="fa fa-clock-o" />}
<span className="label">Time Travel</span>
</span>
);
}
}
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);