From fd53e3b7868234af328cd73150318fc8e7a26b89 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Tue, 17 May 2016 07:21:39 -0400 Subject: PLT-2257 Reorganized System Console (#3003) * Reorganized system console * Fixed the names of some components * Fixed timestamp for BrandImageSetting * Fixed merge issues * Updated push notification settings to match master branch * Removed top level setting pages and moved enable Gitlab/LDAP settings onto their respective pages * Re-added restrictDirectMessage setting to system console * Re-added email connection test and fixed some margins * Fixed ESLint errors * Renamed Authentication > Onboarding to Authentication > Email in the system console * Renamed Customization > Whitelabeling to Customization > Custom Branding in System Console * Re-added EnableOpenServer to system console --- .../components/admin_console/privacy_settings.jsx | 261 ++++++--------------- 1 file changed, 68 insertions(+), 193 deletions(-) (limited to 'webapp/components/admin_console/privacy_settings.jsx') diff --git a/webapp/components/admin_console/privacy_settings.jsx b/webapp/components/admin_console/privacy_settings.jsx index 8759472a2..8905e57ef 100644 --- a/webapp/components/admin_console/privacy_settings.jsx +++ b/webapp/components/admin_console/privacy_settings.jsx @@ -1,215 +1,90 @@ // 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 {injectIntl, intlShape, defineMessages, FormattedMessage} from 'react-intl'; - -const holders = defineMessages({ - saving: { - id: 'admin.privacy.saving', - defaultMessage: 'Saving Config...' - } -}); - import React from 'react'; -class PrivacySettings extends React.Component { +import AdminSettings from './admin_settings.jsx'; +import BooleanSetting from './boolean_setting.jsx'; +import {FormattedMessage} from 'react-intl'; +import SettingsGroup from './settings_group.jsx'; + +export default class PrivacySettings extends AdminSettings { constructor(props) { super(props); - this.handleChange = this.handleChange.bind(this); - this.handleSubmit = this.handleSubmit.bind(this); + this.getConfigFromState = this.getConfigFromState.bind(this); - this.state = { - saveNeeded: false, - serverError: null - }; - } - - handleChange() { - var s = {saveNeeded: true, serverError: this.state.serverError}; + this.renderSettings = this.renderSettings.bind(this); - this.setState(s); + this.state = Object.assign(this.state, { + showEmailAddress: props.config.PrivacySettings.ShowEmailAddress, + showFullName: props.config.PrivacySettings.ShowFullName + }); } - handleSubmit(e) { - e.preventDefault(); - $('#save-button').button('loading'); + getConfigFromState(config) { + config.PrivacySettings.ShowEmailAddress = this.state.showEmailAddress; + config.PrivacySettings.ShowFullName = this.state.showFullName; - var config = this.props.config; - config.PrivacySettings.ShowEmailAddress = ReactDOM.findDOMNode(this.refs.ShowEmailAddress).checked; - config.PrivacySettings.ShowFullName = ReactDOM.findDOMNode(this.refs.ShowFullName).checked; + return config; + } - 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'); - } + renderTitle() { + return ( +

+ +

); } - render() { - var serverError = ''; - if (this.state.serverError) { - serverError =
; - } - - var saveClass = 'btn'; - if (this.state.saveNeeded) { - saveClass = 'btn btn-primary'; - } - + renderSettings() { return ( -
-

+ -

-
- -
- -
- - -

- -

-
-
- -
- -
- - -

- -

-
-
- -
-
- {serverError} - -
-
- -
-
+ } + > + + } + helpText={ + + } + value={this.state.showEmailAddress} + onChange={this.handleChange} + /> + + } + helpText={ + + } + value={this.state.showFullName} + onChange={this.handleChange} + /> + ); } -} - -PrivacySettings.propTypes = { - intl: intlShape.isRequired, - config: React.PropTypes.object -}; - -export default injectIntl(PrivacySettings); +} \ No newline at end of file -- cgit v1.2.3-1-g7c22