mirror of
https://github.com/ajvpot/meshexplorer.git
synced 2026-08-06 08:32:45 +02:00
stats
This commit is contained in:
@@ -4,22 +4,22 @@ import { clickhouse } from "@/lib/clickhouse/clickhouse";
|
||||
export async function GET() {
|
||||
try {
|
||||
const query = `
|
||||
WITH days AS (
|
||||
SELECT arrayJoin(range(0, 7)) AS offset, toDate(subtractDays(today(), 6 - offset)) AS day
|
||||
),
|
||||
all_nodes AS (
|
||||
WITH all_nodes AS (
|
||||
SELECT toDate(ingest_timestamp) AS day, public_key, latitude, longitude
|
||||
FROM meshcore_adverts
|
||||
WHERE ingest_timestamp >= subtractDays(today(), 7)
|
||||
),
|
||||
node_days AS (
|
||||
SELECT public_key, min(day) AS first_seen, any(latitude) AS latitude, any(longitude) AS longitude
|
||||
FROM all_nodes
|
||||
GROUP BY public_key
|
||||
),
|
||||
all_days AS (
|
||||
SELECT DISTINCT day FROM all_nodes
|
||||
ORDER BY day ASC
|
||||
),
|
||||
expanded AS (
|
||||
SELECT d.day, nd.public_key, nd.latitude, nd.longitude
|
||||
FROM days d
|
||||
FROM all_days d
|
||||
INNER JOIN node_days nd ON nd.first_seen <= d.day
|
||||
)
|
||||
SELECT day,
|
||||
|
||||
@@ -27,14 +27,6 @@ export default function StatsPage() {
|
||||
return (
|
||||
<div className="max-w-2xl mx-auto py-8 px-4">
|
||||
<h1 className="text-2xl font-bold mb-6">MeshCore Network Stats</h1>
|
||||
|
||||
<div className="mb-6 p-3 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg">
|
||||
<p className="text-sm text-blue-800 dark:text-blue-200">
|
||||
<strong>Note:</strong> The “Nodes Heard Over Time” data shows activity from the past 7 days.
|
||||
This provides a focused view of recent network activity while maintaining good performance.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{loading ? (
|
||||
<div>Loading...</div>
|
||||
) : (
|
||||
@@ -46,6 +38,9 @@ export default function StatsPage() {
|
||||
|
||||
<div className="mb-6">
|
||||
<h2 className="text-lg font-semibold mb-2">Nodes Heard Over Time</h2>
|
||||
<p className="text-sm text-gray-600 dark:text-gray-400 mb-3">
|
||||
Shows nodes heard within the last 7 days by date.
|
||||
</p>
|
||||
<table className="w-full text-sm border">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user