diff options
Diffstat (limited to 'webapp/components/admin_console')
9 files changed, 151 insertions, 44 deletions
diff --git a/webapp/components/admin_console/admin_sidebar.jsx b/webapp/components/admin_console/admin_sidebar.jsx index f39bb8b6b..25a06cecf 100644 --- a/webapp/components/admin_console/admin_sidebar.jsx +++ b/webapp/components/admin_console/admin_sidebar.jsx @@ -192,6 +192,7 @@ export default class AdminSidebar extends React.Component { let ldapSettings = null; let samlSettings = null; let clusterSettings = null; + let metricsSettings = null; let complianceSettings = null; let license = null; @@ -241,6 +242,20 @@ export default class AdminSidebar extends React.Component { ); } + if (global.window.mm_license.Metrics === 'true') { + metricsSettings = ( + <AdminSidebarSection + name='metrics' + title={ + <FormattedMessage + id='admin.sidebar.metrics' + defaultMessage='Performance Monitoring (Beta)' + /> + } + /> + ); + } + if (global.window.mm_license.SAML === 'true') { samlSettings = ( <AdminSidebarSection @@ -716,6 +731,7 @@ export default class AdminSidebar extends React.Component { } /> {clusterSettings} + {metricsSettings} </AdminSidebarSection> </AdminSidebarCategory> {this.renderTeams()} diff --git a/webapp/components/admin_console/cluster_settings.jsx b/webapp/components/admin_console/cluster_settings.jsx index 8aab905e4..bbd135e50 100644 --- a/webapp/components/admin_console/cluster_settings.jsx +++ b/webapp/components/admin_console/cluster_settings.jsx @@ -60,7 +60,7 @@ export default class ClusterSettings extends AdminSettings { ); } - overrideHandleChange = (id, value) => { + overrideHandleChange(id, value) { this.setState({ showWarning: true }); @@ -185,4 +185,4 @@ export default class ClusterSettings extends AdminSettings { </SettingsGroup> ); } -}
\ No newline at end of file +} diff --git a/webapp/components/admin_console/cluster_table.jsx b/webapp/components/admin_console/cluster_table.jsx index 4aca796a0..0a2755c4a 100644 --- a/webapp/components/admin_console/cluster_table.jsx +++ b/webapp/components/admin_console/cluster_table.jsx @@ -176,4 +176,4 @@ export default class ClusterTable extends React.Component { </div> ); } -}
\ No newline at end of file +} diff --git a/webapp/components/admin_console/cluster_table_container.jsx b/webapp/components/admin_console/cluster_table_container.jsx index 5dad56469..aad5753b7 100644 --- a/webapp/components/admin_console/cluster_table_container.jsx +++ b/webapp/components/admin_console/cluster_table_container.jsx @@ -18,7 +18,7 @@ export default class ClusterTableContainer extends React.Component { }; } - load = () => { + load() { Client.getClusterStatus( (data) => { this.setState({ @@ -44,7 +44,7 @@ export default class ClusterTableContainer extends React.Component { } } - reload = (e) => { + reload(e) { if (e) { e.preventDefault(); } @@ -68,4 +68,4 @@ export default class ClusterTableContainer extends React.Component { /> ); } -}
\ No newline at end of file +} diff --git a/webapp/components/admin_console/file_upload_setting.jsx b/webapp/components/admin_console/file_upload_setting.jsx index a7df16c0a..0c1efc168 100644 --- a/webapp/components/admin_console/file_upload_setting.jsx +++ b/webapp/components/admin_console/file_upload_setting.jsx @@ -108,7 +108,7 @@ export default class FileUploadSetting extends Setting { disabled={!this.state.fileSelected} onClick={this.handleSubmit} ref='upload_button' - data-loading-text={`<span class=\'glyphicon glyphicon-refresh glyphicon-refresh-animate\'></span> ${this.props.uploadingText}`} + data-loading-text={`<span class='glyphicon glyphicon-refresh glyphicon-refresh-animate'></span> ${this.props.uploadingText}`} > <FormattedMessage id='admin.file_upload.uploadFile' diff --git a/webapp/components/admin_console/logs.jsx b/webapp/components/admin_console/logs.jsx index ad0277b7f..8dc0c1e2e 100644 --- a/webapp/components/admin_console/logs.jsx +++ b/webapp/components/admin_console/logs.jsx @@ -26,6 +26,12 @@ export default class Logs extends React.Component { AsyncClient.getLogs(); } + componentDidUpdate() { + // Scroll Down to get the latest logs + var node = this.refs.logPanel; + node.scrollTop = node.scrollHeight; + } + componentWillUnmount() { AdminStore.removeLogChangeListener(this.onLogListenerChange); } @@ -93,7 +99,10 @@ export default class Logs extends React.Component { defaultMessage='Reload' /> </button> - <div className='log__panel'> + <div + ref='logPanel' + className='log__panel' + > {content} </div> </div> diff --git a/webapp/components/admin_console/metrics_settings.jsx b/webapp/components/admin_console/metrics_settings.jsx new file mode 100644 index 000000000..dd031047e --- /dev/null +++ b/webapp/components/admin_console/metrics_settings.jsx @@ -0,0 +1,96 @@ +// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import React from 'react'; + +import AdminSettings from './admin_settings.jsx'; +import BooleanSetting from './boolean_setting.jsx'; +import TextSetting from './text_setting.jsx'; + +import {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; +import SettingsGroup from './settings_group.jsx'; + +import * as Utils from 'utils/utils.jsx'; + +export default class MetricsSettings extends AdminSettings { + constructor(props) { + super(props); + + this.getConfigFromState = this.getConfigFromState.bind(this); + this.renderSettings = this.renderSettings.bind(this); + } + + getConfigFromState(config) { + config.MetricsSettings.Enable = this.state.enable; + config.MetricsSettings.ListenAddress = this.state.listenAddress; + + return config; + } + + getStateFromConfig(config) { + const settings = config.MetricsSettings; + + return { + enable: settings.Enable, + listenAddress: settings.ListenAddress + }; + } + + renderTitle() { + return ( + <h3> + <FormattedMessage + id='admin.advance.metrics' + defaultMessage='Performance Monitoring (Beta)' + /> + </h3> + ); + } + + renderSettings() { + const licenseEnabled = global.window.mm_license.IsLicensed === 'true' && global.window.mm_license.Metrics === 'true'; + if (!licenseEnabled) { + return null; + } + + return ( + <SettingsGroup> + <BooleanSetting + id='enable' + label={ + <FormattedMessage + id='admin.metrics.enableTitle' + defaultMessage='Enable Performance Monitoring:' + /> + } + helpText={ + <FormattedHTMLMessage + id='admin.metrics.enableDescription' + defaultMessage='When true, Mattermost will enable performance monitoring collection and profiling. Please see <a href="http://docs.mattermost.com/deployment/metrics.html" target="_blank">documentation</a> to learn more about configuring performance monitoring for Mattermost.' + /> + } + value={this.state.enable} + onChange={this.handleChange} + /> + <TextSetting + id='listenAddress' + label={ + <FormattedMessage + id='admin.metrics.listenAddressTitle' + defaultMessage='Listen Address:' + /> + } + placeholder={Utils.localizeMessage('admin.metrics.listenAddressEx', 'Ex ":8067"')} + helpText={ + <FormattedMessage + id='admin.metrics.listenAddressDesc' + defaultMessage='The address the server will listen on to expose performance metrics.' + /> + } + value={this.state.listenAddress} + onChange={this.handleChange} + /> + </SettingsGroup> + ); + } +} diff --git a/webapp/components/admin_console/users_and_teams_settings.jsx b/webapp/components/admin_console/users_and_teams_settings.jsx index dd19005c8..2cb5b4e51 100644 --- a/webapp/components/admin_console/users_and_teams_settings.jsx +++ b/webapp/components/admin_console/users_and_teams_settings.jsx @@ -32,6 +32,7 @@ export default class UsersAndTeamsSettings extends AdminSettings { config.TeamSettings.RestrictCreationToDomains = this.state.restrictCreationToDomains; config.TeamSettings.RestrictDirectMessage = this.state.restrictDirectMessage; config.TeamSettings.MaxChannelsPerTeam = this.parseIntNonZero(this.state.maxChannelsPerTeam, Constants.DEFAULT_MAX_CHANNELS_PER_TEAM); + config.TeamSettings.MaxNotificationsPerChannel = this.parseIntNonZero(this.state.maxNotificationsPerChannel, Constants.DEFAULT_MAX_NOTIFICATIONS_PER_CHANNEL); return config; } @@ -43,7 +44,8 @@ export default class UsersAndTeamsSettings extends AdminSettings { maxUsersPerTeam: config.TeamSettings.MaxUsersPerTeam, restrictCreationToDomains: config.TeamSettings.RestrictCreationToDomains, restrictDirectMessage: config.TeamSettings.RestrictDirectMessage, - maxChannelsPerTeam: config.TeamSettings.MaxChannelsPerTeam + maxChannelsPerTeam: config.TeamSettings.MaxChannelsPerTeam, + maxNotificationsPerChannel: config.TeamSettings.MaxNotificationsPerChannel }; } @@ -132,6 +134,24 @@ export default class UsersAndTeamsSettings extends AdminSettings { onChange={this.handleChange} /> <TextSetting + id='maxNotificationsPerChannel' + label={ + <FormattedMessage + id='admin.team.maxNotificationsPerChannelTitle' + defaultMessage='Max Notifications Per Channel:' + /> + } + placeholder={Utils.localizeMessage('admin.team.maxNotificationsPerChannelExample', 'Ex "1000"')} + helpText={ + <FormattedMessage + id='admin.team.maxNotificationsPerChannelDescription' + defaultMessage='Maximum total number of users in a channel before users typing messages, @all, @here, and @channel no longer send notifications because of performance.' + /> + } + value={this.state.maxNotificationsPerChannel} + onChange={this.handleChange} + /> + <TextSetting id='restrictCreationToDomains' label={ <FormattedMessage diff --git a/webapp/components/admin_console/webrtc_settings.jsx b/webapp/components/admin_console/webrtc_settings.jsx index cea8e2226..995a02a0c 100644 --- a/webapp/components/admin_console/webrtc_settings.jsx +++ b/webapp/components/admin_console/webrtc_settings.jsx @@ -15,23 +15,10 @@ export default class WebrtcSettings extends AdminSettings { constructor(props) { super(props); - this.canSave = this.canSave.bind(this); - this.handleAgreeChange = this.handleAgreeChange.bind(this); - this.getConfigFromState = this.getConfigFromState.bind(this); this.renderSettings = this.renderSettings.bind(this); } - canSave() { - return !this.state.enableWebrtc || this.state.agree; - } - - handleAgreeChange(e) { - this.setState({ - agree: e.target.checked - }); - } - getConfigFromState(config) { config.WebrtcSettings.Enable = this.state.enableWebrtc; config.WebrtcSettings.GatewayWebsocketUrl = this.state.gatewayWebsocketUrl; @@ -57,8 +44,7 @@ export default class WebrtcSettings extends AdminSettings { stunURI: settings.StunURI, turnURI: settings.TurnURI, turnUsername: settings.TurnUsername, - turnSharedKey: settings.TurnSharedKey, - agree: settings.Enable + turnSharedKey: settings.TurnSharedKey }; } @@ -74,25 +60,6 @@ export default class WebrtcSettings extends AdminSettings { } renderSettings() { - const tosCheckbox = ( - <div className='form-group'> - <div className='col-sm-4'/> - <div className='col-sm-8'> - <input - type='checkbox' - ref='agree' - checked={this.state.agree} - onChange={this.handleAgreeChange} - disabled={!this.state.enableWebrtc} - /> - <FormattedHTMLMessage - id='admin.webrtc.agree' - defaultMessage=' I understand and accept the Mattermost Hosted WebRTC Service <a href="https://about.mattermost.com/webrtc-terms/" target="_blank">Terms of Service</a> and <a href="https://about.mattermost.com/webrtc-privacy/" target="_blank">Privacy Policy</a>.' - /> - </div> - </div> - ); - return ( <SettingsGroup> <BooleanSetting @@ -112,7 +79,6 @@ export default class WebrtcSettings extends AdminSettings { value={this.state.enableWebrtc} onChange={this.handleChange} /> - {tosCheckbox} <TextSetting id='gatewayWebsocketUrl' label={ |