1
- import React , { useState , useEffect } from 'react' ;
2
- import { Badge , Row , Col , Card , Container , Button , ListGroup , Stack } from "react-bootstrap" ;
1
+ import React , { useEffect , useState } from 'react' ;
2
+ import { Badge , Button , Card , Col , Container , ListGroup , Row , Stack } from "react-bootstrap" ;
3
3
import CertificateModal from '../CertificateModal' ;
4
4
import RawJsonButton from "../RawJsonButton" ;
5
5
import { useSelector } from "react-redux" ;
@@ -30,7 +30,7 @@ export default function SnapshotsList(props) {
30
30
if ( ! autoUpdate ) {
31
31
return ;
32
32
}
33
-
33
+
34
34
let fetchSnapshots = ( ) => {
35
35
fetch ( `${ aggregator } /snapshots` )
36
36
. then ( response => response . json ( ) )
@@ -40,18 +40,18 @@ export default function SnapshotsList(props) {
40
40
console . error ( "Fetch snapshots error:" , error ) ;
41
41
} ) ;
42
42
} ;
43
-
43
+
44
44
// Fetch them once without waiting
45
- fetchSnapshots ( ) ;
46
-
45
+ fetchSnapshots ( ) ;
46
+
47
47
const interval = setInterval ( fetchSnapshots , updateInterval ) ;
48
48
return ( ) => clearInterval ( interval ) ;
49
49
} , [ aggregator , updateInterval , autoUpdate ] ) ;
50
-
50
+
51
51
function handleCertificateHashChange ( hash ) {
52
52
setSelectedCertificateHash ( hash ) ;
53
53
}
54
-
54
+
55
55
function showCertificate ( hash ) {
56
56
setSelectedCertificateHash ( hash ) ;
57
57
}
@@ -61,10 +61,10 @@ export default function SnapshotsList(props) {
61
61
< CertificateModal
62
62
aggregator = { aggregator }
63
63
hash = { selectedCertificateHash }
64
- onHashChange = { handleCertificateHashChange } />
65
-
64
+ onHashChange = { handleCertificateHashChange } />
65
+
66
66
< div className = { props . className } >
67
- < h2 > Snapshots < RawJsonButton href = { `${ aggregator } /snapshots` } variant = "outline-light" size = "sm" /> </ h2 >
67
+ < h2 > Snapshots < RawJsonButton href = { `${ aggregator } /snapshots` } variant = "outline-light" size = "sm" /> </ h2 >
68
68
{ Object . entries ( snapshots ) . length === 0
69
69
? < p > No snapshot available</ p >
70
70
:
@@ -82,7 +82,8 @@ export default function SnapshotsList(props) {
82
82
{ snapshot . certificate_hash } { ' ' }
83
83
< Button size = "sm" onClick = { ( ) => showCertificate ( snapshot . certificate_hash ) } > Show</ Button >
84
84
</ ListGroup . Item >
85
- < ListGroup . Item > Created at: < br /> { new Date ( snapshot . created_at ) . toLocaleString ( ) } </ ListGroup . Item >
85
+ < ListGroup . Item > Created at: < br /> { new Date ( snapshot . created_at ) . toLocaleString ( ) }
86
+ </ ListGroup . Item >
86
87
< ListGroup . Item > Size: { formatBytes ( snapshot . size ) } </ ListGroup . Item >
87
88
</ ListGroup >
88
89
</ Card . Body >
@@ -92,8 +93,9 @@ export default function SnapshotsList(props) {
92
93
< > < Badge bg = "primary" > Latest</ Badge > { ' ' } </ >
93
94
}
94
95
< Badge bg = "secondary" > { snapshot . beacon . network } </ Badge >
95
-
96
- < RawJsonButton href = { `${ aggregator } /snapshot/${ snapshot . digest } ` } size = "sm" className = "ms-auto" />
96
+
97
+ < RawJsonButton href = { `${ aggregator } /snapshot/${ snapshot . digest } ` } size = "sm"
98
+ className = "ms-auto" />
97
99
</ Stack >
98
100
</ Card . Footer >
99
101
</ Card >
0 commit comments