summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/react/components/admin_console/admin_controller.jsx49
-rw-r--r--web/react/components/admin_console/admin_sidebar.jsx154
-rw-r--r--web/react/components/admin_console/admin_sidebar_header.jsx67
-rw-r--r--web/react/components/admin_console/log_settings.jsx261
-rw-r--r--web/react/components/admin_console/logs.jsx2
-rw-r--r--web/react/stores/admin_store.jsx30
-rw-r--r--web/react/utils/async_client.jsx26
-rw-r--r--web/react/utils/client.jsx31
8 files changed, 489 insertions, 131 deletions
diff --git a/web/react/components/admin_console/admin_controller.jsx b/web/react/components/admin_console/admin_controller.jsx
index 68984c9e0..7593e50a4 100644
--- a/web/react/components/admin_console/admin_controller.jsx
+++ b/web/react/components/admin_console/admin_controller.jsx
@@ -1,36 +1,63 @@
// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.
+var Navbar = require('../../components/navbar.jsx');
var AdminSidebar = require('./admin_sidebar.jsx');
-var EmailTab = require('./email_settings.jsx');
-var JobsTab = require('./jobs_settings.jsx');
+var AdminStore = require('../../stores/admin_store.jsx');
+var AsyncClient = require('../../utils/async_client.jsx');
+var LoadingScreen = require('../loading_screen.jsx');
+
+var EmailSettingsTab = require('./email_settings.jsx');
+var JobsSettingsTab = require('./jobs_settings.jsx');
+var LogSettingsTab = require('./log_settings.jsx');
var LogsTab = require('./logs.jsx');
-var Navbar = require('../../components/navbar.jsx');
export default class AdminController extends React.Component {
constructor(props) {
super(props);
this.selectTab = this.selectTab.bind(this);
+ this.onConfigListenerChange = this.onConfigListenerChange.bind(this);
this.state = {
+ config: null,
selected: 'email_settings'
};
}
+ componentDidMount() {
+ AdminStore.addConfigChangeListener(this.onConfigListenerChange);
+ AsyncClient.getConfig();
+ }
+
+ componentWillUnmount() {
+ AdminStore.removeConfigChangeListener(this.onConfigListenerChange);
+ }
+
+ onConfigListenerChange() {
+ this.setState({
+ config: AdminStore.getConfig(),
+ selected: this.state.selected
+ });
+ }
+
selectTab(tab) {
this.setState({selected: tab});
}
render() {
- var tab = '';
-
- if (this.state.selected === 'email_settings') {
- tab = <EmailTab />;
- } else if (this.state.selected === 'job_settings') {
- tab = <JobsTab />;
- } else if (this.state.selected === 'logs') {
- tab = <LogsTab />;
+ var tab = <LoadingScreen />;
+
+ if (this.state.config != null) {
+ if (this.state.selected === 'email_settings') {
+ tab = <EmailSettingsTab config={this.state.config} />;
+ } else if (this.state.selected === 'job_settings') {
+ tab = <JobsSettingsTab config={this.state.config} />;
+ } else if (this.state.selected === 'logs') {
+ tab = <LogsTab />;
+ } else if (this.state.selected === 'log_settings') {
+ tab = <LogSettingsTab config={this.state.config} />;
+ }
}
return (
diff --git a/web/react/components/admin_console/admin_sidebar.jsx b/web/react/components/admin_console/admin_sidebar.jsx
index a04bceef5..855da398b 100644
--- a/web/react/components/admin_console/admin_sidebar.jsx
+++ b/web/react/components/admin_console/admin_sidebar.jsx
@@ -27,36 +27,36 @@ export default class AdminSidebar extends React.Component {
}
componentDidMount() {
- $('.nav__menu-item').on('click', function clickme(e) {
- e.preventDefault();
- $(this).closest('.sidebar--collapsable').find('.nav__menu-item').removeClass('active');
- $(this).addClass('active');
- $(this).closest('.sidebar--collapsable').find('.nav__sub-menu').addClass('hide');
- $(this).next('.nav__sub-menu').removeClass('hide');
- });
+ // $('.nav__menu-item').on('click', function clickme(e) {
+ // e.preventDefault();
+ // $(this).closest('.sidebar--collapsable').find('.nav__menu-item').removeClass('active');
+ // $(this).addClass('active');
+ // $(this).closest('.sidebar--collapsable').find('.nav__sub-menu').addClass('hide');
+ // $(this).next('.nav__sub-menu').removeClass('hide');
+ // });
- $('.nav__sub-menu a').on('click', function clickme(e) {
- e.preventDefault();
- $(this).closest('.nav__sub-menu').find('a').removeClass('active');
- $(this).addClass('active');
- });
+ // $('.nav__sub-menu a').on('click', function clickme(e) {
+ // e.preventDefault();
+ // $(this).closest('.nav__sub-menu').find('a').removeClass('active');
+ // $(this).addClass('active');
+ // });
- $('.nav__sub-menu-item').on('click', function clickme(e) {
- e.preventDefault();
- $(this).closest('.sidebar--collapsable').find('.nav__inner-menu').addClass('hide');
- $(this).closest('li').next('li').find('.nav__inner-menu').removeClass('hide');
- $(this).closest('li').next('li').find('.nav__inner-menu li:first a').addClass('active');
- });
+ // $('.nav__sub-menu-item').on('click', function clickme(e) {
+ // e.preventDefault();
+ // $(this).closest('.sidebar--collapsable').find('.nav__inner-menu').addClass('hide');
+ // $(this).closest('li').next('li').find('.nav__inner-menu').removeClass('hide');
+ // $(this).closest('li').next('li').find('.nav__inner-menu li:first a').addClass('active');
+ // });
- $('.nav__inner-menu a').on('click', function clickme() {
- $(this).closest('.nav__inner-menu').closest('li').prev('li').find('a').addClass('active');
- });
+ // $('.nav__inner-menu a').on('click', function clickme() {
+ // $(this).closest('.nav__inner-menu').closest('li').prev('li').find('a').addClass('active');
+ // });
- $('.nav__sub-menu .menu__close').on('click', function close() {
- var menuItem = $(this).closest('li');
- menuItem.next('li').remove();
- menuItem.remove();
- });
+ // $('.nav__sub-menu .menu__close').on('click', function close() {
+ // var menuItem = $(this).closest('li');
+ // menuItem.next('li').remove();
+ // menuItem.remove();
+ // });
}
render() {
@@ -69,10 +69,6 @@ export default class AdminSidebar extends React.Component {
/>
<ul className='nav nav-pills nav-stacked'>
<li>
- <a href='#'
- className='nav__menu-item active'
- >
- <span className='icon fa fa-gear'></span> <span>{'Basic Settings'}</span></a>
<ul className='nav nav__sub-menu'>
<li>
<a
@@ -86,110 +82,30 @@ export default class AdminSidebar extends React.Component {
<li>
<a
href='#'
- className={this.isSelected('logs')}
- onClick={this.handleClick.bind(null, 'logs')}
+ className={this.isSelected('log_settings')}
+ onClick={this.handleClick.bind(null, 'log_settings')}
>
- {'Logs'}
+ {'Log Settings'}
</a>
</li>
- </ul>
- </li>
- <li>
- <a
- href='#'
- className='nav__menu-item'
- >
- <span className='icon fa fa-gear'></span> <span>{'Jobs'}</span>
- </a>
- <ul className='nav nav__sub-menu hide'>
<li>
<a
href='#'
- className={this.isSelected('job_settings')}
- onClick={this.handleClick.bind(null, 'job_settings')}
+ className={this.isSelected('logs')}
+ onClick={this.handleClick.bind(null, 'logs')}
>
- {'Job Settings'}
+ {'Logs'}
</a>
</li>
- </ul>
- </li>
- <li>
- <a
- href='#'
- className='nav__menu-item'
- >
- <span className='icon fa fa-gear'></span>
- <span>{'Team Settings (306)'}</span>
- <span className='menu-icon--right'>
- <i className='fa fa-plus'></i>
- </span>
- </a>
- <ul className='nav nav__sub-menu hide'>
- <li>
- <a
- href='#'
- className='nav__sub-menu-item active'
- >
- {'Adal '}
- <span className='menu-icon--right menu__close'>{'x'}</span>
- </a>
- </li>
- <li>
- <ul className='nav nav__inner-menu'>
- <li>
- <a
- href='#'
- className='active'
- >
- {'- Users'}
- </a>
- </li>
- <li><a href='#'>{'- View Statistics'}</a></li>
- <li>
- <a href='#'>
- {'- View Audit Log'}
- <span className='badge pull-right small'>{'1'}</span>
- </a>
- </li>
- </ul>
- </li>
<li>
<a
href='#'
- className='nav__sub-menu-item'
+ className={this.isSelected('job_settings')}
+ onClick={this.handleClick.bind(null, 'job_settings')}
>
- {'Boole '}
- <span className='menu-icon--right menu__close'>{'x'}</span>
+ {'Job Settings'}
</a>
</li>
- <li>
- <ul className='nav nav__inner-menu hide'>
- <li>
- <a
- href='#'
- className='active'
- >
- {'- Users'}
- </a>
- </li>
- <li><a href='#'>{'- View Statistics'}</a></li>
- <li>
- <a href='#'>
- {'- View Audit Log'}
- <span className='badge pull-right small'>{'1'}</span>
- </a>
- </li>
- </ul>
- </li>
- <li>
- <span
- data-toggle='modal'
- data-target='#select-team'
- className='nav-more'
- >
- {'Select a team'}
- </span>
- </li>
</ul>
</li>
</ul>
diff --git a/web/react/components/admin_console/admin_sidebar_header.jsx b/web/react/components/admin_console/admin_sidebar_header.jsx
new file mode 100644
index 000000000..959411f1e
--- /dev/null
+++ b/web/react/components/admin_console/admin_sidebar_header.jsx
@@ -0,0 +1,67 @@
+// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+var NavbarDropdown = require('./navbar_dropdown.jsx');
+var UserStore = require('../stores/user_store.jsx');
+
+export default class SidebarHeader extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.toggleDropdown = this.toggleDropdown.bind(this);
+
+ this.state = {};
+ }
+ toggleDropdown() {
+ if (this.refs.dropdown.blockToggle) {
+ this.refs.dropdown.blockToggle = false;
+ return;
+ }
+ $('.team__header').find('.dropdown-toggle').dropdown('toggle');
+ }
+ render() {
+ var me = UserStore.getCurrentUser();
+ var profilePicture = null;
+
+ if (!me) {
+ return null;
+ }
+
+ if (me.last_picture_update) {
+ profilePicture = (
+ <img
+ className='user__picture'
+ src={'/api/v1/users/' + me.id + '/image?time=' + me.update_at}
+ />
+ );
+ }
+
+ return (
+ <div className='team__header theme'>
+ <a
+ href='#'
+ onClick={this.toggleDropdown}
+ >
+ {profilePicture}
+ <div className='header__info'>
+ <div className='user__name'>{'@' + me.username}</div>
+ <div className='team__name'>{this.props.teamDisplayName}</div>
+ </div>
+ </a>
+ <NavbarDropdown
+ ref='dropdown'
+ teamType={this.props.teamType}
+ />
+ </div>
+ );
+ }
+}
+
+SidebarHeader.defaultProps = {
+ teamDisplayName: global.window.config.SiteName,
+ teamType: ''
+};
+SidebarHeader.propTypes = {
+ teamDisplayName: React.PropTypes.string,
+ teamType: React.PropTypes.string
+};
diff --git a/web/react/components/admin_console/log_settings.jsx b/web/react/components/admin_console/log_settings.jsx
new file mode 100644
index 000000000..4e3db8f68
--- /dev/null
+++ b/web/react/components/admin_console/log_settings.jsx
@@ -0,0 +1,261 @@
+// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+var Client = require('../../utils/client.jsx');
+var AsyncClient = require('../../utils/async_client.jsx');
+
+export default class LogSettings extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.handleChange = this.handleChange.bind(this);
+ this.handleSubmit = this.handleSubmit.bind(this);
+
+ this.state = {
+ saveNeeded: false,
+ serverError: null
+ };
+ }
+
+ handleChange() {
+ this.setState({saveNeeded: true, serverError: this.state.serverError});
+ }
+
+ handleSubmit(e) {
+ e.preventDefault();
+ $('#save-button').button('loading');
+
+ var config = this.props.config;
+ config.LogSettings.ConsoleEnable = 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.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();
+
+ Client.saveConfig(
+ config,
+ () => {
+ AsyncClient.getConfig();
+ this.setState({serverError: null, saveNeeded: false});
+ $('#save-button').button('reset');
+ },
+ (err) => {
+ this.setState({serverError: err.message, saveNeeded: true});
+ $('#save-button').button('reset');
+ }
+ );
+ }
+
+ render() {
+ var serverError = '';
+ if (this.state.serverError) {
+ serverError = <div className='form-group has-error'><label className='control-label'>{this.state.serverError}</label></div>;
+ }
+
+ var saveClass = 'btn';
+ if (this.state.saveNeeded) {
+ saveClass = 'btn btn-primary';
+ }
+
+ return (
+ <div className='wrapper--fixed'>
+ <h3>{'Log Settings'}</h3>
+ <form
+ className='form-horizontal'
+ role='form'
+ >
+
+ <div className='form-group'>
+ <label
+ className='control-label col-sm-4'
+ htmlFor='consoleEnable'
+ >
+ {'Log To the Console: '}
+ </label>
+ <div className='col-sm-8'>
+ <label className='radio-inline'>
+ <input
+ type='radio'
+ name='consoleEnable'
+ value='true'
+ ref='consoleEnable'
+ defaultChecked={this.props.config.LogSettings.ConsoleEnable}
+ onChange={this.handleChange}
+ />
+ {'true'}
+ </label>
+ <label className='radio-inline'>
+ <input
+ type='radio'
+ name='consoleEnable'
+ value='false'
+ defaultChecked={!this.props.config.LogSettings.ConsoleEnable}
+ onChange={this.handleChange}
+ />
+ {'false'}
+ </label>
+ <p className='help-text'>{'Typically set to false in production. Developers may set this field to true to output log messages to console based on the console level option. If true then the server will output messages to the standard output stream (stdout).'}</p>
+ </div>
+ </div>
+
+ <div className='form-group'>
+ <label
+ className='control-label col-sm-4'
+ htmlFor='consoleLevel'
+ >
+ {'Console Log Level:'}
+ </label>
+ <div className='col-sm-8'>
+ <select
+ className='form-control'
+ id='consoleLevel'
+ ref='consoleLevel'
+ defaultValue={this.props.config.LogSettings.consoleLevel}
+ onChange={this.handleChange}
+ >
+ <option value='DEBUG'>{'DEBUG'}</option>
+ <option value='INFO'>{'INFO'}</option>
+ <option value='ERROR'>{'ERROR'}</option>
+ </select>
+ <p className='help-text'>{'This setting determines the level of detail at which log events are written to the console. ERROR: Outputs only error messages. INFO: Outputs error messages and information around startup and initialization. DEBUG: Prints high detail for developers debugging issues working on debugging issues.'}</p>
+ </div>
+ </div>
+
+ <div className='form-group'>
+ <label
+ className='control-label col-sm-4'
+ >
+ {'Log To File: '}
+ </label>
+ <div className='col-sm-8'>
+ <label className='radio-inline'>
+ <input
+ type='radio'
+ name='fileEnable'
+ ref='fileEnable'
+ value='true'
+ defaultChecked={this.props.config.LogSettings.FileEnable}
+ onChange={this.handleChange}
+ />
+ {'true'}
+ </label>
+ <label className='radio-inline'>
+ <input
+ type='radio'
+ name='fileEnable'
+ value='false'
+ defaultChecked={!this.props.config.LogSettings.FileEnable}
+ onChange={this.handleChange}
+ />
+ {'false'}
+ </label>
+ <p className='help-text'>{'Typically set to true in production. When true log files are written to the file specified in file location field below.'}</p>
+ </div>
+ </div>
+
+ <div className='form-group'>
+ <label
+ className='control-label col-sm-4'
+ htmlFor='fileLevel'
+ >
+ {'File Log Level:'}
+ </label>
+ <div className='col-sm-8'>
+ <select
+ className='form-control'
+ id='fileLevel'
+ ref='fileLevel'
+ defaultValue={this.props.config.LogSettings.FileLevel}
+ onChange={this.handleChange}
+ >
+ <option value='DEBUG'>{'DEBUG'}</option>
+ <option value='INFO'>{'INFO'}</option>
+ <option value='ERROR'>{'ERROR'}</option>
+ </select>
+ <p className='help-text'>{'This setting determines the level of detail at which log events are written to the file. ERROR: Outputs only error messages. INFO: Outputs error messages and information around startup and initialization. DEBUG: Prints high detail for developers debugging issues working on debugging issues.'}</p>
+ </div>
+ </div>
+
+ <div className='form-group'>
+ <label
+ className='control-label col-sm-4'
+ htmlFor='fileLocation'
+ >
+ {'File Location:'}
+ </label>
+ <div className='col-sm-8'>
+ <input
+ type='text'
+ className='form-control'
+ id='fileLocation'
+ ref='fileLocation'
+ placeholder='Enter your file location'
+ defaultValue={this.props.config.LogSettings.FileLocation}
+ onChange={this.handleChange}
+ />
+ <p className='help-text'>{'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.'}</p>
+ </div>
+ </div>
+
+ <div className='form-group'>
+ <label
+ className='control-label col-sm-4'
+ htmlFor='fileFormat'
+ >
+ {'File Format:'}
+ </label>
+ <div className='col-sm-8'>
+ <input
+ type='text'
+ className='form-control'
+ id='fileFormat'
+ ref='fileFormat'
+ placeholder='Enter your file format'
+ defaultValue={this.props.config.LogSettings.FileFormat}
+ onChange={this.handleChange}
+ />
+ <p className='help-text'>
+ {'Format of log message output. If blank will be set to "[%D %T] [%L] %M", where:'}
+ <div className='help-text'>
+ <table
+ className='table-bordered'
+ cellPadding='5'
+ >
+ <tr><td className='help-text'>{'%T'}</td><td className='help-text'>{'Time (15:04:05 MST)'}</td></tr>
+ <tr><td className='help-text'>{'%D'}</td><td className='help-text'>{'Date (2006/01/02)'}</td></tr>
+ <tr><td className='help-text'>{'%d'}</td><td className='help-text'>{'Date (01/02/06)'}</td></tr>
+ <tr><td className='help-text'>{'%L'}</td><td className='help-text'>{'Level (DEBG, INFO, EROR)'}</td></tr>
+ <tr><td className='help-text'>{'%S'}</td><td className='help-text'>{'Source'}</td></tr>
+ <tr><td className='help-text'>{'%M'}</td><td className='help-text'>{'Message'}</td></tr>
+ </table>
+ </div>
+ </p>
+ </div>
+ </div>
+
+ <div className='form-group'>
+ <div className='col-sm-12'>
+ {serverError}
+ <button
+ disabled={!this.state.saveNeeded}
+ type='submit'
+ className={saveClass}
+ onClick={this.handleSubmit}
+ id='save-button'
+ data-loading-text={'<span class=\'glyphicon glyphicon-refresh glyphicon-refresh-animate\'></span> Saving Config...'}
+ >
+ {'Save'}
+ </button>
+ </div>
+ </div>
+
+ </form>
+ </div>
+ );
+ }
+}
+
+LogSettings.propTypes = {
+ config: React.PropTypes.object
+};
diff --git a/web/react/components/admin_console/logs.jsx b/web/react/components/admin_console/logs.jsx
index d7de76a94..0bb749bbd 100644
--- a/web/react/components/admin_console/logs.jsx
+++ b/web/react/components/admin_console/logs.jsx
@@ -21,9 +21,11 @@ export default class Logs extends React.Component {
AdminStore.addLogChangeListener(this.onLogListenerChange);
AsyncClient.getLogs();
}
+
componentWillUnmount() {
AdminStore.removeLogChangeListener(this.onLogListenerChange);
}
+
onLogListenerChange() {
this.setState({
logs: AdminStore.getLogs()
diff --git a/web/react/stores/admin_store.jsx b/web/react/stores/admin_store.jsx
index 591b52d05..dd5b60a24 100644
--- a/web/react/stores/admin_store.jsx
+++ b/web/react/stores/admin_store.jsx
@@ -8,16 +8,22 @@ var Constants = require('../utils/constants.jsx');
var ActionTypes = Constants.ActionTypes;
var LOG_CHANGE_EVENT = 'log_change';
+var CONFIG_CHANGE_EVENT = 'config_change';
class AdminStoreClass extends EventEmitter {
constructor() {
super();
this.logs = null;
+ this.config = null;
this.emitLogChange = this.emitLogChange.bind(this);
this.addLogChangeListener = this.addLogChangeListener.bind(this);
this.removeLogChangeListener = this.removeLogChangeListener.bind(this);
+
+ this.emitConfigChange = this.emitConfigChange.bind(this);
+ this.addConfigChangeListener = this.addConfigChangeListener.bind(this);
+ this.removeConfigChangeListener = this.removeConfigChangeListener.bind(this);
}
emitLogChange() {
@@ -32,6 +38,18 @@ class AdminStoreClass extends EventEmitter {
this.removeListener(LOG_CHANGE_EVENT, callback);
}
+ emitConfigChange() {
+ this.emit(CONFIG_CHANGE_EVENT);
+ }
+
+ addConfigChangeListener(callback) {
+ this.on(CONFIG_CHANGE_EVENT, callback);
+ }
+
+ removeConfigChangeListener(callback) {
+ this.removeListener(CONFIG_CHANGE_EVENT, callback);
+ }
+
getLogs() {
return this.logs;
}
@@ -39,6 +57,14 @@ class AdminStoreClass extends EventEmitter {
saveLogs(logs) {
this.logs = logs;
}
+
+ getConfig() {
+ return this.config;
+ }
+
+ saveConfig(config) {
+ this.config = config;
+ }
}
var AdminStore = new AdminStoreClass();
@@ -51,6 +77,10 @@ AdminStoreClass.dispatchToken = AppDispatcher.register((payload) => {
AdminStore.saveLogs(action.logs);
AdminStore.emitLogChange();
break;
+ case ActionTypes.RECIEVED_CONFIG:
+ AdminStore.saveConfig(action.config);
+ AdminStore.emitConfigChange();
+ break;
default:
}
});
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index 3e23e5c33..ed228f6c4 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -345,6 +345,32 @@ export function getLogs() {
);
}
+export function getConfig() {
+ if (isCallInProgress('getConfig')) {
+ return;
+ }
+
+ callTracker.getConfig = utils.getTimestamp();
+ client.getConfig(
+ (data, textStatus, xhr) => {
+ callTracker.getConfig = 0;
+
+ if (xhr.status === 304 || !data) {
+ return;
+ }
+
+ AppDispatcher.handleServerAction({
+ type: ActionTypes.RECIEVED_CONFIG,
+ config: data
+ });
+ },
+ (err) => {
+ callTracker.getConfig = 0;
+ dispatchError(err, 'getConfig');
+ }
+ );
+}
+
export function findTeams(email) {
if (isCallInProgress('findTeams_' + email)) {
return;
diff --git a/web/react/utils/client.jsx b/web/react/utils/client.jsx
index ba3042d78..c9eb09c00 100644
--- a/web/react/utils/client.jsx
+++ b/web/react/utils/client.jsx
@@ -297,7 +297,7 @@ export function getLogs(success, error) {
dataType: 'json',
contentType: 'application/json',
type: 'GET',
- success: success,
+ success,
error: function onError(xhr, status, err) {
var e = handleError('getLogs', xhr, status, err);
error(e);
@@ -305,6 +305,35 @@ export function getLogs(success, error) {
});
}
+export function getConfig(success, error) {
+ $.ajax({
+ url: '/api/v1/admin/config',
+ dataType: 'json',
+ contentType: 'application/json',
+ type: 'GET',
+ success,
+ error: function onError(xhr, status, err) {
+ var e = handleError('getConfig', xhr, status, err);
+ error(e);
+ }
+ });
+}
+
+export function saveConfig(config, success, error) {
+ $.ajax({
+ url: '/api/v1/admin/save_config',
+ dataType: 'json',
+ contentType: 'application/json',
+ type: 'POST',
+ data: JSON.stringify(config),
+ success,
+ error: function onError(xhr, status, err) {
+ var e = handleError('saveConfig', xhr, status, err);
+ error(e);
+ }
+ });
+}
+
export function getMeSynchronous(success, error) {
var currentUser = null;
$.ajax({