mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-02 17:50:39 +00:00
Review feedback on loading-indicator
This commit is contained in:
@@ -14,7 +14,6 @@ const LOADING_TEMPLATES = [
|
||||
'Locating THINGS',
|
||||
'Optimizing THINGS',
|
||||
'Transporting THINGS',
|
||||
'Double checking THINGS',
|
||||
];
|
||||
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ class Nodes extends React.Component {
|
||||
|
||||
return (
|
||||
<div className="nodes-wrapper">
|
||||
<DelayedShow delay={1000} show={!topologiesLoaded}>
|
||||
<DelayedShow delay={1000} show={!topologiesLoaded || (topologiesLoaded && !nodesLoaded)}>
|
||||
<Loading itemType="topologies" show={!topologiesLoaded} />
|
||||
<Loading
|
||||
itemType={getNodeType(topology, topologies)}
|
||||
|
||||
@@ -7,18 +7,16 @@ export class DelayedShow extends React.Component {
|
||||
this.state = {
|
||||
show: false
|
||||
};
|
||||
}
|
||||
|
||||
if (props.show) {
|
||||
componentWillMount() {
|
||||
if (this.props.show) {
|
||||
this.scheduleShow();
|
||||
}
|
||||
}
|
||||
|
||||
scheduleShow() {
|
||||
this.showTimeout = setTimeout(() => this.setState({ show: true }), this.props.delay);
|
||||
}
|
||||
|
||||
cancelShow() {
|
||||
clearTimeout(this.showTimeout);
|
||||
componentWillUnmount() {
|
||||
this.cancelShow();
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@@ -34,6 +32,14 @@ export class DelayedShow extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
scheduleShow() {
|
||||
this.showTimeout = setTimeout(() => this.setState({ show: true }), this.props.delay);
|
||||
}
|
||||
|
||||
cancelShow() {
|
||||
clearTimeout(this.showTimeout);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { children } = this.props;
|
||||
const { show } = this.state;
|
||||
|
||||
Reference in New Issue
Block a user