mirror of
https://github.com/ajvpot/meshexplorer.git
synced 2026-03-28 17:42:58 +01:00
add analyze links to PathVisualization
This commit is contained in:
@@ -17,6 +17,7 @@ interface AdvertDetailsProps {
|
||||
is_chat_node: number;
|
||||
is_room_server: number;
|
||||
has_location: number;
|
||||
packet_hash: string;
|
||||
};
|
||||
initiatingNodeKey?: string;
|
||||
}
|
||||
@@ -97,6 +98,7 @@ export default function AdvertDetails({ advert, initiatingNodeKey }: AdvertDetai
|
||||
}))}
|
||||
className="text-sm"
|
||||
initiatingNodeKey={initiatingNodeKey}
|
||||
packetHash={advert.packet_hash}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -160,6 +160,7 @@ function ChatMessageItem({ msg, showErrorRow }: { msg: ChatMessage, showErrorRow
|
||||
paths={pathData}
|
||||
title={`Heard ${pathData.length} repeat${pathData.length !== 1 ? 's' : ''}`}
|
||||
className="text-xs"
|
||||
packetHash={msg.message_id}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
@@ -180,6 +181,7 @@ function ChatMessageItem({ msg, showErrorRow }: { msg: ChatMessage, showErrorRow
|
||||
paths={pathData}
|
||||
title={`Heard ${pathData.length} repeat${pathData.length !== 1 ? 's' : ''}`}
|
||||
className="text-xs"
|
||||
packetHash={msg.message_id}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
@@ -200,6 +202,7 @@ function ChatMessageItem({ msg, showErrorRow }: { msg: ChatMessage, showErrorRow
|
||||
paths={pathData}
|
||||
title={`Heard ${pathData.length} repeat${pathData.length !== 1 ? 's' : ''}`}
|
||||
className="text-xs"
|
||||
packetHash={msg.message_id}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -5,6 +5,7 @@ import { createPortal } from "react-dom";
|
||||
import Link from "next/link";
|
||||
import Tree from 'react-d3-tree';
|
||||
import { ArrowsPointingOutIcon, ArrowsPointingInIcon } from "@heroicons/react/24/outline";
|
||||
import { ExternalLink } from "lucide-react";
|
||||
import PathDisplay from "./PathDisplay";
|
||||
import { useMeshcoreSearches } from "@/hooks/useMeshcoreSearch";
|
||||
import type { MeshcoreSearchResult } from "@/hooks/useMeshcoreSearch";
|
||||
@@ -33,6 +34,7 @@ interface PathVisualizationProps {
|
||||
className?: string;
|
||||
showDropdown?: boolean;
|
||||
initiatingNodeKey?: string;
|
||||
packetHash?: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +43,8 @@ export default function PathVisualization({
|
||||
title = "Paths",
|
||||
className = "",
|
||||
showDropdown = true,
|
||||
initiatingNodeKey
|
||||
initiatingNodeKey,
|
||||
packetHash
|
||||
}: PathVisualizationProps) {
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
const [showGraph, setShowGraph] = useState(false);
|
||||
@@ -340,6 +343,17 @@ export default function PathVisualization({
|
||||
<span>{showGraph ? 'Hide Graph' : 'Show Graph'}</span>
|
||||
</button>
|
||||
)}
|
||||
{packetHash && (
|
||||
<a
|
||||
href={`https://analyzer.letsme.sh/packets?packet_hash=${packetHash}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center gap-1 hover:text-gray-800 dark:hover:text-gray-100 transition-colors text-sm"
|
||||
>
|
||||
<span>Analyze</span>
|
||||
<ExternalLink className="w-3 h-3" />
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
<PathsList />
|
||||
{showGraph && <GraphView />}
|
||||
@@ -373,6 +387,18 @@ export default function PathVisualization({
|
||||
<span>{showGraph ? 'Hide Graph' : 'Show Graph'}</span>
|
||||
</button>
|
||||
)}
|
||||
|
||||
{packetHash && (
|
||||
<a
|
||||
href={`https://analyzer.letsme.sh/packets?packet_hash=${packetHash}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center gap-1 hover:text-gray-800 dark:hover:text-gray-100 transition-colors"
|
||||
>
|
||||
<span>Analyze</span>
|
||||
<ExternalLink className="w-3 h-3" />
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{expanded && pathsCount > 0 && (
|
||||
|
||||
@@ -29,6 +29,7 @@ export interface Advert {
|
||||
is_chat_node: number;
|
||||
is_room_server: number;
|
||||
has_location: number;
|
||||
packet_hash: string;
|
||||
}
|
||||
|
||||
export interface LocationHistory {
|
||||
|
||||
@@ -157,7 +157,7 @@ export async function getMeshcoreNodeInfo(publicKey: string, limit: number = 50)
|
||||
// Get recent adverts grouped by adv_timestamp with origin_path_pubkey tuples
|
||||
const advertsQuery = `
|
||||
SELECT
|
||||
adv_timestamp,
|
||||
argMax(adv_timestamp, ingest_timestamp) as adv_timestamp,
|
||||
groupArray((origin, path, origin_pubkey)) as origin_path_pubkey_tuples,
|
||||
count() as advert_count,
|
||||
min(ingest_timestamp) as earliest_timestamp,
|
||||
@@ -167,7 +167,8 @@ export async function getMeshcoreNodeInfo(publicKey: string, limit: number = 50)
|
||||
argMax(is_repeater, ingest_timestamp) as is_repeater,
|
||||
argMax(is_chat_node, ingest_timestamp) as is_chat_node,
|
||||
argMax(is_room_server, ingest_timestamp) as is_room_server,
|
||||
argMax(has_location, ingest_timestamp) as has_location
|
||||
argMax(has_location, ingest_timestamp) as has_location,
|
||||
packet_hash
|
||||
FROM (
|
||||
SELECT
|
||||
ingest_timestamp,
|
||||
@@ -182,12 +183,13 @@ export async function getMeshcoreNodeInfo(publicKey: string, limit: number = 50)
|
||||
is_room_server,
|
||||
has_location,
|
||||
hex(origin_pubkey) as origin_pubkey,
|
||||
origin
|
||||
origin,
|
||||
packet_hash
|
||||
FROM meshcore_adverts
|
||||
WHERE public_key = {publicKey:String}
|
||||
ORDER BY ingest_timestamp DESC
|
||||
)
|
||||
GROUP BY adv_timestamp
|
||||
GROUP BY packet_hash
|
||||
ORDER BY max(ingest_timestamp) DESC
|
||||
LIMIT {limit:UInt32}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user