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.
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
f54aee1ef5
Коммит
0a3bb8fdb1
@@ -3,6 +3,7 @@
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import {recycleDatabaseConnection} from 'actions/admin_actions.jsx';
|
||||
import * as Utils from 'utils/utils.jsx';
|
||||
|
||||
import AdminSettings from './admin_settings.jsx';
|
||||
@@ -11,7 +12,7 @@ import {FormattedMessage} from 'react-intl';
|
||||
import GeneratedSetting from './generated_setting.jsx';
|
||||
import SettingsGroup from './settings_group.jsx';
|
||||
import TextSetting from './text_setting.jsx';
|
||||
import RecycleDbButton from './recycle_db.jsx';
|
||||
import RequestButton from './request_button/request_button.jsx';
|
||||
|
||||
export default class DatabaseSettings extends AdminSettings {
|
||||
constructor(props) {
|
||||
@@ -58,6 +59,53 @@ export default class DatabaseSettings extends AdminSettings {
|
||||
renderSettings() {
|
||||
const dataSource = '**********' + this.state.dataSource.substring(this.state.dataSource.indexOf('@'));
|
||||
|
||||
let recycleDbButton = <div/>;
|
||||
if (global.window.mm_license.IsLicensed === 'true') {
|
||||
recycleDbButton = (
|
||||
<RequestButton
|
||||
requestAction={recycleDatabaseConnection}
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
id='admin.recycle.recycleDescription'
|
||||
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 {reloadConfiguration} feature to load the new settings while the server is running. The administrator should then use {featureName} feature to recycle the database connections based on the new settings.'
|
||||
values={{
|
||||
featureName: (
|
||||
<b>
|
||||
<FormattedMessage
|
||||
id='admin.recycle.recycleDescription.featureName'
|
||||
defaultMessage='Recycle Database Connections'
|
||||
/>
|
||||
</b>
|
||||
),
|
||||
reloadConfiguration: (
|
||||
<a href='../general/configuration'>
|
||||
<b>
|
||||
<FormattedMessage
|
||||
id='admin.recycle.recycleDescription.reloadConfiguration'
|
||||
defaultMessage='Configuration > Reload Configuration from Disk'
|
||||
/>
|
||||
</b>
|
||||
</a>
|
||||
)
|
||||
}}
|
||||
/>
|
||||
}
|
||||
buttonText={
|
||||
<FormattedMessage
|
||||
id='admin.recycle.button'
|
||||
defaultMessage='Recycle Database Connections'
|
||||
/>
|
||||
}
|
||||
showSuccessMessage={false}
|
||||
errorMessage={{
|
||||
id: 'admin.recycle.reloadFail',
|
||||
defaultMessage: 'Recycling unsuccessful: {error}'
|
||||
}}
|
||||
includeDetailedError={true}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<SettingsGroup>
|
||||
<p>
|
||||
@@ -183,7 +231,7 @@ export default class DatabaseSettings extends AdminSettings {
|
||||
value={this.state.trace}
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
<RecycleDbButton/>
|
||||
{recycleDbButton}
|
||||
</SettingsGroup>
|
||||
);
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user