From e0a005eed84ec788babdc0ffe7a3d99a466f7923 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Wed, 4 Jan 2017 14:24:04 -0500 Subject: Hide skipped statistics in system console and add note (#4961) --- webapp/components/analytics/system_analytics.jsx | 147 ++++++++++++++--------- webapp/components/analytics/team_analytics.jsx | 126 +++++++++++-------- 2 files changed, 171 insertions(+), 102 deletions(-) (limited to 'webapp/components') diff --git a/webapp/components/analytics/system_analytics.jsx b/webapp/components/analytics/system_analytics.jsx index a50a33812..244e1ff07 100644 --- a/webapp/components/analytics/system_analytics.jsx +++ b/webapp/components/analytics/system_analytics.jsx @@ -81,10 +81,23 @@ class SystemAnalytics extends React.Component { render() { const stats = this.state.stats; + let banner; + if (stats[StatTypes.TOTAL_POSTS] === -1) { + banner = ( + + } + /> + ); + } + let advancedCounts; let advancedStats; let advancedGraphs; - let banner; if (global.window.mm_license.IsLicensed === 'true') { advancedCounts = (
@@ -169,30 +182,37 @@ class SystemAnalytics extends React.Component { const channelTypeData = formatChannelDoughtnutData(stats[StatTypes.TOTAL_PUBLIC_CHANNELS], stats[StatTypes.TOTAL_PRIVATE_GROUPS], this.props.intl); const postTypeData = formatPostDoughtnutData(stats[StatTypes.TOTAL_FILE_POSTS], stats[StatTypes.TOTAL_HASHTAG_POSTS], stats[StatTypes.TOTAL_POSTS], this.props.intl); - advancedGraphs = ( -
+ let postTypeGraph; + if (stats[StatTypes.TOTAL_POSTS] !== -1) { + postTypeGraph = ( } - data={channelTypeData} + data={postTypeData} width='300' height='225' /> + ); + } + + advancedGraphs = ( +
} - data={postTypeData} + data={channelTypeData} width='300' height='225' /> + {postTypeGraph}
); @@ -230,6 +250,66 @@ class SystemAnalytics extends React.Component { const postCountsDay = formatPostsPerDayData(stats[StatTypes.POST_PER_DAY]); const userCountsWithPostsDay = formatUsersWithPostsPerDayData(stats[StatTypes.USERS_WITH_POSTS_PER_DAY]); + let totalPostsCount; + let postTotalGraph; + let activeUserGraph; + if (stats[StatTypes.TOTAL_POSTS] !== -1) { + totalPostsCount = ( + + } + icon='fa-comment' + count={stats[StatTypes.TOTAL_POSTS]} + /> + ); + + postTotalGraph = ( +
+ + } + data={postCountsDay} + options={{ + legend: { + display: false + } + }} + width='740' + height='225' + /> +
+ ); + + activeUserGraph = ( +
+ + } + data={userCountsWithPostsDay} + options={{ + legend: { + display: false + } + }} + width='740' + height='225' + /> +
+ ); + } + return (

@@ -260,16 +340,7 @@ class SystemAnalytics extends React.Component { icon='fa-users' count={stats[StatTypes.TOTAL_TEAMS]} /> - - } - icon='fa-comment' - count={stats[StatTypes.TOTAL_POSTS]} - /> + {totalPostsCount} - - } - data={postCountsDay} - options={{ - legend: { - display: false - } - }} - width='740' - height='225' - /> -

-
- - } - data={userCountsWithPostsDay} - options={{ - legend: { - display: false - } - }} - width='740' - height='225' - /> -
+ {postTotalGraph} + {activeUserGraph}
); } diff --git a/webapp/components/analytics/team_analytics.jsx b/webapp/components/analytics/team_analytics.jsx index 574a388d0..66eb7e2db 100644 --- a/webapp/components/analytics/team_analytics.jsx +++ b/webapp/components/analytics/team_analytics.jsx @@ -1,6 +1,7 @@ // Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. +import Banner from 'components/admin_console/banner.jsx'; import LineChart from './line_chart.jsx'; import StatisticCount from './statistic_count.jsx'; import TableChart from './table_chart.jsx'; @@ -14,7 +15,7 @@ import Constants from 'utils/constants.jsx'; const StatTypes = Constants.StatTypes; import {formatPostsPerDayData, formatUsersWithPostsPerDayData} from './system_analytics.jsx'; -import {FormattedMessage, FormattedDate} from 'react-intl'; +import {FormattedMessage, FormattedDate, FormattedHTMLMessage} from 'react-intl'; import React from 'react'; @@ -95,6 +96,79 @@ export default class TeamAnalytics extends React.Component { const stats = this.state.stats; const postCountsDay = formatPostsPerDayData(stats[StatTypes.POST_PER_DAY]); const userCountsWithPostsDay = formatUsersWithPostsPerDayData(stats[StatTypes.USERS_WITH_POSTS_PER_DAY]); + + let banner; + let totalPostsCount; + let postTotalGraph; + let userActiveGraph; + if (stats[StatTypes.TOTAL_POSTS] === -1) { + banner = ( + + } + /> + ); + } else { + totalPostsCount = ( + + } + icon='fa-comment' + count={stats[StatTypes.TOTAL_POSTS]} + /> + ); + + postTotalGraph = ( +
+ + } + data={postCountsDay} + options={{ + legend: { + display: false + } + }} + width='740' + height='225' + /> +
+ ); + + userActiveGraph = ( +
+ + } + data={userCountsWithPostsDay} + options={{ + legend: { + display: false + } + }} + width='740' + height='225' + /> +
+ ); + } + const recentActiveUsers = formatRecentUsersData(stats[StatTypes.RECENTLY_ACTIVE_USERS]); const newlyCreatedUsers = formatNewUsersData(stats[StatTypes.NEWLY_CREATED_USERS]); @@ -109,6 +183,7 @@ export default class TeamAnalytics extends React.Component { }} /> + {banner}
- - } - icon='fa-comment' - count={stats[StatTypes.TOTAL_POSTS]} - /> -
-
- - } - data={postCountsDay} - options={{ - legend: { - display: false - } - }} - width='740' - height='225' - /> -
-
- - } - data={userCountsWithPostsDay} - options={{ - legend: { - display: false - } - }} - width='740' - height='225' - /> + {totalPostsCount}
+ {postTotalGraph} + {userActiveGraph}