Files: 53a40a01e1a3a5de5ac78d70f8a0318f38ae0fcb / modules_extra / versions.js
1108 bytesRaw
1 | var h = require('hyperscript') |
2 | |
3 | exports.gives = { |
4 | menu_items: true, |
5 | builtin_tabs: true, |
6 | screen_view: true |
7 | } |
8 | |
9 | exports.create = function () { |
10 | |
11 | return { |
12 | menu_items: function () { |
13 | return h('a', {href: '#/versions'}, '/versions') |
14 | }, |
15 | |
16 | builtin_tabs: function () { |
17 | return ['/versions'] |
18 | }, |
19 | |
20 | screen_view: function (path) { |
21 | if(path !== '/versions') return |
22 | |
23 | if('undefined' === typeof WebBoot) |
24 | return h('h1', 'must run with web-boot enabled enviroment') |
25 | |
26 | var content = h('div.column') |
27 | |
28 | WebBoot.versions(function (err, log) { |
29 | log.forEach(function (e, i) { |
30 | content.appendChild( |
31 | h('div.row', |
32 | h('a', { |
33 | href: '#/run:'+e.value, |
34 | onclick: function () { |
35 | WebBoot.run(e.value, function () { |
36 | console.log('rebooting to:', e.value) |
37 | }) |
38 | } |
39 | }, ' ', e.value, ' ', new Date(e.ts)), |
40 | !i && h('label', '(current)') |
41 | ) |
42 | ) |
43 | }) |
44 | |
45 | }) |
46 | |
47 | return content |
48 | } |
49 | } |
50 | } |
51 |
Built with git-ssb-web