summaryrefslogtreecommitdiffstats
path: root/web/react/components/team_import_tab.jsx
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2015-09-01 17:06:31 -0700
committer=Corey Hulen <corey@hulen.com>2015-09-01 17:06:31 -0700
commitf578bb1e48ec4d97bca92c7faf0dd8ed5aeceb39 (patch)
tree8b4f68e847984949b8362a30d40f13db2c4bcd52 /web/react/components/team_import_tab.jsx
parent72575ac7bdd5bfe7bd544ba238f8d1c0126635aa (diff)
downloadchat-f578bb1e48ec4d97bca92c7faf0dd8ed5aeceb39.tar.gz
chat-f578bb1e48ec4d97bca92c7faf0dd8ed5aeceb39.tar.bz2
chat-f578bb1e48ec4d97bca92c7faf0dd8ed5aeceb39.zip
MM-2065 style refactoring
Diffstat (limited to 'web/react/components/team_import_tab.jsx')
-rw-r--r--web/react/components/team_import_tab.jsx83
1 files changed, 55 insertions, 28 deletions
diff --git a/web/react/components/team_import_tab.jsx b/web/react/components/team_import_tab.jsx
index e3415d7f4..627ff85f4 100644
--- a/web/react/components/team_import_tab.jsx
+++ b/web/react/components/team_import_tab.jsx
@@ -4,26 +4,38 @@
var utils = require('../utils/utils.jsx');
var SettingUpload = require('./setting_upload.jsx');
-module.exports = React.createClass({
- displayName: 'Import Tab',
- getInitialState: function() {
- return {status: 'ready', link: ''};
- },
- onImportFailure: function() {
+export default class TeamImportTab extends React.Component {
+ constructor(props) {
+ super(props);
+
+ this.onImportFailure = this.onImportFailure.bind(this);
+ this.onImportSuccess = this.onImportSuccess.bind(this);
+ this.doImportSlack = this.doImportSlack.bind(this);
+
+ this.state = {
+ status: 'ready',
+ link: ''
+ };
+ }
+
+ onImportFailure() {
this.setState({status: 'fail', link: ''});
- },
- onImportSuccess: function(data) {
+ }
+
+ onImportSuccess(data) {
this.setState({status: 'done', link: 'data:application/octet-stream;charset=utf-8,' + encodeURIComponent(data)});
- },
- doImportSlack: function(file) {
+ }
+
+ doImportSlack(file) {
this.setState({status: 'in-progress', link: ''});
utils.importSlack(file, this.onImportSuccess, this.onImportFailure);
- },
- render: function() {
+ }
+
+ render() {
var uploadHelpText = (
<div>
<br/>
- Slack does not allow you to export files, images, private groups or direct messages stored in Slack. Therefore, Slack import to Mattermost only supports importing of text messages in your Slack team's public channels.
+ Slack does not allow you to export files, images, private groups or direct messages stored in Slack. Therefore, Slack import to Mattermost only supports importing of text messages in your Slack team's public channels.
<br/><br/>
The Slack import to Mattermost is in "Preview". Slack bot posts and channels with underscores do not yet import.
<br/><br/>
@@ -39,22 +51,25 @@ module.exports = React.createClass({
var messageSection;
switch (this.state.status) {
- case 'ready':
- messageSection = '';
+
+ case 'ready':
+ messageSection = '';
break;
- case 'in-progress':
- messageSection = (
- <p className="confirm-import alert alert-warning"><i className="fa fa-spinner fa-pulse"></i> Importing...</p>
+ case 'in-progress':
+ messageSection = (
+ <p className='confirm-import alert alert-warning'><i className='fa fa-spinner fa-pulse'></i> Importing...</p>
);
break;
- case 'done':
- messageSection = (
- <p className="confirm-import alert alert-success"><i className="fa fa-check"></i> Import successful: <a href={this.state.link} download='MattermostImportSummary.txt'>View Summary</a></p>
+ case 'done':
+ messageSection = (
+ <p className='confirm-import alert alert-success'><i className='fa fa-check'></i> Import successful: <a href={this.state.link}
+ download='MattermostImportSummary.txt'>View Summary</a></p>
);
break;
- case 'fail':
- messageSection = (
- <p className="confirm-import alert alert-warning"><i className="fa fa-warning"></i> Import failure: <a href={this.state.link} download='MattermostImportSummary.txt'>View Summary</a></p>
+ case 'fail':
+ messageSection = (
+ <p className='confirm-import alert alert-warning'><i className='fa fa-warning'></i> Import failure: <a href={this.state.link}
+ download='MattermostImportSummary.txt'>View Summary</a></p>
);
break;
}
@@ -62,10 +77,22 @@ module.exports = React.createClass({
return (
<div>
<div className='modal-header'>
- <button type='button' className='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>&times;</span></button>
- <h4 className='modal-title' ref='title'><i className='modal-back'></i>Import</h4>
+ <button type='button'
+ className='close'
+ data-dismiss='modal'
+ aria-label='Close'
+ >
+ <span aria-hidden='true'>&times;</span>
+ </button>
+ <h4
+ className='modal-title'
+ ref='title'
+ ><i className='modal-back'></i>Import</h4>
</div>
- <div ref='wrapper' className='user-settings'>
+ <div
+ ref='wrapper'
+ className='user-settings'
+ >
<h3 className='tab-header'>Import</h3>
<div className='divider-dark first'/>
{uploadSection}
@@ -75,4 +102,4 @@ module.exports = React.createClass({
</div>
);
}
-});
+}