Created
October 30, 2018 21:53
-
-
Save nomoney4me/1194390a602606967b87bc39197e8370 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react' | |
| import { Row, Col } from 'reactstrap'; | |
| import TotalCount from './widgets/TotalCounts'; | |
| import PivotWidget from './PivotWidget'; | |
| import BarGraph from './BarGraph'; | |
| import CustomTable from './CustomTable'; | |
| import DemoTable from './DemoTable'; | |
| import Loading from '../assets/img/loading.gif'; | |
| export default class Dashboard extends Component { | |
| constructor(props) { | |
| super(props) | |
| this.state = { | |
| sql_data: null, | |
| list_data: null | |
| } | |
| } | |
| componentWillMount() { | |
| fetch(`/api/get_counts`) | |
| .then(res => res.json()).then(data => { | |
| console.log(data) | |
| this.setState({ sql_data: data }) | |
| }, []) | |
| } | |
| render() { | |
| return ( | |
| <Row> | |
| <Col xs={6} md={6} lg={6}> | |
| { this.state.sql_data ? <DemoTable data={ this.state.sql_data } /> : <img src={Loading} /> } | |
| <hr /> | |
| { this.state.sql_data ? <DemoTable data={ this.state.sql_data } /> : <img src={Loading} /> } | |
| </Col> | |
| <Col xs={6} md={6} lg={6}> | |
| { this.state.sql_data ? <BarGraph data={this.state.sql_data} /> : <img src={Loading} /> } | |
| </Col> | |
| </Row> | |
| ) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment