@@ -2,7 +2,7 @@ import React from 'react';
22import { GoDotFill } from 'react-icons/go' ;
33import { FaChartLine } from 'react-icons/fa' ;
44import { GetResponseTimeHistogram , SearchApplication } from '@pinpoint-fe/ui/src/constants' ;
5- import { Button , cn } from '../..' ;
5+ import { Button , cn , Tooltip , TooltipContent , TooltipTrigger , TooltipProvider } from '../..' ;
66
77export interface ServerListProps {
88 className ?: string ;
@@ -41,41 +41,58 @@ export const ServerList = ({
4141 < div className = "truncate" > { d . groupName } </ div >
4242 ) }
4343 </ div >
44- < ul >
45- { d . instancesList . map ( ( instance ) => {
46- const slow = statistics ?. agentHistogram ?. [ instance . agentId ] ?. Slow ;
47- const error = statistics ?. agentHistogram ?. [ instance . agentId ] ?. Error ;
44+ < TooltipProvider >
45+ < ul >
46+ { d . instancesList . map ( ( instance , index ) => {
47+ const slow = statistics ?. agentHistogram ?. [ instance . agentId ] ?. Slow ;
48+ const error = statistics ?. agentHistogram ?. [ instance . agentId ] ?. Error ;
4849
49- return (
50- < li
51- key = { instance . agentId }
52- className = { cn (
53- 'flex items-center h-7 px-2 cursor-pointer rounded text-xs hover:bg-neutral-200 gap-1' ,
54- {
55- 'font-semibold bg-neutral-200' : instance . agentId === selectedId ,
56- } ,
57- ) }
58- onClick = { ( ) => onClick ?.( instance ) }
59- >
60- < GoDotFill
61- className = { cn ( 'fill-status-success mr-1' , {
62- 'fill-status-warn' : ! ! ( slow && slow > 0 ) ,
63- 'fill-status-fail' : ! ! ( error && error > 0 ) ,
64- } ) }
65- />
66- { itemRenderer
67- ? itemRenderer ( d , instance )
68- : instance . agentName || instance . agentId }
69- < Button
70- className = "z-10 h-5 p-1 ml-auto rounded-sm text-xxs"
71- onClick = { ( ) => onClickInspectorLink ?.( instance . agentId ) }
72- >
73- < FaChartLine className = "text-white" />
74- </ Button >
75- </ li >
76- ) ;
77- } ) }
78- </ ul >
50+ return (
51+ < Tooltip key = { index } >
52+ < TooltipTrigger asChild >
53+ < li
54+ key = { instance . agentId }
55+ className = { cn (
56+ 'flex items-center h-7 px-2 cursor-pointer rounded text-xs hover:bg-neutral-200 gap-1' ,
57+ {
58+ 'font-semibold bg-neutral-200' : instance . agentId === selectedId ,
59+ } ,
60+ ) }
61+ onClick = { ( ) => onClick ?.( instance ) }
62+ >
63+ < GoDotFill
64+ className = { cn ( 'fill-status-success mr-1' , {
65+ 'fill-status-warn' : ! ! ( slow && slow > 0 ) ,
66+ 'fill-status-fail' : ! ! ( error && error > 0 ) ,
67+ } ) }
68+ />
69+ { itemRenderer
70+ ? itemRenderer ( d , instance )
71+ : instance . agentName || instance . agentId }
72+ < Button
73+ className = "z-10 h-5 p-1 ml-auto rounded-sm text-xxs"
74+ onClick = { ( ) => onClickInspectorLink ?.( instance . agentId ) }
75+ >
76+ < FaChartLine className = "text-white" />
77+ </ Button >
78+ </ li >
79+ </ TooltipTrigger >
80+ < TooltipContent >
81+ < >
82+ < div >
83+ < span className = "text-gray-500" > Agent ID:</ span > { instance . agentId }
84+ </ div >
85+ < div >
86+ < span className = "text-gray-500" > Agent Name:</ span > { ' ' }
87+ { instance . agentName }
88+ </ div >
89+ </ >
90+ </ TooltipContent >
91+ </ Tooltip >
92+ ) ;
93+ } ) }
94+ </ ul >
95+ </ TooltipProvider >
7996 </ React . Fragment >
8097 ) ;
8198 } ) }
0 commit comments