1 // application entry point
2 window.jQuery = require('jquery')
3 window.Tether = require('tether')
5 require('./example.js')
6 var m = require('mithril')
7 var Stream = require('mithril/stream')
9 var ctl = Stream({Tasks: [], Version: 0})
15 if (refresh.xhr !== null) {
19 if (refresh.next !== null)
20 window.clearTimeout(refresh.next)
21 refresh.next = window.setTimeout(refresh, timeout*1000)
22 var version = ctl().Version
25 url: '/api/tasks/ctl?timeout='+timeout+'&newerThan='+version,
26 config: function(xhr) { refresh.xhr = xhr },
30 if (ctl().Version != version) {
31 // Got a new version -- assume the server is obeying
32 // newerThan, and start listening for the next version
36 if (refresh.next !== null)
37 window.clearTimeout(refresh.next)
38 refresh.next = window.setTimeout(refresh, 5000)
44 view: function(vnode) {
46 m('nav.navbar.navbar-toggleable-md.navbar-inverse.bg-primary',
47 m('a.navbar-brand[href=#]', 'arvados-boot'),
48 m('.collapse.navbar-collapse',
50 m('li.nav-item.active',
51 m('a.nav-link[href=/]', {config: m.route}, 'health', m('span.sr-only', '(current)')))))),
52 m('.x-spacer', {height: '1em'}),
53 m('table.table', {style: {width: '350px'}},
54 m('tbody', ctl().Tasks.map(function(task) {
56 m('td', task.ShortName),
59 {class: task.State == 'OK' ? 'badge-success' : 'badge-danger'},
67 m.route(document.getElementById('app'), '/', {