index.ut 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. {#
  2. Copyright 2008 Steven Barth <steven@midlink.org>
  3. Copyright 2008-2022 Jo-Philipp Wich <jo@mein.io>
  4. Licensed to the public under the Apache License 2.0.
  5. -#}
  6. {% include('header') %}
  7. <h2 name="content">{{ _('Status') }}</h2>
  8. <div id="view">
  9. <div class="spinning">{{ _('Loading view…') }}</div>
  10. </div>
  11. <script>
  12. function progressbar(query, value, max, byte)
  13. {
  14. var pg = document.querySelector(query),
  15. vn = parseInt(value) || 0,
  16. mn = parseInt(max) || 100,
  17. fv = byte ? String.format('%1024.2mB', value) : value,
  18. fm = byte ? String.format('%1024.2mB', max) : max,
  19. pc = Math.floor((100 / mn) * vn);
  20. if (pg) {
  21. pg.firstElementChild.style.width = pc + '%';
  22. pg.setAttribute('title', '%s / %s (%d%%)'.format(fv, fm, pc));
  23. }
  24. }
  25. function renderBox(title, active, childs) {
  26. childs = childs || [];
  27. childs.unshift(L.itemlist(E('span'), [].slice.call(arguments, 3)));
  28. return E('div', { class: 'ifacebox' }, [
  29. E('div', { class: 'ifacebox-head center ' + (active ? 'active' : '') },
  30. E('strong', title)),
  31. E('div', { class: 'ifacebox-body left' }, childs)
  32. ]);
  33. }
  34. function renderBadge(icon, title) {
  35. return E('span', { class: 'ifacebadge' }, [
  36. E('img', { src: icon, title: title || '' }),
  37. L.itemlist(E('span'), [].slice.call(arguments, 2))
  38. ]);
  39. }
  40. </script>
  41. <div class="includes" style="display:none">
  42. {%
  43. let lua_available = true;
  44. try { require('lua'); }
  45. catch(err) { lua_available = false; }
  46. if (lua_available)
  47. include('admin_status/luaindex');
  48. %}
  49. </div>
  50. <script>
  51. L.require('ui').then(function(ui) {
  52. ui.instantiateView('status/index');
  53. });
  54. </script>
  55. {% include('footer') %}