@@ -26,7 +26,7 @@ export const Logs: React.FC<IProps> = ({ className, projectName, runName, jobSub
2626 const [ isLoading , setIsLoading ] = useState ( false ) ;
2727 const [ getProjectLogs ] = useLazyGetProjectLogsQuery ( ) ;
2828 const [ isEnabledDecoding , setIsEnabledDecoding ] = useLocalStorageState ( 'enable-encode-logs' , false ) ;
29- // const [isShowTimestamp, setIsShowTimestamp] = useLocalStorageState('enable-showing-timestamp-logs', false);
29+ const [ isShowTimestamp , setIsShowTimestamp ] = useLocalStorageState ( 'enable-showing-timestamp-logs' , false ) ;
3030
3131 const logsForView = useMemo ( ( ) => {
3232 if ( isEnabledDecoding ) {
@@ -103,6 +103,10 @@ export const Logs: React.FC<IProps> = ({ className, projectName, runName, jobSub
103103 setIsEnabledDecoding ( ! isEnabledDecoding ) ;
104104 } ;
105105
106+ const toggleShowingTimestamp = ( ) => {
107+ setIsShowTimestamp ( ! isShowTimestamp ) ;
108+ } ;
109+
106110 useEffect ( ( ) => {
107111 getLogItems ( ) ;
108112 } , [ ] ) ;
@@ -172,11 +176,15 @@ export const Logs: React.FC<IProps> = ({ className, projectName, runName, jobSub
172176 />
173177 </ Box >
174178
175- { /*<Box>*/ }
176- { /* <Toggle onChange={({ detail }) => setIsShowTimestamp(detail.checked)} checked={isShowTimestamp}>*/ }
177- { /* Show timestamp*/ }
178- { /* </Toggle>*/ }
179- { /*</Box>*/ }
179+ < Box >
180+ < Button
181+ ariaLabel = "Show timestamp"
182+ formAction = "none"
183+ iconName = "status-pending"
184+ variant = { isShowTimestamp ? 'primary' : 'icon' }
185+ onClick = { toggleShowingTimestamp }
186+ />
187+ </ Box >
180188 </ div >
181189 </ div >
182190 }
@@ -195,7 +203,7 @@ export const Logs: React.FC<IProps> = ({ className, projectName, runName, jobSub
195203 < Code className = { styles . terminal } ref = { codeRef } >
196204 { logsForView . map ( ( log , i ) => (
197205 < p key = { i } >
198- { /*{ isShowTimestamp && <span className={styles.timestamp}>{log.timestamp}</span> }*/ }
206+ { isShowTimestamp && < span className = { styles . timestamp } > { log . timestamp } </ span > }
199207 { log . message }
200208 </ p >
201209 ) ) }
0 commit comments