Store the pausedAt state in the app URL.

This commit is contained in:
Filip Barl
2017-11-01 18:31:26 +01:00
parent 893537ca5c
commit 4bd7fc759a
11 changed files with 65 additions and 40 deletions

View File

@@ -60,7 +60,7 @@ class Footer extends React.Component {
</a>
}
<span className="footer-label">Version</span>
{version}
{version || '...'}
<span className="footer-label">on</span>
{hostname}
</div>

View File

@@ -5,7 +5,6 @@ import { Map as makeMap } from 'immutable';
import MatchedText from '../matched-text';
import ShowMore from '../show-more';
import { formatDataType } from '../../utils/string-utils';
import { getSerializedTimeTravelTimestamp } from '../../utils/web-api-utils';
class NodeDetailsInfo extends React.Component {
@@ -68,7 +67,7 @@ class NodeDetailsInfo extends React.Component {
function mapStateToProps(state) {
return {
timestamp: getSerializedTimeTravelTimestamp(state),
timestamp: state.get('pausedAt'),
};
}

View File

@@ -11,7 +11,6 @@ import NodeDetailsTableRow from './node-details-table-row';
import NodeDetailsTableHeaders from './node-details-table-headers';
import { ipToPaddedString } from '../../utils/string-utils';
import { moveElement, insertElement } from '../../utils/array-utils';
import { getSerializedTimeTravelTimestamp } from '../../utils/web-api-utils';
import {
isIP, isNumber, defaultSortDesc, getTableColumnsStyles
} from '../../utils/node-details-utils';
@@ -305,7 +304,7 @@ NodeDetailsTable.defaultProps = {
function mapStateToProps(state) {
return {
timestamp: getSerializedTimeTravelTimestamp(state),
timestamp: state.get('pausedAt'),
};
}

View File

@@ -19,7 +19,7 @@ class TimeTravelWrapper extends React.Component {
}
changeTimestamp(timestamp) {
this.props.jumpToTime(timestamp);
this.props.jumpToTime(moment(timestamp).utc());
}
trackTimestampEdit() {
@@ -61,7 +61,7 @@ class TimeTravelWrapper extends React.Component {
return (
<TimeTravel
visible={visible}
timestamp={timestamp || moment()}
timestamp={timestamp}
earliestTimestamp={this.props.earliestTimestamp}
onChangeTimestamp={this.changeTimestamp}
onTimestampInputEdit={this.trackTimestampEdit}
@@ -75,6 +75,7 @@ class TimeTravelWrapper extends React.Component {
function mapStateToProps(state, { params }) {
const scopeState = state.scope || state;
const pausedAt = scopeState.get('pausedAt');
let firstSeenConnectedAt;
// If we're in the Weave Cloud context, use firstSeeConnectedAt as the earliest timestamp.
@@ -89,8 +90,8 @@ function mapStateToProps(state, { params }) {
visible: scopeState.get('showingTimeTravel'),
topologyViewMode: scopeState.get('topologyViewMode'),
currentTopology: scopeState.get('currentTopology'),
earliestTimestamp: firstSeenConnectedAt,
timestamp: scopeState.get('pausedAt'),
earliestTimestamp: firstSeenConnectedAt && firstSeenConnectedAt.utc().format(),
timestamp: pausedAt && pausedAt.utc().format(),
};
}