mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Adding post counts by days
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
// See License.txt for license information.
|
||||
|
||||
var Client = require('../../utils/client.jsx');
|
||||
var LoadingScreen = require('../loading_screen.jsx');
|
||||
|
||||
export default class UserList extends React.Component {
|
||||
constructor(props) {
|
||||
@@ -15,7 +14,8 @@ export default class UserList extends React.Component {
|
||||
serverError: null,
|
||||
channel_open_count: null,
|
||||
channel_private_count: null,
|
||||
post_count: null
|
||||
post_count: null,
|
||||
post_counts_day: null
|
||||
};
|
||||
}
|
||||
|
||||
@@ -47,6 +47,18 @@ export default class UserList extends React.Component {
|
||||
}
|
||||
);
|
||||
|
||||
Client.getAnalytics(
|
||||
teamId,
|
||||
'post_counts_day',
|
||||
(data) => {
|
||||
console.log(data);
|
||||
this.setState({post_counts_day: data});
|
||||
},
|
||||
(err) => {
|
||||
this.setState({serverError: err.message});
|
||||
}
|
||||
);
|
||||
|
||||
Client.getProfilesForTeam(
|
||||
teamId,
|
||||
(users) => {
|
||||
@@ -83,7 +95,8 @@ export default class UserList extends React.Component {
|
||||
serverError: null,
|
||||
channel_open_count: null,
|
||||
channel_private_count: null,
|
||||
post_count: null
|
||||
post_count: null,
|
||||
post_counts_day: null
|
||||
});
|
||||
|
||||
this.getData(newProps.team.id);
|
||||
@@ -126,6 +139,26 @@ export default class UserList extends React.Component {
|
||||
</div>
|
||||
);
|
||||
|
||||
var postCountsByDay = (
|
||||
<div className='total-count text-center'>
|
||||
<div>{'Total Posts'}</div>
|
||||
<div>{'Loading...'}</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
if (this.state.post_counts_day != null) {
|
||||
postCountsByDay = (
|
||||
<div className='total-count-by-day'>
|
||||
<div>{'Total Posts By Day'}</div>
|
||||
<LineChart
|
||||
data={chartData}
|
||||
width="100"
|
||||
height="250"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='wrapper--fixed'>
|
||||
<h2>{'Analytics for ' + this.props.team.name}</h2>
|
||||
@@ -134,6 +167,7 @@ export default class UserList extends React.Component {
|
||||
{postCount}
|
||||
{openChannelCount}
|
||||
{openPrivateCount}
|
||||
{postCountsByDay}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
.total-count-by-day {
|
||||
width: 760px;
|
||||
height: 275px;
|
||||
border: 1px solid #ddd;
|
||||
padding: 5px 10px 10px 10px;
|
||||
margin: 10px 10px 10px 10px;
|
||||
background: #fff;
|
||||
clear: both;
|
||||
|
||||
> div {
|
||||
font-size: 18px;
|
||||
font-weight: 300;
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar--left {
|
||||
&.sidebar--collapsable {
|
||||
background: #333;
|
||||
|
||||
Reference in New Issue
Block a user