11import Copy from "@/assets/icons/copy.svg?react" ;
22import Download from "@/assets/icons/download-01.svg?react" ;
33import ArrowLeft from "@/assets/icons/arrow-left.svg?react" ;
4+ import Refresh from "@/assets/icons/refresh.svg?react" ;
45import { Button } from "@zenml-io/react-component-library/components/server" ;
56import { SearchField } from "../SearchField" ;
67import { LogLevelSelect } from "./log-level-select" ;
78import { LoggingLevel } from "@/types/logs" ;
89import { Dispatch , SetStateAction } from "react" ;
10+ import {
11+ Tooltip ,
12+ TooltipContent ,
13+ TooltipProvider ,
14+ TooltipTrigger
15+ } from "@zenml-io/react-component-library" ;
916
1017interface LogToolbarProps {
1118 onSearchChange : ( searchTerm : string ) => void ;
1219
20+ onReload : ( ) => void ;
1321 onCopyAll : ( ) => void ;
1422 onDownload : ( ) => void ;
1523 // Search-related props from useLogSearch hook
@@ -25,6 +33,7 @@ interface LogToolbarProps {
2533
2634export function LogToolbar ( {
2735 onSearchChange,
36+ onReload,
2837 onCopyAll,
2938 onDownload,
3039 searchQuery = "" ,
@@ -83,33 +92,56 @@ export function LogToolbar({
8392 </ div >
8493
8594 { /* Right side - Action Buttons */ }
86- < div className = "flex items-center gap-2" >
87- < Button
88- size = "md"
89- emphasis = "subtle"
90- intent = "secondary"
91- onClick = { onCopyAll }
92- title = "Copy all displayed logs"
93- className = "bg-theme-surface-primary"
94- >
95- < Copy className = "mr-1 h-4 w-4 fill-theme-text-secondary" />
96- Copy All
97- </ Button >
95+ < TooltipProvider >
96+ < div className = "flex items-center gap-2" >
97+ < LogIconButton
98+ icon = { < Refresh className = "h-4 w-4 fill-theme-text-primary" /> }
99+ tooltip = "Reload logs"
100+ onClick = { onReload }
101+ />
98102
99- < Button
100- size = "md"
101- emphasis = "subtle"
102- intent = "secondary"
103- onClick = { onDownload }
104- title = "Download logs as file"
105- className = "bg-theme-surface-primary"
106- >
107- < Download className = "mr-1 h-5 w-5 fill-theme-text-tertiary" />
108- Download
109- </ Button >
110- </ div >
103+ < LogIconButton
104+ icon = { < Copy className = "h-4 w-4 fill-theme-text-primary" /> }
105+ tooltip = "Copy all displayed logs"
106+ onClick = { onCopyAll }
107+ />
108+
109+ < LogIconButton
110+ icon = { < Download className = "h-4 w-4 fill-theme-text-primary" /> }
111+ tooltip = "Download logs as file"
112+ onClick = { onDownload }
113+ />
114+ </ div >
115+ </ TooltipProvider >
111116 </ div >
112117 </ div >
113118 </ >
114119 ) ;
115120}
121+
122+ function LogIconButton ( {
123+ icon,
124+ tooltip,
125+ onClick
126+ } : {
127+ icon : React . ReactNode ;
128+ tooltip : string ;
129+ onClick : ( ) => void ;
130+ } ) {
131+ return (
132+ < Tooltip delayDuration = { 200 } >
133+ < TooltipTrigger >
134+ < Button
135+ size = "md"
136+ emphasis = "subtle"
137+ intent = "secondary"
138+ onClick = { onClick }
139+ className = "flex aspect-square items-center justify-center bg-theme-surface-primary p-0"
140+ >
141+ { icon }
142+ </ Button >
143+ </ TooltipTrigger >
144+ < TooltipContent > { tooltip } </ TooltipContent >
145+ </ Tooltip >
146+ ) ;
147+ }
0 commit comments