mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 10:11:03 +00:00
* 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.
60 lines
1.8 KiB
JavaScript
60 lines
1.8 KiB
JavaScript
import React from 'react';
|
|
import { connect } from 'react-redux';
|
|
|
|
import { isPausedSelector } from '../selectors/time-travel';
|
|
|
|
|
|
class Status extends React.Component {
|
|
render() {
|
|
const { errorUrl, topologiesLoaded, filteredNodeCount, topology, websocketClosed } = this.props;
|
|
|
|
let title = '';
|
|
let text = 'Trying to reconnect...';
|
|
let showWarningIcon = false;
|
|
let classNames = 'status sidebar-item';
|
|
|
|
if (errorUrl) {
|
|
title = `Cannot reach Scope. Make sure the following URL is reachable: ${errorUrl}`;
|
|
classNames += ' status-loading';
|
|
showWarningIcon = true;
|
|
} else if (!topologiesLoaded) {
|
|
text = 'Connecting to Scope...';
|
|
classNames += ' status-loading';
|
|
showWarningIcon = true;
|
|
} else if (websocketClosed) {
|
|
classNames += ' status-loading';
|
|
showWarningIcon = true;
|
|
} else if (topology) {
|
|
const stats = topology.get('stats');
|
|
text = `${stats.get('node_count') - filteredNodeCount} nodes`;
|
|
if (stats.get('filtered_nodes')) {
|
|
text = `${text} (${stats.get('filtered_nodes') + filteredNodeCount} filtered)`;
|
|
}
|
|
classNames += ' status-stats';
|
|
showWarningIcon = false;
|
|
}
|
|
|
|
return (
|
|
<div className={classNames}>
|
|
{showWarningIcon && <span className="status-icon fa fa-exclamation-circle" />}
|
|
<span className="status-label" title={title}>{text}</span>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
function mapStateToProps(state) {
|
|
return {
|
|
errorUrl: state.get('errorUrl'),
|
|
filteredNodeCount: state.get('nodes').filter(node => node.get('filtered')).size,
|
|
showingCurrentState: !isPausedSelector(state),
|
|
topologiesLoaded: state.get('topologiesLoaded'),
|
|
topology: state.get('currentTopology'),
|
|
websocketClosed: state.get('websocketClosed'),
|
|
};
|
|
}
|
|
|
|
export default connect(
|
|
mapStateToProps
|
|
)(Status);
|