guest_worker/www/backend.html
2019-11-04 11:34:10 +01:00

71 lines
1.2 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="backend.css" />
<!-- <meta http-equiv="refresh" content="20">-->
</head>
<body>
<div id="wrapper">
<div id="header"><span id="aai">Artificial Artificial Intelligence</span> <img src="amazon.svg" /> </div>
<table>
<thead>
<tr>
<th></th>
<th>worker id</th>
<th>ip address</th>
<th>country</th>
<th>fee</th>
<th>task start time</th>
<th>task completion time</th>
<th></th>
</tr>
</thead>
<tbody>
{{TBODY}}
</tbody>
</table>
</div>
<script src='/worker_specs/reconnecting-websocket.min.js'></script>
<script type='text/javascript'>
let ws = new ReconnectingWebSocket('ws://localhost:8888/status/ws')
let justOpened = false;
ws.addEventListener('open', () => {
// ws.send('hi server')
justOpened = true;
})
ws.addEventListener('message', (event) => {
console.log('message: ' + event.data)
let data = JSON.parse(event.data)
if(data.property == 'hit_id') {
// on connect all
if(!justOpened){
setTimeout(function(){
window.location.reload();
console.log(justOpened + ' reloaded')
},20000)
}
justOpened = false;
}
})
</script>
</body>
</html>