From f0fd9a9e8b85544089246bde71b6d61ba90eeb0e Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 26 Aug 2015 12:49:07 -0400 Subject: Adding ability to export data from mattermost --- web/react/components/team_export_tab.jsx | 96 ++++++++++++++++++++++++++++ web/react/components/team_settings.jsx | 8 +++ web/react/components/team_settings_modal.jsx | 1 + 3 files changed, 105 insertions(+) create mode 100644 web/react/components/team_export_tab.jsx (limited to 'web/react/components') diff --git a/web/react/components/team_export_tab.jsx b/web/react/components/team_export_tab.jsx new file mode 100644 index 000000000..1bc5abdb1 --- /dev/null +++ b/web/react/components/team_export_tab.jsx @@ -0,0 +1,96 @@ +// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// See License.txt for license information. + +var Client = require('../utils/client.jsx'); + +export default class TeamExportTab extends React.Component { + constructor(props) { + super(props); + this.state = {status: 'request', link: '', err: ''}; + + this.onExportSuccess = this.onExportSuccess.bind(this); + this.onExportFailure = this.onExportFailure.bind(this); + this.doExport = this.doExport.bind(this); + } + onExportSuccess(data) { + this.setState({status: 'ready', link: data.link, err: ''}); + } + onExportFailure(e) { + this.setState({status: 'failure', link: '', err: e.message}); + } + doExport() { + if (this.state.status === 'in-progress') { + return; + } + this.setState({status: 'in-progress'}); + Client.exportTeam(this.onExportSuccess, this.onExportFailure); + } + render() { + var messageSection = ''; + switch (this.state.status) { + case 'request': + messageSection = ''; + break; + case 'in-progress': + messageSection = ( +

+ + {' Exporting...'} +

