From a7e935af9c7e6254ca45e0286b05b5eb6d8283a6 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Tue, 18 Aug 2015 09:43:22 -0400 Subject: Cosmetic refactoring for ESLint --- web/react/components/team_import_tab.jsx | 68 ++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 web/react/components/team_import_tab.jsx (limited to 'web/react/components/team_import_tab.jsx') diff --git a/web/react/components/team_import_tab.jsx b/web/react/components/team_import_tab.jsx new file mode 100644 index 000000000..131add999 --- /dev/null +++ b/web/react/components/team_import_tab.jsx @@ -0,0 +1,68 @@ +// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. +// See License.txt for license information. + +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() { + this.setState({status: 'fail', link: ''}); + }, + onImportSuccess: function(data) { + this.setState({status: 'done', link: 'data:application/octet-stream;charset=utf-8,' + encodeURIComponent(data)}); + }, + doImportSlack: function(file) { + this.setState({status: 'in-progress', link: ''}); + utils.importSlack(file, this.onImportSuccess, this.onImportFailure); + }, + render: function() { + var uploadSection = ( + + ); + + var messageSection; + switch (this.state.status) { + case 'ready': + messageSection = ''; + break; + case 'in-progress': + messageSection = ( +

Importing...

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

Import sucessfull: View Summery

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

Import failure: View Summery

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

Import

+
+
+

Import

+
+ {uploadSection} + {messageSection} +
+
+
+ ); + } +}); -- cgit v1.2.3-1-g7c22