summaryrefslogtreecommitdiffstats
path: root/health-storage-html.lsp
blob: bd2a20a7bd4a63dd726e9a4c800e058b12218187 (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
<% local view = ... %>

<% displaydisk = function(disk, name)
io.write("<pre>"..html.html_escape(disk.value).."</pre>\n")
io.write('<TABLE STYLE="margin:0px;padding:0px;border:0px">\n')
io.write("	<TR>\n")
io.write("		<TD>0%</TD>\n")
if tonumber(disk.used) > 0 then
	io.write('		<TD WIDTH="'..html.html_escape(disk.used)..'%" STYLE="background:red;border:2px solid black;')
	if tonumber(disk.used) < 100 then io.write('border-right:none;') end
	io.write('"><CENTER><B>')
	if ( tonumber(disk.used) > 10) then io.write(html.html_escape(disk.used) .. "%") end
	io.write('</B></CENTER></TD>\n')
end
if tonumber(disk.used) < 100 then
	io.write('		<TD WIDTH="'..(100-tonumber(disk.used))..'%" STYLE="background:#0c0;border:2px solid black;')
	if tonumber(disk.used) > 0 then io.write('border-left:none;') end
	io.write('"><CENTER><B>')
	if ( 90 > tonumber(disk.used)) then io.write((100-tonumber(disk.used)) .. "%") end
	io.write('</B></CENTER></TD>\n')
end
io.write('		<TD>100%</TD>\n')
io.write("	</TR>\n")
io.write("</TABLE>\n")
io.write('<TABLE STYLE="margin:0px;padding:0px;border:0px;margin-top:5px;">\n')
io.write("	<TR>\n")
io.write('		<TD WIDTH="100px"><B>'..html.html_escape(name)..'</B></TD><TD STYLE="background:red;border:2px solid black;" WIDTH="20px"></TD><TD WIDTH="70px"><B>=Used</B></TD><TD STYLE="background:#0c0;border:2px solid black;" WIDTH="20px"></TD><TD><B>=Free</B></TD>\n')
io.write("	</TR>\n")
io.write("</TABLE>\n")
end %>

<h1>Storage</h1>

<h2>Floppy capacity</h2>
<% if (view.value.floppy) then
for name,floppy in pairs(view.value.floppy.value) do
	displaydisk(floppy, name)
end
else %>
No Floppy mounted
<% end %>

<h2>Harddrive capacity</h2>
<% if (view.value.hd) then 
for name,hd in pairs(view.value.hd.value) do
	displaydisk(hd, name)
end
else %>
No Harddrive mounted
<% end %>

<h2>RAM Disk capacity</h2>
<% if (view.value.ramdisk) then 
for name,ramdisk in pairs(view.value.ramdisk.value) do
	displaydisk(ramdisk, name)
end
else %>
No RAM Disk mounted
<% end %>

<% if view.value.partitions then %>
<h2>Disk partitions</h2>
<pre><%= html.html_escape(view.value.partitions.value) %></pre>
<% end %>