summaryrefslogtreecommitdiffstats
path: root/webapp/components/analytics
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-05-17 07:21:39 -0400
committerChristopher Speller <crspeller@gmail.com>2016-05-17 07:21:39 -0400
commitfd53e3b7868234af328cd73150318fc8e7a26b89 (patch)
tree48c49af0d6b25bf978430efc61aa5b3b63b3414a /webapp/components/analytics
parent5f5f813387a914d6e34945490c438755adfa8505 (diff)
downloadchat-fd53e3b7868234af328cd73150318fc8e7a26b89.tar.gz
chat-fd53e3b7868234af328cd73150318fc8e7a26b89.tar.bz2
chat-fd53e3b7868234af328cd73150318fc8e7a26b89.zip
PLT-2257 Reorganized System Console (#3003)
* Reorganized system console * Fixed the names of some components * Fixed timestamp for BrandImageSetting * Fixed merge issues * Updated push notification settings to match master branch * Removed top level setting pages and moved enable Gitlab/LDAP settings onto their respective pages * Re-added restrictDirectMessage setting to system console * Re-added email connection test and fixed some margins * Fixed ESLint errors * Renamed Authentication > Onboarding to Authentication > Email in the system console * Renamed Customization > Whitelabeling to Customization > Custom Branding in System Console * Re-added EnableOpenServer to system console
Diffstat (limited to 'webapp/components/analytics')
-rw-r--r--webapp/components/analytics/system_analytics.jsx3
-rw-r--r--webapp/components/analytics/team_analytics.jsx52
2 files changed, 37 insertions, 18 deletions
diff --git a/webapp/components/analytics/system_analytics.jsx b/webapp/components/analytics/system_analytics.jsx
index 77f5efaa6..1625a919e 100644
--- a/webapp/components/analytics/system_analytics.jsx
+++ b/webapp/components/analytics/system_analytics.jsx
@@ -245,8 +245,7 @@ class SystemAnalytics extends React.Component {
}
SystemAnalytics.propTypes = {
- intl: intlShape.isRequired,
- team: React.PropTypes.object
+ intl: intlShape.isRequired
};
export default injectIntl(SystemAnalytics);
diff --git a/webapp/components/analytics/team_analytics.jsx b/webapp/components/analytics/team_analytics.jsx
index 9b4eb1f94..ffca9199a 100644
--- a/webapp/components/analytics/team_analytics.jsx
+++ b/webapp/components/analytics/team_analytics.jsx
@@ -5,6 +5,7 @@ import LineChart from './line_chart.jsx';
import StatisticCount from './statistic_count.jsx';
import TableChart from './table_chart.jsx';
+import AdminStore from 'stores/admin_store.jsx';
import AnalyticsStore from 'stores/analytics_store.jsx';
import * as Utils from 'utils/utils.jsx';
@@ -13,23 +14,34 @@ import Constants from 'utils/constants.jsx';
const StatTypes = Constants.StatTypes;
import {formatPostsPerDayData, formatUsersWithPostsPerDayData} from './system_analytics.jsx';
-import {injectIntl, intlShape, FormattedMessage, FormattedDate} from 'react-intl';
+import {FormattedMessage, FormattedDate} from 'react-intl';
import React from 'react';
-class TeamAnalytics extends React.Component {
+export default class TeamAnalytics extends React.Component {
+ static get propTypes() {
+ return {
+ params: React.PropTypes.object.isRequired
+ };
+ }
+
constructor(props) {
super(props);
this.onChange = this.onChange.bind(this);
+ this.onAllTeamsChange = this.onAllTeamsChange.bind(this);
- this.state = {stats: AnalyticsStore.getAllTeam(this.props.team.id)};
+ this.state = {
+ team: AdminStore.getTeam(this.props.params.team),
+ stats: AnalyticsStore.getAllTeam(this.props.params.team)
+ };
}
componentDidMount() {
AnalyticsStore.addChangeListener(this.onChange);
+ AdminStore.addAllTeamsChangeListener(this.onAllTeamsChange);
- this.getData(this.props.team.id);
+ this.getData(this.props.params.team);
}
getData(id) {
@@ -41,11 +53,14 @@ class TeamAnalytics extends React.Component {
componentWillUnmount() {
AnalyticsStore.removeChangeListener(this.onChange);
+ AdminStore.removeAllTeamsChangeListener(this.onAllTeamsChange);
}
componentWillReceiveProps(nextProps) {
- this.getData(nextProps.team.id);
- this.setState({stats: AnalyticsStore.getAllTeam(nextProps.team.id)});
+ this.getData(nextProps.params.team);
+ this.setState({
+ stats: AnalyticsStore.getAllTeam(nextProps.params.team)
+ });
}
shouldComponentUpdate(nextProps, nextState) {
@@ -53,7 +68,7 @@ class TeamAnalytics extends React.Component {
return true;
}
- if (!Utils.areObjectsEqual(nextProps.team, this.props.team)) {
+ if (!Utils.areObjectsEqual(nextProps.params.team, this.props.params.team)) {
return true;
}
@@ -61,10 +76,22 @@ class TeamAnalytics extends React.Component {
}
onChange() {
- this.setState({stats: AnalyticsStore.getAllTeam(this.props.team.id)});
+ this.setState({
+ stats: AnalyticsStore.getAllTeam(this.props.params.team)
+ });
+ }
+
+ onAllTeamsChange() {
+ this.setState({
+ team: AdminStore.getTeam(this.props.params.team)
+ });
}
render() {
+ if (!this.state.team || !this.state.stats) {
+ return null;
+ }
+
const stats = this.state.stats;
const postCountsDay = formatPostsPerDayData(stats[StatTypes.POST_PER_DAY]);
const userCountsWithPostsDay = formatUsersWithPostsPerDayData(stats[StatTypes.USERS_WITH_POSTS_PER_DAY]);
@@ -78,7 +105,7 @@ class TeamAnalytics extends React.Component {
id='analytics.team.title'
defaultMessage='Team Statistics for {team}'
values={{
- team: this.props.team.name
+ team: this.state.team.name
}}
/>
</h3>
@@ -175,13 +202,6 @@ class TeamAnalytics extends React.Component {
}
}
-TeamAnalytics.propTypes = {
- intl: intlShape.isRequired,
- team: React.PropTypes.object.isRequired
-};
-
-export default injectIntl(TeamAnalytics);
-
export function formatRecentUsersData(data) {
if (data == null) {
return [];