import React, { Component, Fragment } from 'react'; import PropTypes from 'prop-types'; import 'whatwg-fetch'; import Statistics from './Statistics'; import Counters from './Counters'; import Clients from './Clients'; import QueriedDomains from './QueriedDomains'; import BlockedDomains from './BlockedDomains'; import PageTitle from '../ui/PageTitle'; import Loading from '../ui/Loading'; class Dashboard extends Component { componentDidMount() { this.getAllStats(); } getAllStats = () => { this.props.getStats(); this.props.getStatsHistory(); this.props.getTopStats(); } render() { const { dashboard } = this.props; const dashboardProcessing = dashboard.processing || dashboard.processingStats || dashboard.processingStatsHistory || dashboard.processingTopStats; const refreshFullButton = this.getAllStats()}>Refresh statistics; const refreshButton = this.getAllStats()} />; return ( {refreshFullButton} {dashboardProcessing && } {!dashboardProcessing && {dashboard.statsHistory && } {dashboard.stats && } {dashboard.topStats && } } ); } } Dashboard.propTypes = { getStats: PropTypes.func, getStatsHistory: PropTypes.func, getTopStats: PropTypes.func, disableDns: PropTypes.func, dashboard: PropTypes.object, isCoreRunning: PropTypes.bool, }; export default Dashboard;