// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import $ from 'jquery';
import PropTypes from 'prop-types';
import React from 'react';
import {FormattedMessage} from 'react-intl';
import * as Utils from 'utils/utils.jsx';
import AdminSidebarCategory from 'components/admin_console/admin_sidebar_category.jsx';
import AdminSidebarHeader from 'components/admin_console/admin_sidebar_header';
import AdminSidebarSection from 'components/admin_console/admin_sidebar_section.jsx';
export default class AdminSidebar extends React.Component {
static get contextTypes() {
return {
router: PropTypes.object.isRequired,
};
}
static propTypes = {
license: PropTypes.object.isRequired,
config: PropTypes.object,
plugins: PropTypes.object,
buildEnterpriseReady: PropTypes.bool,
siteName: PropTypes.string,
actions: PropTypes.shape({
/*
* Function to get installed plugins
*/
getPlugins: PropTypes.func.isRequired,
}).isRequired,
}
static defaultProps = {
plugins: {},
}
componentDidMount() {
if (this.props.config.PluginSettings.Enable) {
this.props.actions.getPlugins();
}
this.updateTitle();
if (!Utils.isMobile()) {
$('.admin-sidebar .nav-pills__container').perfectScrollbar({
suppressScrollX: true,
});
}
}
componentDidUpdate() {
if (!Utils.isMobile()) {
$('.admin-sidebar .nav-pills__container').perfectScrollbar({
suppressScrollX: true,
});
}
}
updateTitle = () => {
let currentSiteName = '';
if (this.props.siteName) {
currentSiteName = ' - ' + this.props.siteName;
}
document.title = Utils.localizeMessage('sidebar_right_menu.console', 'System Console') + currentSiteName;
}
render() {
let oauthSettings = null;
let ldapSettings = null;
let samlSettings = null;
let clusterSettings = null;
let metricsSettings = null;
let complianceSettings = null;
let mfaSettings = null;
let messageExportSettings = null;
let complianceSection = null;
let license = null;
let audits = null;
let announcement = null;
if (this.props.buildEnterpriseReady) {
license = (