+ ); + break; + case 'ready': + messageSection = ( +

+ + {' Ready for '} + + {'download'} + +

+ ); + break; + case 'failure': + messageSection = ( +

+ + {' Unable to export: ' + this.state.err} +

+ ); + break; + } + + return ( +
+

{'Export'}

+
+ +
+ {messageSection} +
+ ); + } +} diff --git a/web/react/components/team_settings.jsx b/web/react/components/team_settings.jsx index 53855fe1c..396521af9 100644 --- a/web/react/components/team_settings.jsx +++ b/web/react/components/team_settings.jsx @@ -3,6 +3,7 @@ var TeamStore = require('../stores/team_store.jsx'); var ImportTab = require('./team_import_tab.jsx'); +var ExportTab = require('./team_export_tab.jsx'); var FeatureTab = require('./team_feature_tab.jsx'); var GeneralTab = require('./team_general_tab.jsx'); var Utils = require('../utils/utils.jsx'); @@ -64,6 +65,13 @@ export default class TeamSettings extends React.Component {
); break; + case 'export': + result = ( +
+ +
+ ); + break; default: result = (
diff --git a/web/react/components/team_settings_modal.jsx b/web/react/components/team_settings_modal.jsx index 668bf76cf..0513c811f 100644 --- a/web/react/components/team_settings_modal.jsx +++ b/web/react/components/team_settings_modal.jsx @@ -36,6 +36,7 @@ export default class TeamSettingsModal extends React.Component { let tabs = []; tabs.push({name: 'general', uiName: 'General', icon: 'glyphicon glyphicon-cog'}); tabs.push({name: 'import', uiName: 'Import', icon: 'glyphicon glyphicon-upload'}); + tabs.push({name: 'export', uiName: 'Export', icon: 'glyphicon glyphicon-download'}); tabs.push({name: 'feature', uiName: 'Advanced', icon: 'glyphicon glyphicon-wrench'}); return ( -- cgit v1.2.3-1-g7c22 From 228ee859ffacc73835c92ea51432beca856bb21e Mon Sep 17 00:00:00 2001 From: nickago Date: Thu, 3 Sep 2015 12:53:16 -0700 Subject: Added help text to username, nickname, and fullname --- web/react/components/user_settings.jsx | 3 ++- web/react/components/user_settings_general.jsx | 34 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) (limited to 'web/react/components') diff --git a/web/react/components/user_settings.jsx b/web/react/components/user_settings.jsx index 282fb7681..2a607b3e0 100644 --- a/web/react/components/user_settings.jsx +++ b/web/react/components/user_settings.jsx @@ -40,6 +40,7 @@ export default class UserSettings extends React.Component { user={this.state.user} activeSection={this.props.activeSection} updateSection={this.props.updateSection} + updateTab={this.props.updateTab} />
); @@ -86,4 +87,4 @@ UserSettings.propTypes = { activeSection: React.PropTypes.string, updateSection: React.PropTypes.func, updateTab: React.PropTypes.func -}; \ No newline at end of file +}; diff --git a/web/react/components/user_settings_general.jsx b/web/react/components/user_settings_general.jsx index ead7ac1d5..f43889f7a 100644 --- a/web/react/components/user_settings_general.jsx +++ b/web/react/components/user_settings_general.jsx @@ -267,6 +267,27 @@ export default class UserSettingsGeneralTab extends React.Component {
); + function notifClick(e) { + e.preventDefault(); + this.updateSection(''); + this.props.updateTab('notifications'); + } + + let notifLink = ( + + Notifications + + ); + + let extraInfo = ( + + By default, you will receive mention notifications when someone types your first name. + Go to {notifLink} settings to change this default. + + ); + nameSection = ( ); } else { @@ -326,6 +348,13 @@ export default class UserSettingsGeneralTab extends React.Component { ); + let extraInfo = ( + + Use Nickname for a name you might be called that is different from your first name and user name. + This is most often used when two or more people have similar sounding names and usernames. + + ); + nicknameSection = ( ); } else { @@ -375,6 +405,8 @@ export default class UserSettingsGeneralTab extends React.Component { ); + let extraInfo = (Pick something easy for teammates to recognize and recall.); + usernameSection = ( ); } else { @@ -524,5 +557,6 @@ export default class UserSettingsGeneralTab extends React.Component { UserSettingsGeneralTab.propTypes = { user: React.PropTypes.object, updateSection: React.PropTypes.func, + updateTab: React.PropTypes.func, activeSection: React.PropTypes.string }; -- cgit v1.2.3-1-g7c22 From 18807dac42badce57db4a13be5ace2ba2093e8aa Mon Sep 17 00:00:00 2001 From: nickago Date: Fri, 4 Sep 2015 08:36:50 -0700 Subject: Added refactoring to pass style check --- web/react/components/user_settings_general.jsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'web/react/components') diff --git a/web/react/components/user_settings_general.jsx b/web/react/components/user_settings_general.jsx index f43889f7a..f2127ce0c 100644 --- a/web/react/components/user_settings_general.jsx +++ b/web/react/components/user_settings_general.jsx @@ -273,15 +273,16 @@ export default class UserSettingsGeneralTab extends React.Component { this.props.updateTab('notifications'); } - let notifLink = ( + const notifLink = ( + onClick={notifClick.bind(this)} + > Notifications ); - let extraInfo = ( + const extraInfo = ( By default, you will receive mention notifications when someone types your first name. Go to {notifLink} settings to change this default. @@ -348,7 +349,7 @@ export default class UserSettingsGeneralTab extends React.Component { ); - let extraInfo = ( + const extraInfo = ( Use Nickname for a name you might be called that is different from your first name and user name. This is most often used when two or more people have similar sounding names and usernames. @@ -405,7 +406,7 @@ export default class UserSettingsGeneralTab extends React.Component { ); - let extraInfo = (Pick something easy for teammates to recognize and recall.); + const extraInfo = (Pick something easy for teammates to recognize and recall.); usernameSection = ( Date: Tue, 8 Sep 2015 11:54:01 -0400 Subject: Resize create post control when file previews are added. --- web/react/components/create_post.jsx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'web/react/components') diff --git a/web/react/components/create_post.jsx b/web/react/components/create_post.jsx index 871b72a43..50aa0850d 100644 --- a/web/react/components/create_post.jsx +++ b/web/react/components/create_post.jsx @@ -55,6 +55,11 @@ export default class CreatePost extends React.Component { initialText: messageText }; } + componentDidUpdate(prevProps, prevState) { + if (prevState.previews.length !== this.state.previews.length) { + this.resizePostHolder(); + } + } handleSubmit(e) { e.preventDefault(); -- cgit v1.2.3-1-g7c22