show usb disk space. Clickable log viewer

git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@2093 2a923420-c742-0410-a762-8d5b09965624
This commit is contained in:
hummypkg 2014-12-30 19:00:15 +00:00
parent 51aded3d2d
commit 85fed3247a
8 changed files with 46 additions and 6 deletions

View File

@ -1,7 +1,7 @@
Package: webif
Priority: optional
Section: web
Version: 1.0.18-5
Version: 1.0.18-6
Architecture: mipsel
Maintainer: af123@hummypkg.org.uk
Depends: webif-channelicons(>=1.1.14),lighttpd(>=1.4.35-2),jim(>=0.75-1),jim-oo,jim-sqlite3(>=0.75),jim-cgi(>=0.7),jim-binary(>=0.75),service-control(>=2.1),busybox(>=1.20.2-1),lsof(>=4.87),epg(>=1.0.14),hmt(>=1.1.21),ssmtp,anacron,trm(>=1.1),openssl-command,nicesplice,id3v2,file,rsvsync(>=1.0.2),webif-charts(>=1.2-1),stripts(>=1.2.5-3),smartmontools,tmenu(>=1.08),ffmpeg,id3v2,multienv(>=1.6),tcpping(>=1.1),e2fsprogs,mongoose

View File

@ -20,7 +20,7 @@ foreach usb [system usbmounts 1] {
} else {
puts "\"status\": 1,"
puts "\"result\": \"Successfully ejected $label\""
file delete -force $usb(MP)
catch {file delete -force $usb(MP)}
}
puts "}"
exit

View File

@ -30,8 +30,8 @@ $('#usbeject').on('click', function(e) {
var num = 0;
$.each(data, function(k,v) {
num++;
var size = (v.SIZE / 1000000000);
if (size > 1000)
var size = v.SIZE / 1000000000;
if (size >= 1000)
size = (size / 1000).toFixed(1) + "TB";
else
size = size.toFixed(1) + "GB";
@ -53,11 +53,23 @@ $('#usbeject').on('click', function(e) {
'<td class=blood>(' + drive + '&nbsp;-&nbsp;' +
type + '&nbsp;' + '&nbsp;-&nbsp;' +
size + ')</td>' +
'<td class="va pie" data-percent="' + v.USED +
'"></td>' +
'<td style="padding-left: 10px">' + v.USED +
'%' + '</td>' +
'<td><img class="va eject" border=0 height=20' +
' drive=' + v.MP +
' label="' + v.LABEL + '"' +
' src=/img/media-eject.png></td>' +
'</tr>');
$('#usbejecttab .pie').easyPieChart({
size: 20,
barColor: '#00ff00',
trackColor: '#A3A3C2',
lineWidth: 4,
scaleColor: false,
lineCap: 'butt'
});
});
$('#usbejectout').empty();
if (!num)

View File

@ -36,6 +36,7 @@ if {[info exists _mws_js]} {
foreach css $::_mws_css {
puts "<link href=\"$css\" rel=stylesheet type=text/css />"
}
incr ::_mws_headerdone
}
puts {
</head>

View File

@ -145,5 +145,28 @@ $('#log').on('change', function() {
loadlog($('#log').val())
}).trigger('change');
function expand(el, dir, num)
{
el.show('fast').find('td').css('color', '#ff4000 !important');
if (!num) return;
switch (dir)
{
case 'up':
expand(el.prev(), dir, num - 1);
break;
case 'down':
expand(el.next(), dir, num - 1);
break;
}
}
$('#logtab').on('click', 'tbody > tr', function() {
$(this)
.removeClass('odd even')
.addClass('highlight');
expand($(this), 'up', 10);
expand($(this), 'down', 10);
});
});

View File

@ -1,5 +1,8 @@
#!/mod/bin/jimsh
source /mod/webif/lib/setup
jqplugin easy-pie-chart
puts {
<div id=usbeject class=usb>
<img height=25 src=/img/eject.png>

View File

@ -423,8 +423,9 @@ proc {system usbmounts} {{full 0}} {
}
}
lassign [exec stat -f -c {%b %S} $mp] blockc blocks
lassign [exec stat -f -c {%S %b %f} $mp] blocks blockc blockf
set rec(SIZE) $($blockc * $blocks)
set rec(USED) $(100 - $blockf * 100 / $blockc)
# /dev/sda1: LABEL="SAN" UUID="DBC1-1CF8" TYPE="vfat"
catch {

View File

@ -1,7 +1,7 @@
# Deprecated - just use {file tdelete}
if {![exists -alias tdelete]} {
if {![exists -alias tdelete]} {
alias tdelete {file tdelete}
}