Clearing old logs should remove the file

This commit is contained in:
HummyPkg 2019-01-17 11:50:22 +00:00
parent a4fe3dcaed
commit 06188094bf
2 changed files with 10 additions and 3 deletions

View File

@ -136,13 +136,15 @@ puts {
source /mod/webif/html/log/_lib.jim
foreach file [lsort -command logsort $loglist] {
set act clear
if {[string match {*.[0-9][0-9][0-9][0-9]*} $file]} { set act unlink }
puts "
<img border=0 height=14 src=/images/421_1_00_CH_Title_2R_Arrow.png>
<a href=\"../log/?log=[cgi_quote_url $file]\">
[file tail $file]
</a>
(<span class=lsize>[pretty_size [file size $file]]</span>)
<a class=\"va footnote logclear\" href=# file=\"$file\">
<a class=\"va footnote logclear\" act=$act href=# file=\"$file\">
<img class=va border=0 src=/img/close.png width=20>Clear</a>
<br>"
}

View File

@ -85,12 +85,17 @@ $('a.logclear').on('click', function(e) {
var $t = $(this);
var file = $t.attr('file');
var act = $t.attr('act');
if (!confirm('Delete ' + file + '?'))
if (act == 'clear')
t = 'Truncate';
else
t = 'Delete';
if (!confirm(t + ' ' + file + '?'))
return;
chunked_request('Clearing log <i>' + file + '</i>',
'/log/act.jim', { action: 'clear', file: file });
'/log/act.jim', { action: act, file: file });
});
$.getJSON('/diag/rpc.jim?act=getall', function(data) {