// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import Client from 'utils/web_client.jsx'; import {FormattedMessage} from 'react-intl'; import React from 'react'; import {Link} from 'react-router'; 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 = (

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

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

); break; } return (

{messageSection}
); } }