mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* E10 - Add announcement bar feature * Updates per feedback * Add component tests and snapshots * Update snapshots * Updating color picker UI (#6543) * Add class to body tag when banner is not dismissable and clean up localstorage items when banner changes * Fixing links (#6544) * Updating UI for fixed error bar (#6552) * Truncating text on fixed banner (#6561) * Plt 3466 - Error bar link states (#6577) * Updating error bar hover state * Updating error bar link states
75 lines
2.0 KiB
JavaScript
75 lines
2.0 KiB
JavaScript
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
|
|
// See License.txt for license information.
|
|
|
|
import React from 'react';
|
|
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
|
|
};
|
|
}
|
|
|
|
constructor(props) {
|
|
super(props);
|
|
|
|
this.handleConfigChange = this.handleConfigChange.bind(this);
|
|
|
|
this.state = {
|
|
config: AdminStore.getConfig()
|
|
};
|
|
}
|
|
|
|
componentWillMount() {
|
|
AdminStore.addConfigChangeListener(this.handleConfigChange);
|
|
AsyncClient.getConfig();
|
|
}
|
|
|
|
componentWillUnmount() {
|
|
AdminStore.removeConfigChangeListener(this.handleConfigChange);
|
|
}
|
|
|
|
handleConfigChange() {
|
|
this.setState({
|
|
config: AdminStore.getConfig()
|
|
});
|
|
}
|
|
|
|
render() {
|
|
const config = this.state.config;
|
|
if (!config) {
|
|
return <div/>;
|
|
}
|
|
if (config && Object.keys(config).length === 0 && config.constructor === 'Object') {
|
|
return (
|
|
<div className='admin-console__wrapper'>
|
|
<AnnouncementBar/>
|
|
<div className='admin-console'/>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
// 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
|
|
});
|
|
return (
|
|
<div className='admin-console__wrapper'>
|
|
<AnnouncementBar/>
|
|
<div className='admin-console'>
|
|
<AdminSidebar/>
|
|
{children}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
}
|