You've already forked mattermost-webapp
mirror of
https://github.com/zerotier/mattermost-webapp.git
synced 2026-05-22 16:23:25 -07:00
e76203baa0
* add eslint-plugin-header, and --fix all While the checking feature of this plugin seems to work great, its --fix will sometimes removing leading comments when the license header doesn't match. I've hand-edited the over-zealous removals, so this won't be an issue going forward except for new files with missing headers but leading comments. * fixes from latest master changes * latest changes from master
88 lines
2.7 KiB
React
88 lines
2.7 KiB
React
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
import * as Utils from 'utils/utils.jsx';
|
|
|
|
export function formatChannelDoughtnutData(totalPublic, totalPrivate) {
|
|
const channelTypeData = {
|
|
labels: [
|
|
Utils.localizeMessage('analytics.system.publicChannels', 'Public Channels'),
|
|
Utils.localizeMessage('analytics.system.privateGroups', 'Private Channels'),
|
|
],
|
|
datasets: [{
|
|
data: [totalPublic, totalPrivate],
|
|
backgroundColor: ['#46BFBD', '#FDB45C'],
|
|
hoverBackgroundColor: ['#5AD3D1', '#FFC870'],
|
|
}],
|
|
};
|
|
|
|
return channelTypeData;
|
|
}
|
|
|
|
export function formatPostDoughtnutData(filePosts, hashtagPosts, totalPosts) {
|
|
const postTypeData = {
|
|
labels: [
|
|
Utils.localizeMessage('analytics.system.totalFilePosts', 'Posts with Files'),
|
|
Utils.localizeMessage('analytics.system.totalHashtagPosts', 'Posts with Hashtags'),
|
|
Utils.localizeMessage('analytics.system.textPosts', 'Posts with Text-only'),
|
|
],
|
|
datasets: [{
|
|
data: [filePosts, hashtagPosts, (totalPosts - filePosts - hashtagPosts)],
|
|
backgroundColor: ['#46BFBD', '#F7464A', '#FDB45C'],
|
|
hoverBackgroundColor: ['#5AD3D1', '#FF5A5E', '#FFC870'],
|
|
}],
|
|
};
|
|
|
|
return postTypeData;
|
|
}
|
|
|
|
export function formatPostsPerDayData(data) {
|
|
var chartData = {
|
|
labels: [],
|
|
datasets: [{
|
|
fillColor: 'rgba(151,187,205,0.2)',
|
|
borderColor: 'rgba(151,187,205,1)',
|
|
pointBackgroundColor: 'rgba(151,187,205,1)',
|
|
pointBorderColor: '#fff',
|
|
pointHoverBackgroundColor: '#fff',
|
|
pointHoverBorderColor: 'rgba(151,187,205,1)',
|
|
data: [],
|
|
}],
|
|
};
|
|
|
|
for (var index in data) {
|
|
if (data[index]) {
|
|
var row = data[index];
|
|
chartData.labels.push(row.name);
|
|
chartData.datasets[0].data.push(row.value);
|
|
}
|
|
}
|
|
|
|
return chartData;
|
|
}
|
|
|
|
export function formatUsersWithPostsPerDayData(data) {
|
|
var chartData = {
|
|
labels: [],
|
|
datasets: [{
|
|
label: '',
|
|
fillColor: 'rgba(151,187,205,0.2)',
|
|
borderColor: 'rgba(151,187,205,1)',
|
|
pointBackgroundColor: 'rgba(151,187,205,1)',
|
|
pointBorderColor: '#fff',
|
|
pointHoverBackgroundColor: '#fff',
|
|
pointHoverBorderColor: 'rgba(151,187,205,1)',
|
|
data: [],
|
|
}],
|
|
};
|
|
|
|
for (var index in data) {
|
|
if (data[index]) {
|
|
var row = data[index];
|
|
chartData.labels.push(row.name);
|
|
chartData.datasets[0].data.push(row.value);
|
|
}
|
|
}
|
|
|
|
return chartData;
|
|
}
|