From ed9a2da83b3b77e7dd0314eaa92082ac8a2a9a9c Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Mon, 21 Sep 2015 15:11:56 -0700 Subject: Adding email to admin console --- .../components/admin_console/log_settings.jsx | 50 ++++++++++++++++++---- 1 file changed, 42 insertions(+), 8 deletions(-) (limited to 'web/react/components/admin_console/log_settings.jsx') diff --git a/web/react/components/admin_console/log_settings.jsx b/web/react/components/admin_console/log_settings.jsx index 4e3db8f68..2707ce6b6 100644 --- a/web/react/components/admin_console/log_settings.jsx +++ b/web/react/components/admin_console/log_settings.jsx @@ -12,13 +12,33 @@ export default class LogSettings extends React.Component { this.handleSubmit = this.handleSubmit.bind(this); this.state = { + consoleEnable: this.props.config.LogSettings.ConsoleEnable, + fileEnable: this.props.config.LogSettings.FileEnable, saveNeeded: false, serverError: null }; } - handleChange() { - this.setState({saveNeeded: true, serverError: this.state.serverError}); + handleChange(action) { + var s = {saveNeeded: true, serverError: this.state.serverError}; + + if (action === 'console_true') { + s.consoleEnable = true; + } + + if (action === 'console_false') { + s.consoleEnable = false; + } + + if (action === 'file_true') { + s.fileEnable = true; + } + + if (action === 'file_false') { + s.fileEnable = false; + } + + this.setState(s); } handleSubmit(e) { @@ -37,11 +57,21 @@ export default class LogSettings extends React.Component { config, () => { AsyncClient.getConfig(); - this.setState({serverError: null, saveNeeded: false}); + this.setState({ + consoleEnable: config.LogSettings.ConsoleEnable, + fileEnable: config.LogSettings.FileEnable, + serverError: null, + saveNeeded: false + }); $('#save-button').button('reset'); }, (err) => { - this.setState({serverError: err.message, saveNeeded: true}); + this.setState({ + consoleEnable: config.LogSettings.ConsoleEnable, + fileEnable: config.LogSettings.FileEnable, + serverError: err.message, + saveNeeded: true + }); $('#save-button').button('reset'); } ); @@ -81,7 +111,7 @@ export default class LogSettings extends React.Component { value='true' ref='consoleEnable' defaultChecked={this.props.config.LogSettings.ConsoleEnable} - onChange={this.handleChange} + onChange={this.handleChange.bind(this, 'console_true')} /> {'true'} @@ -91,7 +121,7 @@ export default class LogSettings extends React.Component { name='consoleEnable' value='false' defaultChecked={!this.props.config.LogSettings.ConsoleEnable} - onChange={this.handleChange} + onChange={this.handleChange.bind(this, 'console_false')} /> {'false'} @@ -113,6 +143,7 @@ export default class LogSettings extends React.Component { ref='consoleLevel' defaultValue={this.props.config.LogSettings.consoleLevel} onChange={this.handleChange} + disabled={!this.state.consoleEnable} > @@ -136,7 +167,7 @@ export default class LogSettings extends React.Component { ref='fileEnable' value='true' defaultChecked={this.props.config.LogSettings.FileEnable} - onChange={this.handleChange} + onChange={this.handleChange.bind(this, 'file_true')} /> {'true'} @@ -146,7 +177,7 @@ export default class LogSettings extends React.Component { name='fileEnable' value='false' defaultChecked={!this.props.config.LogSettings.FileEnable} - onChange={this.handleChange} + onChange={this.handleChange.bind(this, 'file_false')} /> {'false'} @@ -168,6 +199,7 @@ export default class LogSettings extends React.Component { ref='fileLevel' defaultValue={this.props.config.LogSettings.FileLevel} onChange={this.handleChange} + disabled={!this.state.fileEnable} > @@ -193,6 +225,7 @@ export default class LogSettings extends React.Component { placeholder='Enter your file location' defaultValue={this.props.config.LogSettings.FileLocation} onChange={this.handleChange} + disabled={!this.state.fileEnable} />

{'File to which log files are written. If blank, will be set to ./logs/mattermost.log. Log rotation is enabled and new files may be created in the same directory.'}

@@ -214,6 +247,7 @@ export default class LogSettings extends React.Component { placeholder='Enter your file format' defaultValue={this.props.config.LogSettings.FileFormat} onChange={this.handleChange} + disabled={!this.state.fileEnable} />

{'Format of log message output. If blank will be set to "[%D %T] [%L] %M", where:'} -- cgit v1.2.3-1-g7c22 From 88e5a71e8c93b495cedaa07931a4f8052d9f12ed Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 22 Sep 2015 12:12:50 -0700 Subject: Adding service settings to admin console --- .../components/admin_console/log_settings.jsx | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'web/react/components/admin_console/log_settings.jsx') diff --git a/web/react/components/admin_console/log_settings.jsx b/web/react/components/admin_console/log_settings.jsx index 2707ce6b6..d66801431 100644 --- a/web/react/components/admin_console/log_settings.jsx +++ b/web/react/components/admin_console/log_settings.jsx @@ -12,8 +12,8 @@ export default class LogSettings extends React.Component { this.handleSubmit = this.handleSubmit.bind(this); this.state = { - consoleEnable: this.props.config.LogSettings.ConsoleEnable, - fileEnable: this.props.config.LogSettings.FileEnable, + consoleEnable: this.props.config.LogSettings.EnableConsole, + fileEnable: this.props.config.LogSettings.EnableFile, saveNeeded: false, serverError: null }; @@ -46,9 +46,9 @@ export default class LogSettings extends React.Component { $('#save-button').button('loading'); var config = this.props.config; - config.LogSettings.ConsoleEnable = React.findDOMNode(this.refs.consoleEnable).checked; + config.LogSettings.EnableConsole = React.findDOMNode(this.refs.consoleEnable).checked; config.LogSettings.ConsoleLevel = React.findDOMNode(this.refs.consoleLevel).value; - config.LogSettings.FileEnable = React.findDOMNode(this.refs.fileEnable).checked; + config.LogSettings.EnableFile = React.findDOMNode(this.refs.fileEnable).checked; config.LogSettings.FileLevel = React.findDOMNode(this.refs.fileLevel).value; config.LogSettings.FileLocation = React.findDOMNode(this.refs.fileLocation).value.trim(); config.LogSettings.FileFormat = React.findDOMNode(this.refs.fileFormat).value.trim(); @@ -58,8 +58,8 @@ export default class LogSettings extends React.Component { () => { AsyncClient.getConfig(); this.setState({ - consoleEnable: config.LogSettings.ConsoleEnable, - fileEnable: config.LogSettings.FileEnable, + consoleEnable: config.LogSettings.EnableConsole, + fileEnable: config.LogSettings.EnableFile, serverError: null, saveNeeded: false }); @@ -67,8 +67,8 @@ export default class LogSettings extends React.Component { }, (err) => { this.setState({ - consoleEnable: config.LogSettings.ConsoleEnable, - fileEnable: config.LogSettings.FileEnable, + consoleEnable: config.LogSettings.EnableConsole, + fileEnable: config.LogSettings.EnableFile, serverError: err.message, saveNeeded: true }); @@ -110,7 +110,7 @@ export default class LogSettings extends React.Component { name='consoleEnable' value='true' ref='consoleEnable' - defaultChecked={this.props.config.LogSettings.ConsoleEnable} + defaultChecked={this.props.config.LogSettings.EnableConsole} onChange={this.handleChange.bind(this, 'console_true')} /> {'true'} @@ -120,7 +120,7 @@ export default class LogSettings extends React.Component { type='radio' name='consoleEnable' value='false' - defaultChecked={!this.props.config.LogSettings.ConsoleEnable} + defaultChecked={!this.props.config.LogSettings.EnableConsole} onChange={this.handleChange.bind(this, 'console_false')} /> {'false'} @@ -166,7 +166,7 @@ export default class LogSettings extends React.Component { name='fileEnable' ref='fileEnable' value='true' - defaultChecked={this.props.config.LogSettings.FileEnable} + defaultChecked={this.props.config.LogSettings.EnableFile} onChange={this.handleChange.bind(this, 'file_true')} /> {'true'} @@ -176,7 +176,7 @@ export default class LogSettings extends React.Component { type='radio' name='fileEnable' value='false' - defaultChecked={!this.props.config.LogSettings.FileEnable} + defaultChecked={!this.props.config.LogSettings.EnableFile} onChange={this.handleChange.bind(this, 'file_false')} /> {'false'} -- cgit v1.2.3-1-g7c22