From f6672605e82919798eb23ec45d8e663351af7d97 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Mon, 9 Jan 2017 09:26:07 -0500 Subject: [PATCH] Reorganize stats on system statistics page (#5007) --- .../components/analytics/system_analytics.jsx | 336 +++++++++++------- webapp/i18n/en.json | 2 +- 2 files changed, 201 insertions(+), 137 deletions(-) diff --git a/webapp/components/analytics/system_analytics.jsx b/webapp/components/analytics/system_analytics.jsx index 244e1ff072..dd7b902605 100644 --- a/webapp/components/analytics/system_analytics.jsx +++ b/webapp/components/analytics/system_analytics.jsx @@ -80,68 +80,140 @@ class SystemAnalytics extends React.Component { render() { const stats = this.state.stats; + const isLicensed = global.window.mm_license.IsLicensed === 'true'; + const skippedIntensiveQueries = stats[StatTypes.TOTAL_POSTS] === -1; + const postCountsDay = formatPostsPerDayData(stats[StatTypes.POST_PER_DAY]); + const userCountsWithPostsDay = formatUsersWithPostsPerDayData(stats[StatTypes.USERS_WITH_POSTS_PER_DAY]); let banner; - if (stats[StatTypes.TOTAL_POSTS] === -1) { + let postCount; + let postTotalGraph; + let activeUserGraph; + if (skippedIntensiveQueries) { banner = ( - +
+
+ + ); + } else { + postCount = ( + } + 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' + /> +
+ ); } - let advancedCounts; let advancedStats; let advancedGraphs; + let sessionCount; + let commandCount; + let incomingCount; + let outgoingCount; if (global.window.mm_license.IsLicensed === 'true') { - advancedCounts = ( -
- - } - icon='fa-signal' - count={stats[StatTypes.TOTAL_SESSIONS]} - /> - - } - icon='fa-terminal' - count={stats[StatTypes.TOTAL_COMMANDS]} - /> - - } - icon='fa-arrow-down' - count={stats[StatTypes.TOTAL_IHOOKS]} - /> - - } - icon='fa-arrow-up' - count={stats[StatTypes.TOTAL_OHOOKS]} - /> -
+ sessionCount = ( + + } + icon='fa-signal' + count={stats[StatTypes.TOTAL_SESSIONS]} + /> + ); + + commandCount = ( + + } + icon='fa-terminal' + count={stats[StatTypes.TOTAL_COMMANDS]} + /> + ); + + incomingCount = ( + + } + icon='fa-arrow-down' + count={stats[StatTypes.TOTAL_IHOOKS]} + /> + ); + + outgoingCount = ( + + } + icon='fa-arrow-up' + count={stats[StatTypes.TOTAL_OHOOKS]} + /> ); advancedStats = ( @@ -247,65 +319,89 @@ 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' + const userCount = ( + + } + icon='fa-user' + count={stats[StatTypes.TOTAL_USERS]} + /> + ); + + const teamCount = ( + + } + icon='fa-users' + count={stats[StatTypes.TOTAL_TEAMS]} + /> + ); + + const channelCount = ( + + } + icon='fa-globe' + count={stats[StatTypes.TOTAL_PUBLIC_CHANNELS] + stats[StatTypes.TOTAL_PRIVATE_GROUPS]} + /> + ); + + let firstRow; + let secondRow; + if (isLicensed && skippedIntensiveQueries) { + firstRow = ( +
+ {userCount} + {teamCount} + {channelCount} + {sessionCount}
); - activeUserGraph = ( + secondRow = (
- - } - data={userCountsWithPostsDay} - options={{ - legend: { - display: false - } - }} - width='740' - height='225' - /> + {commandCount} + {incomingCount} + {outgoingCount} +
+ ); + } else if (isLicensed && !skippedIntensiveQueries) { + firstRow = ( +
+ {userCount} + {teamCount} + {channelCount} + {postCount} +
+ ); + + secondRow = ( +
+ {sessionCount} + {commandCount} + {incomingCount} + {outgoingCount} +
+ ); + } else if (!isLicensed) { + firstRow = ( +
+ {userCount} + {teamCount} + {channelCount} + {postCount}
); } @@ -319,40 +415,8 @@ class SystemAnalytics extends React.Component { /> {banner} -
- - } - icon='fa-user' - count={stats[StatTypes.TOTAL_USERS]} - /> - - } - icon='fa-users' - count={stats[StatTypes.TOTAL_TEAMS]} - /> - {totalPostsCount} - - } - icon='fa-globe' - count={stats[StatTypes.TOTAL_PUBLIC_CHANNELS] + stats[StatTypes.TOTAL_PRIVATE_GROUPS]} - /> -
- {advancedCounts} + {firstRow} + {secondRow} {advancedStats} {advancedGraphs} {postTotalGraph} diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json index 66a58e0c5a..416b268dee 100644 --- a/webapp/i18n/en.json +++ b/webapp/i18n/en.json @@ -922,7 +922,7 @@ "analytics.chart.loading": "Loading...", "analytics.chart.meaningful": "Not enough data for a meaningful representation.", "analytics.system.activeUsers": "Active Users With Posts", - "analytics.system.skippedIntensiveQueries": "Some statistics have been omitted because they put too much load on the system to calculate. See https://docs.mattermost.com/administration/statistics.html for more details.", + "analytics.system.skippedIntensiveQueries": "To maximize performance, some statistics are disabled. You can re-enable them in config.json. See: https://docs.mattermost.com/administration/statistics.html", "analytics.system.channelTypes": "Channel Types", "analytics.system.expiredBanner": "The Enterprise license expired on {date}. You have 15 days from this date to renew the license, please contact commercial@mattermost.com.", "analytics.system.expiringBanner": "The Enterprise license is expiring on {date}. To renew your license, please contact commercial@mattermost.com.",