]>
git.r.bdr.sh - rbdr/monitorcito/blob - public/js/monitorcito.js
3 const table
= document
. querySelector ( '#monitorcito' );
7 . then (( response
) => response
. json ())
8 . then (( serviceStatus
) => {
10 while ( table
. firstChild
) {
11 table
. removeChild ( table
. firstChild
)
14 for ( const [ service
, isActive
] of Object
. entries ( serviceStatus
)) {
15 const row
= document
. createElement ( 'tr' );
16 const serviceCell
= document
. createElement ( 'td' );
17 serviceCell
. appendChild ( document
. createTextNode ( service
));
18 const isActiveCell
= document
. createElement ( 'td' );
19 isActiveCell
. appendChild ( document
. createTextNode ( isActive
? 'OK' : 'FAIL' ));
20 isActiveCell
. classList
. add ( isActive
);
21 row
. appendChild ( serviceCell
);
22 row
. appendChild ( isActiveCell
);
23 table
. appendChild ( row
);
26 setTimeout ( loadData
, 5000 );
29 const container
= document
. querySelector ( 'main' );
30 container
. removeChild ( table
);
31 const paragraph
= document
. createElement ( 'p' );
32 paragraph
. appendChild ( document
. createTextNode ( 'Everything is broken. If your internet works, please check the server \' s not on fire. When in doubt, just refresh.' ));
33 paragraph
. classList
. add ( 'critical' );
34 container
. appendChild ( paragraph
);