summaryrefslogtreecommitdiffstats
path: root/webapp/components/admin_console/admin_console.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/components/admin_console/admin_console.jsx')
-rw-r--r--webapp/components/admin_console/admin_console.jsx49
1 files changed, 20 insertions, 29 deletions
diff --git a/webapp/components/admin_console/admin_console.jsx b/webapp/components/admin_console/admin_console.jsx
index b8250bab2..99256d7d4 100644
--- a/webapp/components/admin_console/admin_console.jsx
+++ b/webapp/components/admin_console/admin_console.jsx
@@ -6,46 +6,37 @@ import PropTypes from 'prop-types';
import 'bootstrap';
import AnnouncementBar from 'components/announcement_bar';
-import AdminStore from 'stores/admin_store.jsx';
-import * as AsyncClient from 'utils/async_client.jsx';
-
import AdminSidebar from './admin_sidebar.jsx';
export default class AdminConsole extends React.Component {
- static get propTypes() {
- return {
- children: PropTypes.node.isRequired
- };
- }
+ static propTypes = {
- constructor(props) {
- super(props);
+ /*
+ * Children components to render
+ */
+ children: PropTypes.node.isRequired,
- this.handleConfigChange = this.handleConfigChange.bind(this);
-
- this.state = {
- config: AdminStore.getConfig()
- };
- }
+ /*
+ * Object representing the config file
+ */
+ config: PropTypes.object.isRequired,
- componentWillMount() {
- AdminStore.addConfigChangeListener(this.handleConfigChange);
- AsyncClient.getConfig();
- }
+ actions: PropTypes.shape({
- componentWillUnmount() {
- AdminStore.removeConfigChangeListener(this.handleConfigChange);
+ /*
+ * Function to get the config file
+ */
+ getConfig: PropTypes.func.isRequired
+ }).isRequired
}
- handleConfigChange() {
- this.setState({
- config: AdminStore.getConfig()
- });
+ componentWillMount() {
+ this.props.actions.getConfig();
}
render() {
- const config = this.state.config;
- if (!config) {
+ const config = this.props.config;
+ if (Object.keys(config).length === 0) {
return <div/>;
}
if (config && Object.keys(config).length === 0 && config.constructor === 'Object') {
@@ -59,7 +50,7 @@ export default class AdminConsole extends React.Component {
// not every page in the system console will need the config, but the vast majority will
const children = React.cloneElement(this.props.children, {
- config: this.state.config
+ config
});
return (
<div className='admin-console__wrapper'>