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
Этот коммит содержится в:
Joram Wilander
2017-06-14 08:56:56 -04:00
коммит произвёл Harrison Healey
родитель 40efd8367a
Коммит 1138dd6770
29 изменённых файлов: 622 добавлений и 670 удалений

Просмотреть файл

@@ -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);
/*
* Object representing the config file
*/
config: PropTypes.object.isRequired,
this.state = {
config: AdminStore.getConfig()
};
actions: PropTypes.shape({
/*
* Function to get the config file
*/
getConfig: PropTypes.func.isRequired
}).isRequired
}
componentWillMount() {
AdminStore.addConfigChangeListener(this.handleConfigChange);
AsyncClient.getConfig();
}
componentWillUnmount() {
AdminStore.removeConfigChangeListener(this.handleConfigChange);
}
handleConfigChange() {
this.setState({
config: AdminStore.getConfig()
});
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'>