summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-status/ucode/template/admin_status/index.ut
blob: 4d018a3efdcaf19125ed8be882a379e0a3d91515 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{#
 Copyright 2008 Steven Barth <steven@midlink.org>
 Copyright 2008-2022 Jo-Philipp Wich <jo@mein.io>
 Licensed to the public under the Apache License 2.0.
-#}

{% include('header') %}

<h2 name="content">{{ _('Status') }}</h2>

<div id="view">
	<div class="spinning">{{ _('Loading view…') }}</div>
</div>

<script type="text/javascript">//<![CDATA[
function progressbar(query, value, max, byte)
{
	var pg = document.querySelector(query),
	    vn = parseInt(value) || 0,
	    mn = parseInt(max) || 100,
	    fv = byte ? String.format('%1024.2mB', value) : value,
	    fm = byte ? String.format('%1024.2mB', max) : max,
	    pc = Math.floor((100 / mn) * vn);

	if (pg) {
		pg.firstElementChild.style.width = pc + '%';
		pg.setAttribute('title', '%s / %s (%d%%)'.format(fv, fm, pc));
	}
}

function renderBox(title, active, childs) {
	childs = childs || [];
	childs.unshift(L.itemlist(E('span'), [].slice.call(arguments, 3)));

	return E('div', { class: 'ifacebox' }, [
		E('div', { class: 'ifacebox-head center ' + (active ? 'active' : '') },
			E('strong', title)),
		E('div', { class: 'ifacebox-body left' }, childs)
	]);
}

function renderBadge(icon, title) {
	return E('span', { class: 'ifacebadge' }, [
		E('img', { src: icon, title: title || '' }),
		L.itemlist(E('span'), [].slice.call(arguments, 2))
	]);
}

//]]></script>

<div class="includes" style="display:none">
{%
	let lua_available = true;

	try { require('lua'); }
	catch(err) { lua_available = false; }

	if (lua_available)
		include('admin_status/luaindex');
%}
</div>

<script type="text/javascript">
	L.require('ui').then(function(ui) {
		ui.instantiateView('status/index');
	});
</script>

{% include('footer') %}