// 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} 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); this.state = Object.assign(this.state, { enableConsole: props.config.LogSettings.EnableConsole, consoleLevel: props.config.LogSettings.ConsoleLevel, enableFile: props.config.LogSettings.EnableFile, fileLevel: props.config.LogSettings.FileLevel, fileLocation: props.config.LogSettings.FileLocation, fileFormat: props.config.LogSettings.FileFormat, enableWebhookDebugging: props.config.LogSettings.EnableWebhookDebugging }); } 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; return config; } 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} /> ); } renderFileFormatHelpText() { return (
{'%T'}
{'%D'}
{'%d'}
{'%L'}
{'%S'}
{'%M'}
); } }