From e1237fba014ae72ddfe1260df67228942ca53d22 Mon Sep 17 00:00:00 2001 From: Tao Bojlen Date: Mon, 3 Sep 2018 22:34:25 +0200 Subject: [PATCH] clean up welcome page --- frontend/src/App.tsx | 39 +++++++++++++-------------- scraper/management/commands/scrape.py | 2 +- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 9b2d7c2..c3f27cf 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -2,8 +2,7 @@ import * as React from 'react'; import { connect } from 'react-redux'; import { Dispatch } from 'redux'; -import { Button, Intent, NonIdealState, Spinner } from '@blueprintjs/core'; -import { IconNames } from '@blueprintjs/icons'; +import { NonIdealState, Spinner } from '@blueprintjs/core'; import { Graph } from './components/Graph'; import { Nav } from './components/Nav'; @@ -21,11 +20,9 @@ interface IAppProps { } class AppImpl extends React.Component { public render() { - let body = this.welcomeState(); - if (this.props.isLoadingInstances) { - body = this.loadingState("Loading instances..."); - } else if (this.props.isLoadingGraph) { - body = this.loadingState("Loading graph..."); + let body =
; + if (this.props.isLoadingInstances || this.props.isLoadingGraph) { + body = this.loadingState("Loading..."); } else if (!!this.props.graph) { body = this.graphState(); } @@ -38,7 +35,20 @@ class AppImpl extends React.Component { } public componentDidMount() { - this.props.fetchInstances(); + this.load(); + } + + public componentDidUpdate() { + this.load(); + } + + private load = () => { + if (!this.props.instances && !this.props.isLoadingInstances) { + this.props.fetchInstances(); + } + if (!this.props.graph && !this.props.isLoadingGraph) { + this.props.fetchGraph(); + } } private graphState = () => { @@ -50,19 +60,6 @@ class AppImpl extends React.Component { ) } - private welcomeState = () => { - const numInstances = this.props.instances ? this.props.instances.length : "lots of"; - const description = `There are ${numInstances} known instances, so loading the graph might take a little while. Ready?` - return ( - } - /> - ) - } - private loadingState = (title?: string) => { return (