From da0747ac7a3c8d3ef8eb2620f52fe5d1fd355a12 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 6 Jul 2016 12:04:22 -0400 Subject: Adding webserver mode to the system console. Automatic enabling of gzip on existing servers (#3458) --- .../admin_console/configuration_settings.jsx | 12 ++- .../webserver_mode_dropdown_setting.jsx | 101 +++++++++++++++++++++ webapp/i18n/en.json | 8 ++ 3 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 webapp/components/admin_console/webserver_mode_dropdown_setting.jsx (limited to 'webapp') diff --git a/webapp/components/admin_console/configuration_settings.jsx b/webapp/components/admin_console/configuration_settings.jsx index 65cec3027..4f88a1954 100644 --- a/webapp/components/admin_console/configuration_settings.jsx +++ b/webapp/components/admin_console/configuration_settings.jsx @@ -10,6 +10,7 @@ import {FormattedMessage} from 'react-intl'; import SettingsGroup from './settings_group.jsx'; import TextSetting from './text_setting.jsx'; import ReloadConfigButton from './reload_config.jsx'; +import WebserverModeDropdownSetting from './webserver_mode_dropdown_setting.jsx'; export default class ConfigurationSettings extends AdminSettings { constructor(props) { @@ -20,7 +21,8 @@ export default class ConfigurationSettings extends AdminSettings { this.renderSettings = this.renderSettings.bind(this); this.state = Object.assign(this.state, { - listenAddress: props.config.ServiceSettings.ListenAddress + listenAddress: props.config.ServiceSettings.ListenAddress, + webserverMode: props.config.ServiceSettings.WebserverMode }); } @@ -32,6 +34,7 @@ export default class ConfigurationSettings extends AdminSettings { getConfigFromState(config) { config.ServiceSettings.ListenAddress = this.state.listenAddress; + config.ServiceSettings.WebserverMode = this.state.webserverMode; return config; } @@ -68,8 +71,13 @@ export default class ConfigurationSettings extends AdminSettings { value={this.state.listenAddress} onChange={this.handleChange} /> + ); } -} \ No newline at end of file +} diff --git a/webapp/components/admin_console/webserver_mode_dropdown_setting.jsx b/webapp/components/admin_console/webserver_mode_dropdown_setting.jsx new file mode 100644 index 000000000..9581816f1 --- /dev/null +++ b/webapp/components/admin_console/webserver_mode_dropdown_setting.jsx @@ -0,0 +1,101 @@ +// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import React from 'react'; +import * as Utils from 'utils/utils.jsx'; + +import DropdownSetting from './dropdown_setting.jsx'; +import {FormattedMessage} from 'react-intl'; + +const WEBSERVER_MODE_HELP_TEXT = ( +
+ + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+

+ +

+
+); + +export default class WebserverModeDropdownSetting extends React.Component { + render() { + return ( + + } + value={this.props.value} + onChange={this.props.onChange} + disabled={this.props.disabled} + helpText={WEBSERVER_MODE_HELP_TEXT} + /> + ); + } +} +WebserverModeDropdownSetting.defaultProps = { +}; + +WebserverModeDropdownSetting.propTypes = { + value: React.PropTypes.string.isRequired, + onChange: React.PropTypes.func.isRequired, + disabled: React.PropTypes.bool.isRequired +}; diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json index c3bb3112f..34dbc4996 100644 --- a/webapp/i18n/en.json +++ b/webapp/i18n/en.json @@ -691,6 +691,14 @@ "admin.user_item.switchToEmail": "Switch to Email/Password", "admin.user_item.sysAdmin": "System Admin", "admin.user_item.teamAdmin": "Team Admin", + "admin.webserverModeGzip": "gzip", + "admin.webserverModeGzipDescription": "The Mattermost server will serve static files compressed with gzip.", + "admin.webserverModeUncompressed": "Uncompressed", + "admin.webserverModeUncompressedDescription": "The Mattermost server will serve static files uncompressed.", + "admin.webserverModeDisabled": "Disabled", + "admin.webserverModeDisabledDescription": "The Mattermost server will not serve static files.", + "admin.webserverModeHelpText": "gzip compression applies to static content files. It is recommended to enable gzip to improve performance unless your environment has specific restrictions, such as a web proxy that distributes gzip files poorly. This setting requires a server restart to take effect.", + "admin.webserverModeTitle": "Webserver Mode:", "analytics.chart.loading": "Loading...", "analytics.chart.meaningful": "Not enough data for a meaningful representation.", "analytics.system.activeUsers": "Active Users With Posts", -- cgit v1.2.3-1-g7c22