2018-08-30 14:25:33 +00:00
|
|
|
import React, { Component, Fragment } from 'react';
|
|
|
|
import { HashRouter, Route } from 'react-router-dom';
|
|
|
|
import PropTypes from 'prop-types';
|
2018-09-19 15:58:55 +00:00
|
|
|
import LoadingBar from 'react-redux-loading-bar';
|
2018-08-30 14:25:33 +00:00
|
|
|
|
|
|
|
import 'react-table/react-table.css';
|
|
|
|
import '../ui/Tabler.css';
|
|
|
|
import '../ui/ReactTable.css';
|
|
|
|
import './index.css';
|
|
|
|
|
|
|
|
import Header from '../../containers/Header';
|
|
|
|
import Dashboard from '../../containers/Dashboard';
|
|
|
|
import Settings from '../../containers/Settings';
|
|
|
|
import Filters from '../../containers/Filters';
|
|
|
|
import Logs from '../../containers/Logs';
|
|
|
|
import Footer from '../ui/Footer';
|
2018-09-14 12:37:35 +00:00
|
|
|
import Toasts from '../Toasts';
|
2018-08-30 14:25:33 +00:00
|
|
|
|
|
|
|
import Status from '../ui/Status';
|
|
|
|
|
|
|
|
class App extends Component {
|
|
|
|
componentDidMount() {
|
|
|
|
this.props.getDnsStatus();
|
|
|
|
}
|
|
|
|
|
|
|
|
handleStatusChange = () => {
|
|
|
|
this.props.enableDns();
|
|
|
|
};
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const { dashboard } = this.props;
|
|
|
|
return (
|
|
|
|
<HashRouter hashType='noslash'>
|
|
|
|
<Fragment>
|
2018-09-19 15:58:55 +00:00
|
|
|
<LoadingBar className="loading-bar" updateTime={1000} />
|
2018-08-30 14:25:33 +00:00
|
|
|
<Route component={Header} />
|
|
|
|
<div className="container container--wrap">
|
|
|
|
{!dashboard.processing && !dashboard.isCoreRunning &&
|
|
|
|
<div className="row row-cards">
|
|
|
|
<div className="col-lg-12">
|
|
|
|
<Status handleStatusChange={this.handleStatusChange} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
{!dashboard.processing && dashboard.isCoreRunning &&
|
|
|
|
<Fragment>
|
|
|
|
<Route path="/" exact component={Dashboard} />
|
|
|
|
<Route path="/settings" component={Settings} />
|
|
|
|
<Route path="/filters" component={Filters} />
|
|
|
|
<Route path="/logs" component={Logs} />
|
|
|
|
</Fragment>
|
|
|
|
}
|
|
|
|
</div>
|
|
|
|
<Footer />
|
2018-09-14 12:37:35 +00:00
|
|
|
<Toasts />
|
2018-08-30 14:25:33 +00:00
|
|
|
</Fragment>
|
|
|
|
</HashRouter>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
App.propTypes = {
|
|
|
|
getDnsStatus: PropTypes.func,
|
|
|
|
enableDns: PropTypes.func,
|
|
|
|
dashboard: PropTypes.object,
|
|
|
|
isCoreRunning: PropTypes.bool,
|
2018-09-14 12:37:35 +00:00
|
|
|
error: PropTypes.string,
|
2018-08-30 14:25:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default App;
|