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 const refreshInterval = 5
11 var ctl = Stream({Tasks: [], Version: 0, Outdated: true})
15 if (refresh.xhr !== null) {
23 url: '/api/tasks/ctl?timeout='+refreshInterval+'&newerThan='+ctl().version,
24 config: function(xhr) { refresh.xhr = xhr },
26 .then(function(data) {
27 var isNew = data.Version != ctl().Version
31 // Got a new version -- assume the server is obeying
32 // newerThan, and start listening for the next version
37 window.setInterval(refresh, refreshInterval*1000)
41 view: function(vnode) {
43 m('nav.navbar.navbar-toggleable-md.navbar-inverse.bg-primary',
44 m('a.navbar-brand[href=#]', 'arvados-boot'),
45 m('.collapse.navbar-collapse',
47 m('li.nav-item.active',
48 m('a.nav-link[href=/]', {config: m.route}, 'health', m('span.sr-only', '(current)')))))),
49 m('.x-spacer', {height: '1em'}),
50 m('table.table', {style: {width: '350px'}},
51 m('tbody', {style: {opacity: ctl().Outdated ? .5 : 1}}, ctl().Tasks.map(function(task) {
56 {class: task.State == 'OK' ? 'badge-success' : 'badge-danger'},
64 m.route(document.getElementById('app'), '/', {