// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import React from 'react'; import * as Utils from 'utils/utils.jsx'; import AdminSettings from './admin_settings.jsx'; import BooleanSetting from './boolean_setting.jsx'; import DropdownSetting from './dropdown_setting.jsx'; import {FormattedMessage, FormattedHTMLMessage} from 'react-intl'; import SettingsGroup from './settings_group.jsx'; import TextSetting from './text_setting.jsx'; export default class LogSettings extends AdminSettings { constructor(props) { super(props); this.getConfigFromState = this.getConfigFromState.bind(this); this.renderSettings = this.renderSettings.bind(this); } getConfigFromState(config) { config.LogSettings.EnableConsole = this.state.enableConsole; config.LogSettings.ConsoleLevel = this.state.consoleLevel; config.LogSettings.EnableFile = this.state.enableFile; config.LogSettings.FileLevel = this.state.fileLevel; config.LogSettings.FileLocation = this.state.fileLocation; config.LogSettings.FileFormat = this.state.fileFormat; config.LogSettings.EnableWebhookDebugging = this.state.enableWebhookDebugging; config.LogSettings.EnableDiagnostics = this.state.enableDiagnostics; return config; } getStateFromConfig(config) { return { enableConsole: config.LogSettings.EnableConsole, consoleLevel: config.LogSettings.ConsoleLevel, enableFile: config.LogSettings.EnableFile, fileLevel: config.LogSettings.FileLevel, fileLocation: config.LogSettings.FileLocation, fileFormat: config.LogSettings.FileFormat, enableWebhookDebugging: config.LogSettings.EnableWebhookDebugging, enableDiagnostics: config.LogSettings.EnableDiagnostics }; } renderTitle() { return ( ); } renderSettings() { const logLevels = [ {value: 'DEBUG', text: 'DEBUG'}, {value: 'INFO', text: 'INFO'}, {value: 'ERROR', text: 'ERROR'} ]; return ( } helpText={ } value={this.state.enableConsole} onChange={this.handleChange} /> } value={this.state.consoleLevel} onChange={this.handleChange} disabled={!this.state.enableConsole} helpText={ } /> } helpText={ } value={this.state.enableFile} onChange={this.handleChange} /> } value={this.state.fileLevel} onChange={this.handleChange} disabled={!this.state.enableFile} helpText={ } /> } placeholder={Utils.localizeMessage('admin.log.locationPlaceholder', 'Enter your file location')} helpText={ } value={this.state.fileLocation} onChange={this.handleChange} disabled={!this.state.enableFile} /> } placeholder={Utils.localizeMessage('admin.log.formatPlaceholder', 'Enter your file format')} helpText={this.renderFileFormatHelpText()} value={this.state.fileFormat} onChange={this.handleChange} disabled={!this.state.enableFile} /> } helpText={ } value={this.state.enableWebhookDebugging} onChange={this.handleChange} /> } helpText={ } value={this.state.enableDiagnostics} onChange={this.handleChange} /> ); } renderFileFormatHelpText() { return (
{'%T'}
{'%D'}
{'%d'}
{'%L'}
{'%S'}
{'%M'}
); } }