File tree Expand file tree Collapse file tree 2 files changed +24
-16
lines changed
Expand file tree Collapse file tree 2 files changed +24
-16
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ export default class Instances extends Component{
3131 for ( var j = 0 ; j < comments . length ; j ++ ) {
3232 if ( comments [ j ] . startFrame <= frames [ i ] . id && frames [ i ] . id <= comments [ j ] . endFrame ) {
3333 frames [ i ] . comment = comments [ j ] . commentText
34+ frames [ i ] . commentId = comments [ j ] . comment
3435 }
3536 }
3637 }
@@ -116,7 +117,9 @@ function CustomTooltip({active, payload}) {
116117 < p > { payload [ 0 ] . payload . timestamp } </ p >
117118 < p > ResponseTime: { payload [ 0 ] . payload . responseTime } ms</ p >
118119 < p > CPU usage: { payload [ 0 ] . payload . cpu } %</ p >
119- < p > { payload [ 0 ] . payload . comment } </ p >
120+ < p > Comment: { payload [ 0 ] . payload . comment } </ p >
121+ < p > Comment ID: { payload [ 0 ] . payload . commentId } </ p >
122+ < p > Frame ID: { payload [ 0 ] . payload . id } </ p >
120123 </ div >
121124 )
122125 }
Original file line number Diff line number Diff line change 1- import { useEffect , useState } from "react" ;
1+ import { useEffect , useState , useRef } from "react" ;
22import Systems from './Systems' ;
33import Components from './Components' ;
44
@@ -9,22 +9,27 @@ export default function FetchDataFunction(props) {
99 const [ components , setComponents ] = useState ( [ ] ) ;
1010 const [ systems , setSystems ] = useState ( [ ] ) ;
1111 const [ items , setItems ] = useState ( [ ] ) ;
12+ const ref = useRef ( true ) ;
1213
1314 useEffect ( ( ) => {
14- fetch ( "https://openmonitor.monitor-api.zeekay.dev" )
15- . then ( res => res . json ( ) )
16- . then (
17- ( result ) => {
18- setIsLoaded ( true ) ;
19- setComponents ( result . components ) ;
20- setSystems ( result . systems ) ;
21- setItems ( result ) ;
22- } ,
23- ( error ) => {
24- setIsLoaded ( true ) ;
25- setError ( error ) ;
26- }
27- )
15+ setTimeout ( ( ) => {
16+ console . log ( new Date ( ) . toLocaleString ( ) . replace ( ',' , '' ) + ': fetching' )
17+ fetch ( "https://openmonitor.monitor-api.zeekay.dev" )
18+ . then ( res => res . json ( ) )
19+ . then (
20+ ( result ) => {
21+ setIsLoaded ( true ) ;
22+ setComponents ( result . components ) ;
23+ setSystems ( result . systems ) ;
24+ setItems ( result ) ;
25+ } ,
26+ ( error ) => {
27+ setIsLoaded ( true ) ;
28+ setError ( error ) ;
29+ }
30+ )
31+ ref . current = false ;
32+ } , ( ( ref . current === true ) ? 0 : 10000 ) ) ;
2833 } , [ items ] )
2934
3035 if ( error ) {
You can’t perform that action at this time.
0 commit comments