+
{this.props.label}
{this.props.children}
+
+ {this.props.helpText}
+
);
@@ -28,7 +27,8 @@ Setting.defaultProps = {
};
Setting.propTypes = {
+ inputId: React.PropTypes.string,
label: React.PropTypes.node.isRequired,
children: React.PropTypes.node.isRequired,
- margin: React.PropTypes.oneOf(['', 'small'])
+ helpText: React.PropTypes.node
};
diff --git a/webapp/components/admin_console/settings_group.jsx b/webapp/components/admin_console/settings_group.jsx
new file mode 100644
index 0000000000..10b3444d8d
--- /dev/null
+++ b/webapp/components/admin_console/settings_group.jsx
@@ -0,0 +1,42 @@
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import React from 'react';
+
+export default class SettingsGroup extends React.Component {
+ static get propTypes() {
+ return {
+ show: React.PropTypes.bool.isRequired,
+ header: React.PropTypes.node,
+ children: React.PropTypes.node
+ };
+ }
+
+ static get defaultProps() {
+ return {
+ show: true
+ };
+ }
+
+ render() {
+ if (!this.props.show) {
+ return null;
+ }
+
+ let header = null;
+ if (this.props.header) {
+ header = (
+
+ {this.props.header}
+
+ );
+ }
+
+ return (
+
+ {header}
+ {this.props.children}
+
+ );
+ }
+}
diff --git a/webapp/components/admin_console/signup_settings.jsx b/webapp/components/admin_console/signup_settings.jsx
new file mode 100644
index 0000000000..fd64e4ea53
--- /dev/null
+++ b/webapp/components/admin_console/signup_settings.jsx
@@ -0,0 +1,124 @@
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import React from 'react';
+
+import AdminSettings from './admin_settings.jsx';
+import BooleanSetting from './boolean_setting.jsx';
+import {FormattedMessage} from 'react-intl';
+import GeneratedSetting from './generated_setting.jsx';
+import SettingsGroup from './settings_group.jsx';
+
+export default class SignupSettings extends AdminSettings {
+ constructor(props) {
+ super(props);
+
+ this.getConfigFromState = this.getConfigFromState.bind(this);
+
+ this.renderSettings = this.renderSettings.bind(this);
+
+ this.state = Object.assign(this.state, {
+ requireEmailVerification: props.config.EmailSettings.RequireEmailVerification,
+ inviteSalt: props.config.EmailSettings.InviteSalt,
+ enableOpenServer: props.config.TeamSettings.EnableOpenServer
+ });
+ }
+
+ getConfigFromState(config) {
+ config.EmailSettings.RequireEmailVerification = this.state.requireEmailVerification;
+ config.EmailSettings.InviteSalt = this.state.inviteSalt;
+ config.TeamSettings.EnableOpenServer = this.state.enableOpenServer;
+
+ return config;
+ }
+
+ renderTitle() {
+ return (
+
+
+
+ );
+ }
+
+ renderSettings() {
+ return (
+
+ }
+ >
+
+ }
+ helpText={
+
+ }
+ value={this.state.requireEmailVerification}
+ onChange={this.handleChange}
+ disabled={this.state.sendEmailNotifications}
+ disabledText={
+
+ }
+ />
+
+ }
+ helpText={
+
+ }
+ value={this.state.inviteSalt}
+ onChange={this.handleChange}
+ disabled={this.state.sendEmailNotifications}
+ disabledText={
+
+ }
+ />
+
+ }
+ helpText={
+
+ }
+ value={this.state.enableOpenServer}
+ onChange={this.handleChange}
+ />
+
+ );
+ }
+}
\ No newline at end of file
diff --git a/webapp/components/admin_console/sql_settings.jsx b/webapp/components/admin_console/sql_settings.jsx
deleted file mode 100644
index a6e09b4a0e..0000000000
--- a/webapp/components/admin_console/sql_settings.jsx
+++ /dev/null
@@ -1,390 +0,0 @@
-// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-import $ from 'jquery';
-import ReactDOM from 'react-dom';
-import Client from 'utils/web_client.jsx';
-import * as AsyncClient from 'utils/async_client.jsx';
-import crypto from 'crypto';
-
-import {injectIntl, intlShape, defineMessages, FormattedMessage} from 'react-intl';
-
-const holders = defineMessages({
- warning: {
- id: 'admin.sql.warning',
- defaultMessage: 'Warning: re-generating this salt may cause some columns in the database to return empty results.'
- },
- maxConnectionsExample: {
- id: 'admin.sql.maxConnectionsExample',
- defaultMessage: 'Ex "10"'
- },
- maxOpenExample: {
- id: 'admin.sql.maxOpenExample',
- defaultMessage: 'Ex "10"'
- },
- keyExample: {
- id: 'admin.sql.keyExample',
- defaultMessage: 'Ex "gxHVDcKUyP2y1eiyW8S8na1UYQAfq6J6"'
- },
- saving: {
- id: 'admin.sql.saving',
- defaultMessage: 'Saving Config...'
- }
-});
-
-import React from 'react';
-
-class SqlSettings extends React.Component {
- constructor(props) {
- super(props);
-
- this.handleChange = this.handleChange.bind(this);
- this.handleSubmit = this.handleSubmit.bind(this);
- this.handleGenerate = this.handleGenerate.bind(this);
-
- this.state = {
- saveNeeded: false,
- serverError: null
- };
- }
-
- handleChange() {
- var s = {saveNeeded: true, serverError: this.state.serverError};
- this.setState(s);
- }
-
- handleSubmit(e) {
- e.preventDefault();
- $('#save-button').button('loading');
-
- var config = this.props.config;
- config.SqlSettings.Trace = ReactDOM.findDOMNode(this.refs.Trace).checked;
- config.SqlSettings.AtRestEncryptKey = ReactDOM.findDOMNode(this.refs.AtRestEncryptKey).value.trim();
-
- if (config.SqlSettings.AtRestEncryptKey === '') {
- config.SqlSettings.AtRestEncryptKey = crypto.randomBytes(256).toString('base64').substring(0, 32);
- ReactDOM.findDOMNode(this.refs.AtRestEncryptKey).value = config.SqlSettings.AtRestEncryptKey;
- }
-
- var MaxOpenConns = 10;
- if (!isNaN(parseInt(ReactDOM.findDOMNode(this.refs.MaxOpenConns).value, 10))) {
- MaxOpenConns = parseInt(ReactDOM.findDOMNode(this.refs.MaxOpenConns).value, 10);
- }
- config.SqlSettings.MaxOpenConns = MaxOpenConns;
- ReactDOM.findDOMNode(this.refs.MaxOpenConns).value = MaxOpenConns;
-
- var MaxIdleConns = 10;
- if (!isNaN(parseInt(ReactDOM.findDOMNode(this.refs.MaxIdleConns).value, 10))) {
- MaxIdleConns = parseInt(ReactDOM.findDOMNode(this.refs.MaxIdleConns).value, 10);
- }
- config.SqlSettings.MaxIdleConns = MaxIdleConns;
- ReactDOM.findDOMNode(this.refs.MaxIdleConns).value = MaxIdleConns;
-
- 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');
- }
- );
- }
-
- handleGenerate(e) {
- e.preventDefault();
-
- var cfm = global.window.confirm(this.props.intl.formatMessage(holders.warning));
- if (cfm === false) {
- return;
- }
-
- ReactDOM.findDOMNode(this.refs.AtRestEncryptKey).value = crypto.randomBytes(256).toString('base64').substring(0, 32);
- var s = {saveNeeded: true, serverError: this.state.serverError};
- this.setState(s);
- }
-
- render() {
- const {formatMessage} = this.props.intl;
- var serverError = '';
- if (this.state.serverError) {
- serverError =
{this.state.serverError}
;
- }
-
- var saveClass = 'btn';
- if (this.state.saveNeeded) {
- saveClass = 'btn btn-primary';
- }
-
- var dataSource = '**********' + this.props.config.SqlSettings.DataSource.substring(this.props.config.SqlSettings.DataSource.indexOf('@'));
-
- var dataSourceReplicas = '';
- this.props.config.SqlSettings.DataSourceReplicas.forEach((replica) => {
- dataSourceReplicas += '[**********' + replica.substring(replica.indexOf('@')) + '] ';
- });
-
- if (this.props.config.SqlSettings.DataSourceReplicas.length === 0) {
- dataSourceReplicas = 'none';
- }
-
- return (
-
- );
- }
-}
-
-SqlSettings.propTypes = {
- intl: intlShape.isRequired,
- config: React.PropTypes.object
-};
-
-export default injectIntl(SqlSettings);
diff --git a/webapp/components/admin_console/storage_settings.jsx b/webapp/components/admin_console/storage_settings.jsx
new file mode 100644
index 0000000000..339876b18b
--- /dev/null
+++ b/webapp/components/admin_console/storage_settings.jsx
@@ -0,0 +1,180 @@
+// 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 DropdownSetting from './dropdown_setting.jsx';
+import {FormattedMessage} from 'react-intl';
+import SettingsGroup from './settings_group.jsx';
+import TextSetting from './text_setting.jsx';
+
+const DRIVER_LOCAL = 'local';
+const DRIVER_S3 = 'amazons3';
+
+export default class StorageSettings extends AdminSettings {
+ constructor(props) {
+ super(props);
+
+ this.getConfigFromState = this.getConfigFromState.bind(this);
+
+ this.renderSettings = this.renderSettings.bind(this);
+
+ this.state = Object.assign(this.state, {
+ driverName: props.config.FileSettings.DriverName,
+ directory: props.config.FileSettings.Directory,
+ amazonS3AccessKeyId: props.config.FileSettings.AmazonS3AccessKeyId,
+ amazonS3SecretAccessKey: props.config.FileSettings.AmazonS3SecretAccessKey,
+ amazonS3Bucket: props.config.FileSettings.AmazonS3Bucket,
+ amazonS3Region: props.config.FileSettings.AmazonS3Region
+ });
+ }
+
+ getConfigFromState(config) {
+ config.FileSettings.DriverName = this.state.driverName;
+ config.FileSettings.Directory = this.state.directory;
+ config.FileSettings.AmazonS3AccessKeyId = this.state.amazonS3AccessKeyId;
+ config.FileSettings.AmazonS3SecretAccessKey = this.state.amazonS3SecretAccessKey;
+ config.FileSettings.AmazonS3Bucket = this.state.amazonS3Bucket;
+ config.FileSettings.AmazonS3Region = this.state.amazonS3Region;
+
+ return config;
+ }
+
+ renderTitle() {
+ return (
+
+
+
+ );
+ }
+
+ renderSettings() {
+ return (
+
+ }
+ >
+
+ }
+ value={this.state.driverName}
+ onChange={this.handleChange}
+ />
+
+ }
+ placeholder={Utils.localizeMessage('admin.image.localExample', 'Ex "./data/"')}
+ helpText={
+
+ }
+ value={this.state.directory}
+ onChange={this.handleChange}
+ disabled={this.state.driverName !== DRIVER_LOCAL}
+ />
+
+ }
+ placeholder={Utils.localizeMessage('admin.image.amazonS3IdExample', 'Ex "AKIADTOVBGERKLCBV"')}
+ helpText={
+
+ }
+ value={this.state.amazonS3AccessKeyId}
+ onChange={this.handleChange}
+ disabled={this.state.driverName !== DRIVER_S3}
+ />
+
+ }
+ placeholder={Utils.localizeMessage('admin.image.amazonS3SecretExample', 'Ex "jcuS8PuvcpGhpgHhlcpT1Mx42pnqMxQY"')}
+ helpText={
+
+ }
+ value={this.state.amazonS3SecretAccessKey}
+ onChange={this.handleChange}
+ disabled={this.state.driverName !== DRIVER_S3}
+ />
+
+ }
+ placeholder={Utils.localizeMessage('admin.image.amazonS3BucketExample', 'Ex "mattermost-media"')}
+ helpText={
+
+ }
+ value={this.state.amazonS3Bucket}
+ onChange={this.handleChange}
+ disabled={this.state.driverName !== DRIVER_S3}
+ />
+
+ }
+ placeholder={Utils.localizeMessage('admin.image.amazonS3RegionExample', 'Ex "us-east-1"')}
+ helpText={
+
+ }
+ value={this.state.amazonS3Region}
+ onChange={this.handleChange}
+ disabled={this.state.driverName !== DRIVER_S3}
+ />
+
+ );
+ }
+}
\ No newline at end of file
diff --git a/webapp/components/admin_console/team_users.jsx b/webapp/components/admin_console/team_users.jsx
index 00aa1a8322..89fbd0e3ad 100644
--- a/webapp/components/admin_console/team_users.jsx
+++ b/webapp/components/admin_console/team_users.jsx
@@ -1,7 +1,9 @@
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
+import AdminStore from 'stores/admin_store.jsx';
import Client from 'utils/web_client.jsx';
+import FormError from 'components/form_error.jsx';
import LoadingScreen from '../loading_screen.jsx';
import UserItem from './user_item.jsx';
import ResetPasswordModal from './reset_password_modal.jsx';
@@ -11,9 +13,17 @@ import {FormattedMessage} from 'react-intl';
import React from 'react';
export default class UserList extends React.Component {
+ static get propTypes() {
+ return {
+ params: React.PropTypes.object.isRequired
+ };
+ }
+
constructor(props) {
super(props);
+ this.onAllTeamsChange = this.onAllTeamsChange.bind(this);
+
this.getTeamProfiles = this.getTeamProfiles.bind(this);
this.getCurrentTeamProfiles = this.getCurrentTeamProfiles.bind(this);
this.doPasswordReset = this.doPasswordReset.bind(this);
@@ -22,7 +32,7 @@ export default class UserList extends React.Component {
this.getTeamMemberForUser = this.getTeamMemberForUser.bind(this);
this.state = {
- teamId: props.team.id,
+ team: AdminStore.getTeam(this.props.params.team),
users: null,
teamMembers: null,
serverError: null,
@@ -35,8 +45,14 @@ export default class UserList extends React.Component {
this.getCurrentTeamProfiles();
}
+ onAllTeamsChange() {
+ this.setState({
+ team: AdminStore.getTeam(this.props.params.team)
+ });
+ }
+
getCurrentTeamProfiles() {
- this.getTeamProfiles(this.props.team.id);
+ this.getTeamProfiles(this.props.params.team);
}
getTeamProfiles(teamId) {
@@ -133,9 +149,8 @@ export default class UserList extends React.Component {
}
render() {
- var serverError = '';
- if (this.state.serverError) {
- serverError =
{this.state.serverError}
;
+ if (!this.state.team) {
+ return null;
}
if (this.state.users == null || this.state.teamMembers == null) {
@@ -146,11 +161,11 @@ export default class UserList extends React.Component {
id='admin.userList.title'
defaultMessage='Users for {team}'
values={{
- team: this.props.team.name
+ team: this.state.team.name
}}
/>
- {serverError}
+
);
@@ -161,7 +176,7 @@ export default class UserList extends React.Component {
return (