guest_worker/www/backend.html

72 lines
1.2 KiB
HTML
Raw Normal View History

2019-10-31 13:35:24 +00:00
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="backend.css" />
2019-11-04 08:24:37 +00:00
<!-- <meta http-equiv="refresh" content="20">-->
2019-10-31 13:35:24 +00:00
</head>
<body>
<div id="wrapper">
<div id="header"><span id="aai">Artificial Artificial Intelligence</span> <img src="amazon.svg" /> </div>
2019-10-31 13:35:24 +00:00
<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>
2019-11-04 08:24:37 +00:00
<script src='/worker_specs/reconnecting-websocket.min.js'></script>
<script type='text/javascript'>
let ws = new ReconnectingWebSocket('ws://localhost:8888/status/ws')
2019-11-04 10:34:10 +00:00
let justOpened = false;
2019-11-04 08:24:37 +00:00
ws.addEventListener('open', () => {
// ws.send('hi server')
2019-11-04 10:34:10 +00:00
justOpened = true;
2019-11-04 08:24:37 +00:00
})
2019-11-04 10:34:10 +00:00
2019-11-04 08:24:37 +00:00
ws.addEventListener('message', (event) => {
console.log('message: ' + event.data)
let data = JSON.parse(event.data)
2019-11-04 10:34:10 +00:00
if(data.property == 'hit_id') {
// on connect all
if(!justOpened){
setTimeout(function(){
window.location.reload();
console.log(justOpened + ' reloaded')
},20000)
}
justOpened = false;
2019-11-04 08:24:37 +00:00
}
})
2019-11-04 10:34:10 +00:00
2019-11-04 08:24:37 +00:00
</script>
2019-10-31 13:35:24 +00:00
</body>
</html>