diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-06-14 08:56:56 -0400 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-06-14 08:56:56 -0400 |
commit | 1138dd67705829a6af0d6c610cf3dbe09082187c (patch) | |
tree | 23bdc3db76221bead172be1c51eb52a4987636f1 /webapp/components/admin_console/admin_console.jsx | |
parent | 40efd8367a85e3333e9b7cc45c390259d412088c (diff) | |
download | chat-1138dd67705829a6af0d6c610cf3dbe09082187c.tar.gz chat-1138dd67705829a6af0d6c610cf3dbe09082187c.tar.bz2 chat-1138dd67705829a6af0d6c610cf3dbe09082187c.zip |
PLT-6657 Move system console to use v4 endpoints and redux (#6572)
* Move system console to use v4 endpoints and redux
* Rename logs dir to get past gitignore
* Fix test email
* Update brand unit test
* Updates per feedback
Diffstat (limited to 'webapp/components/admin_console/admin_console.jsx')
-rw-r--r-- | webapp/components/admin_console/admin_console.jsx | 49 |
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'> |