diff options
author | Christopher Speller <crspeller@gmail.com> | 2015-08-26 15:24:17 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2015-08-26 15:24:17 -0400 |
commit | 1ed6718dd964d418ac279e89bba87d346f8aad20 (patch) | |
tree | 1b1fb92fc4e25d3f079de21906f4a8da3e2cda0e | |
parent | 378f0b52c10d3b9dc670da34a0043b7e05f3e93c (diff) | |
download | chat-1ed6718dd964d418ac279e89bba87d346f8aad20.tar.gz chat-1ed6718dd964d418ac279e89bba87d346f8aad20.tar.bz2 chat-1ed6718dd964d418ac279e89bba87d346f8aad20.zip |
Improvements to import UI
-rw-r--r-- | api/slackimport.go | 28 | ||||
-rw-r--r-- | web/react/components/setting_upload.jsx | 18 | ||||
-rw-r--r-- | web/react/components/team_import_tab.jsx | 16 |
3 files changed, 31 insertions, 31 deletions
diff --git a/api/slackimport.go b/api/slackimport.go index ca3fdf3d1..1d037a934 100644 --- a/api/slackimport.go +++ b/api/slackimport.go @@ -82,8 +82,8 @@ func SlackParsePosts(data io.Reader) []SlackPost { func SlackAddUsers(teamId string, slackusers []SlackUser, log *bytes.Buffer) map[string]*model.User { // Log header - log.WriteString("\n Users Created\n") - log.WriteString("===============\n\n") + log.WriteString("\r\n Users Created\r\n") + log.WriteString("===============\r\n\r\n") addedUsers := make(map[string]*model.User) for _, sUser := range slackusers { @@ -109,9 +109,9 @@ func SlackAddUsers(teamId string, slackusers []SlackUser, log *bytes.Buffer) map if mUser := ImportUser(&newUser); mUser != nil { addedUsers[sUser.Id] = mUser - log.WriteString("Email, Password: " + newUser.Email + ", " + password + "\n") + log.WriteString("Email, Password: " + newUser.Email + ", " + password + "\r\n") } else { - log.WriteString("Unable to import user: " + sUser.Username) + log.WriteString("Unable to import user: " + sUser.Username + "\r\n") } } @@ -163,8 +163,8 @@ func SlackAddPosts(channel *model.Channel, posts []SlackPost, users map[string]* func SlackAddChannels(teamId string, slackchannels []SlackChannel, posts map[string][]SlackPost, users map[string]*model.User, log *bytes.Buffer) map[string]*model.Channel { // Write Header - log.WriteString("\n Channels Added \n") - log.WriteString("=================\n\n") + log.WriteString("\r\n Channels Added \r\n") + log.WriteString("=================\r\n\r\n") addedChannels := make(map[string]*model.Channel) for _, sChannel := range slackchannels { @@ -180,14 +180,14 @@ func SlackAddChannels(teamId string, slackchannels []SlackChannel, posts map[str // Maybe it already exists? if result := <-Srv.Store.Channel().GetByName(teamId, sChannel.Name); result.Err != nil { l4g.Debug("Failed to import: %s", newChannel.DisplayName) - log.WriteString("Failed to import: " + newChannel.DisplayName + "\n") + log.WriteString("Failed to import: " + newChannel.DisplayName + "\r\n") continue } else { mChannel = result.Data.(*model.Channel) - log.WriteString("Merged with existing channel: " + newChannel.DisplayName + "\n") + log.WriteString("Merged with existing channel: " + newChannel.DisplayName + "\r\n") } } - log.WriteString(newChannel.DisplayName + "\n") + log.WriteString(newChannel.DisplayName + "\r\n") addedChannels[sChannel.Id] = mChannel SlackAddPosts(mChannel, posts[sChannel.Name], users) } @@ -202,7 +202,7 @@ func SlackImport(fileData multipart.File, fileSize int64, teamID string) (*model } // Create log file - log := bytes.NewBufferString("Mattermost Slack Import Log\n") + log := bytes.NewBufferString("Mattermost Slack Import Log\r\n") var channels []SlackChannel var users []SlackUser @@ -234,11 +234,11 @@ func SlackImport(fileData multipart.File, fileSize int64, teamID string) (*model addedUsers := SlackAddUsers(teamID, users, log) SlackAddChannels(teamID, channels, posts, addedUsers, log) - log.WriteString("\n Notes \n") - log.WriteString("=======\n\n") + log.WriteString("\r\n Notes \r\n") + log.WriteString("=======\r\n\r\n") - log.WriteString("- Some posts may not have been imported because they where not supported by this importer.\n") - log.WriteString("- Slack bot posts are currently not supported.\n") + log.WriteString("- Some posts may not have been imported because they where not supported by this importer.\r\n") + log.WriteString("- Slack bot posts are currently not supported.\r\n") return nil, log } diff --git a/web/react/components/setting_upload.jsx b/web/react/components/setting_upload.jsx index 02789f5dd..596324308 100644 --- a/web/react/components/setting_upload.jsx +++ b/web/react/components/setting_upload.jsx @@ -8,7 +8,8 @@ module.exports = React.createClass({ submit: React.PropTypes.func.isRequired, fileTypesAccepted: React.PropTypes.string.isRequired, clientError: React.PropTypes.string, - serverError: React.PropTypes.string + serverError: React.PropTypes.string, + helpText: React.PropTypes.string }, getInitialState: function() { return { @@ -38,14 +39,6 @@ module.exports = React.createClass({ this.setState({clientError: 'No file selected.'}); } }, - doCancel: function(e) { - e.preventDefault(); - this.refs.uploadinput.getDOMNode().value = ''; - this.setState({ - clientError: '', - serverError: '' - }); - }, onFileSelect: function(e) { var filename = $(e.target).val(); if (filename.substring(3, 11) === 'fakepath') { @@ -70,6 +63,7 @@ module.exports = React.createClass({ return ( <ul className='section-max'> <li className='col-xs-12 section-title'>{this.props.title}</li> + <li className='col-xs-offset-3'>{this.props.helpText}</li> <li className='col-xs-offset-3 col-xs-8'> <ul className='setting-list'> <li className='setting-list-item'> @@ -79,12 +73,6 @@ module.exports = React.createClass({ onClick={this.doSubmit}> Import </a> - <a - className='btn btn-sm btn-link theme' - href='#' - onClick={this.doCancel}> - Cancel - </a> <div className='file-status file-name hide'></div> {serverError} {clientError} diff --git a/web/react/components/team_import_tab.jsx b/web/react/components/team_import_tab.jsx index c21701c0e..ecb3491b0 100644 --- a/web/react/components/team_import_tab.jsx +++ b/web/react/components/team_import_tab.jsx @@ -20,10 +20,22 @@ module.exports = React.createClass({ utils.importSlack(file, this.onImportSuccess, this.onImportFailure); }, render: function() { + var uploadHelpText = ( + <div> + <br/> + Slack does now allow you to export any of your files or images stored in slack. Private channels and direct message channels are also not exported. Therefore, no files, images, or private channels will be imported. + <br/> + Slack bot posts are not imported. + <br/> + Unable to import Slack channels that are not valid Mattermost channels. (ex underscores) + <br/> + </div> + ); var uploadSection = ( <SettingUpload title='Import from Slack' submit={this.doImportSlack} + helpText={uploadHelpText} fileTypesAccepted='.zip'/> ); @@ -39,12 +51,12 @@ module.exports = React.createClass({ break; case 'done': messageSection = ( - <p className="confirm-import alert alert-success"><i className="fa fa-check"></i> Import sucessfull: <a href={this.state.link} download='MattermostImportSummery.txt'>View Summery</a></p> + <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='MattermostImportSummery.txt'>View Summery</a></p> + <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; } |