// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. import * as Utils from '../../utils/utils.jsx'; import Constants from '../../utils/constants.jsx'; import LineChart from './line_chart.jsx'; var Tooltip = ReactBootstrap.Tooltip; var OverlayTrigger = ReactBootstrap.OverlayTrigger; import {FormattedMessage} from 'mm-intl'; export default class Analytics extends React.Component { constructor(props) { super(props); this.state = {}; } render() { // in the future, break down these into smaller components var serverError = ''; if (this.props.serverError) { serverError =
; } let loading = ( ); var totalCount = (
{this.props.uniqueUserCount == null ? loading : this.props.uniqueUserCount}
); var openChannelCount = (
{this.props.channelOpenCount == null ? loading : this.props.channelOpenCount}
); var openPrivateCount = (
{this.props.channelPrivateCount == null ? loading : this.props.channelPrivateCount}
); var postCount = (
{this.props.postCount == null ? loading : this.props.postCount}
); var postCountsByDay = (
{loading}
); if (this.props.postCountsDay != null) { let content; if (this.props.postCountsDay.labels.length === 0) { content = ( ); } else { content = ( ); } postCountsByDay = (
{content}
); } var usersWithPostsByDay = (
{loading}
); if (this.props.userCountsWithPostsDay != null) { let content; if (this.props.userCountsWithPostsDay.labels.length === 0) { content = ( ); } else { content = ( ); } usersWithPostsByDay = (
{content}
); } let recentActiveUser; if (this.props.recentActiveUsers != null) { let content; if (this.props.recentActiveUsers.length === 0) { content = loading; } else { content = ( { this.props.recentActiveUsers.map((user) => { const tooltip = ( {user.email} ); return ( ); }) }
{Utils.displayDateTime(user.last_activity_at)}
); } recentActiveUser = (
{content}
); } let newUsers; if (this.props.newlyCreatedUsers != null) { let content; if (this.props.newlyCreatedUsers.length === 0) { content = loading; } else { content = ( { this.props.newlyCreatedUsers.map((user) => { const tooltip = ( {user.email} ); return ( ); }) }
{Utils.displayDateTime(user.create_at)}
); } newUsers = (
{content}
); } return (

{serverError}
{totalCount} {postCount} {openChannelCount} {openPrivateCount}
{postCountsByDay}
{usersWithPostsByDay}
{recentActiveUser} {newUsers}
); } } Analytics.defaultProps = { title: null, channelOpenCount: null, channelPrivateCount: null, postCount: null, postCountsDay: null, userCountsWithPostsDay: null, recentActiveUsers: null, newlyCreatedUsers: null, uniqueUserCount: null, serverError: null }; Analytics.propTypes = { title: React.PropTypes.string, channelOpenCount: React.PropTypes.number, channelPrivateCount: React.PropTypes.number, postCount: React.PropTypes.number, postCountsDay: React.PropTypes.object, userCountsWithPostsDay: React.PropTypes.object, recentActiveUsers: React.PropTypes.array, newlyCreatedUsers: React.PropTypes.array, uniqueUserCount: React.PropTypes.number, serverError: React.PropTypes.string };