diff options
author | George Goldberg <george@gberg.me> | 2017-07-04 08:00:17 +0100 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-07-04 00:00:17 -0700 |
commit | 0a3bb8fdb10f2ce72e5e975a35fc7d22637265f9 (patch) | |
tree | 3a3c7dfed0830d9e3a945f862c60d99f15074ca1 /webapp/components/admin_console/configuration_settings.jsx | |
parent | f54aee1ef5466fdf11803cd75be3b7267e68540f (diff) | |
download | chat-0a3bb8fdb10f2ce72e5e975a35fc7d22637265f9.tar.gz chat-0a3bb8fdb10f2ce72e5e975a35fc7d22637265f9.tar.bz2 chat-0a3bb8fdb10f2ce72e5e975a35fc7d22637265f9.zip |
Refactor system console buttons into RequestButton component. (#6808)
Since I was going to make yet another button for the ElasticSearch test
config button, I refactored all of them to use a single common component
and tidied that component up and gave it some unit tests.
Diffstat (limited to 'webapp/components/admin_console/configuration_settings.jsx')
-rw-r--r-- | webapp/components/admin_console/configuration_settings.jsx | 76 |
1 files changed, 72 insertions, 4 deletions
diff --git a/webapp/components/admin_console/configuration_settings.jsx b/webapp/components/admin_console/configuration_settings.jsx index 449b4f549..72bd0e330 100644 --- a/webapp/components/admin_console/configuration_settings.jsx +++ b/webapp/components/admin_console/configuration_settings.jsx @@ -9,12 +9,12 @@ import ErrorStore from 'stores/error_store.jsx'; import {ErrorBarTypes} from 'utils/constants.jsx'; import * as Utils from 'utils/utils.jsx'; +import {invalidateAllCaches, reloadConfig} from 'actions/admin_actions.jsx'; import AdminSettings from './admin_settings.jsx'; import BooleanSetting from './boolean_setting.jsx'; import {ConnectionSecurityDropdownSettingWebserver} from './connection_security_dropdown_setting.jsx'; -import PurgeCachesButton from './purge_caches.jsx'; -import ReloadConfigButton from './reload_config.jsx'; import SettingsGroup from './settings_group.jsx'; +import RequestButton from './request_button/request_button'; import TextSetting from './text_setting.jsx'; import WebserverModeDropdownSetting from './webserver_mode_dropdown_setting.jsx'; @@ -83,6 +83,54 @@ export default class ConfigurationSettings extends AdminSettings { } renderSettings() { + const reloadConfigurationHelpText = ( + <FormattedMessage + id='admin.reload.reloadDescription' + defaultMessage='Deployments using multiple databases can switch from one master database to another without restarting the Mattermost server by updating "config.json" to the new desired configuration and using the {featureName} feature to load the new settings while the server is running. The administrator should then use the {recycleDatabaseConnections} feature to recycle the database connections based on the new settings.' + values={{ + featureName: ( + <b> + <FormattedMessage + id='admin.reload.reloadDescription.featureName' + defaultMessage='Reload Configuration from Disk' + /> + </b> + ), + recycleDatabaseConnections: ( + <a href='../advanced/database'> + <b> + <FormattedMessage + id='admin.reload.reloadDescription.recycleDatabaseConnections' + defaultMessage='Database > Recycle Database Connections' + /> + </b> + </a> + ) + }} + /> + ); + + let reloadConfigButton = <div/>; + if (global.window.mm_license.IsLicensed === 'true') { + reloadConfigButton = ( + <RequestButton + requestAction={reloadConfig} + helpText={reloadConfigurationHelpText} + buttonText={ + <FormattedMessage + id='admin.reload.button' + defaultMessage='Reload Configuration From Disk' + /> + } + showSuccessMessage={false} + errorMessage={{ + id: 'admin.reload.reloadFail', + defaultMessage: 'Reload unsuccessful: {error}' + }} + /> + ); + } + return ( <SettingsGroup> <div className='banner'> @@ -261,8 +309,28 @@ export default class ConfigurationSettings extends AdminSettings { onChange={this.handleChange} disabled={false} /> - <ReloadConfigButton/> - <PurgeCachesButton/> + {reloadConfigButton} + <RequestButton + requestAction={invalidateAllCaches} + helpText={ + <FormattedMessage + id='admin.purge.purgeDescription' + defaultMessage='This will purge all the in-memory caches for things like sessions, accounts, channels, etc. Deployments using High Availability will attempt to purge all the servers in the cluster. Purging the caches may adversely impact performance.' + /> + } + buttonText={ + <FormattedMessage + id='admin.purge.button' + defaultMessage='Purge All Caches' + /> + } + showSuccessMessage={false} + includeDetailedError={true} + errorMessage={{ + id: 'admin.purge.purgeFail', + defaultMessage: 'Purging unsuccessful: {error}' + }} + /> </SettingsGroup> ); } |