mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-05-07 00:36:15 +02:00
fix: rename 'activities' to 'received' in federation analytics
This commit is contained in:
@@ -67,6 +67,6 @@
|
||||
|
||||
"analytics.intro": "From this page you can view the state of your instance's federation with other servers",
|
||||
"analytics.by-hostname": "Filter by Hostname",
|
||||
"analytics.activities": "Received Activities",
|
||||
"analytics.received": "Received Activities",
|
||||
"analytics.sent": "Sent Activites"
|
||||
}
|
||||
@@ -29,7 +29,7 @@ export function init() {
|
||||
hostFilterEl.addEventListener('change', async function () {
|
||||
const data = await get(`/api${ajaxify.data.url}?host=${this.value}`);
|
||||
|
||||
['activities', 'sent'].forEach((name) => {
|
||||
['received', 'sent'].forEach((name) => {
|
||||
const chart = charts.get(name);
|
||||
chart.data.datasets[0].data = data[name];
|
||||
chart.update();
|
||||
@@ -39,7 +39,7 @@ export function init() {
|
||||
}
|
||||
|
||||
function initializeCharts() {
|
||||
const activitiesCanvas = document.getElementById('activities');
|
||||
const receivedCanvas = document.getElementById('received');
|
||||
const sentCanvas = document.getElementById('sent');
|
||||
// const topicsCanvas = document.getElementById('topics:daily');
|
||||
// const postsCanvas = document.getElementById('posts:daily');
|
||||
@@ -63,7 +63,7 @@ function initializeCharts() {
|
||||
};
|
||||
|
||||
const data = {
|
||||
'activities': {
|
||||
'received': {
|
||||
labels: hourlyLabels,
|
||||
datasets: [
|
||||
{
|
||||
@@ -72,7 +72,7 @@ function initializeCharts() {
|
||||
borderColor: 'rgba(186,139,175,1)',
|
||||
pointBackgroundColor: 'rgba(186,139,175,1)',
|
||||
pointHoverBorderColor: 'rgba(186,139,175,1)',
|
||||
data: ajaxify.data.activities,
|
||||
data: ajaxify.data.received,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -117,7 +117,7 @@ function initializeCharts() {
|
||||
// },
|
||||
};
|
||||
|
||||
activitiesCanvas.width = $(activitiesCanvas).parent().width();
|
||||
receivedCanvas.width = $(receivedCanvas).parent().width();
|
||||
sentCanvas.width = $(sentCanvas).parent().width();
|
||||
// topicsCanvas.width = $(topicsCanvas).parent().width();
|
||||
// postsCanvas.width = $(postsCanvas).parent().width();
|
||||
@@ -133,9 +133,9 @@ function initializeCharts() {
|
||||
};
|
||||
|
||||
return new Map([
|
||||
['activities', new Chart(activitiesCanvas.getContext('2d'), {
|
||||
['received', new Chart(receivedCanvas.getContext('2d'), {
|
||||
type: 'line',
|
||||
data: data.activities,
|
||||
data: data.received,
|
||||
options: chartOpts,
|
||||
})],
|
||||
['sent', new Chart(sentCanvas.getContext('2d'), {
|
||||
|
||||
@@ -62,13 +62,13 @@ federationController.analytics = async function (req, res) {
|
||||
}
|
||||
const set = host ? `activities:byHost:${host}` : 'activities';
|
||||
const sentSet = host ? `ap.out:byHost:${host}` : 'ap:out';
|
||||
const activities = await analytics.getHourlyStatsForSet(set, Date.now(), 24);
|
||||
const received = await analytics.getHourlyStatsForSet(set, Date.now(), 24);
|
||||
const sent = await analytics.getHourlyStatsForSet(sentSet, Date.now(), 24);
|
||||
|
||||
res.render('admin/federation/analytics', {
|
||||
title: '[[admin/menu:federation/analytics]]',
|
||||
instances,
|
||||
activities,
|
||||
received,
|
||||
sent,
|
||||
});
|
||||
};
|
||||
|
||||
@@ -21,10 +21,10 @@
|
||||
|
||||
<div class="mb-4">
|
||||
<div class="card">
|
||||
<div class="card-header">[[admin/settings/activitypub:analytics.activities]]</div>
|
||||
<div class="card-header">[[admin/settings/activitypub:analytics.received]]</div>
|
||||
<div class="card-body">
|
||||
<div class="position-relative" style="aspect-ratio: 2;">
|
||||
<canvas id="activities" height="250"></canvas>
|
||||
<canvas id="received" height="250"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user