From 06188094bff91abb8b0b1210e592dd5a434d18a0 Mon Sep 17 00:00:00 2001 From: HummyPkg Date: Thu, 17 Jan 2019 11:50:22 +0000 Subject: [PATCH] Clearing old logs should remove the file --- webif/html/diag/diag.jim | 4 +++- webif/html/diag/script.js | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/webif/html/diag/diag.jim b/webif/html/diag/diag.jim index 5bf875f5..18fa276d 100755 --- a/webif/html/diag/diag.jim +++ b/webif/html/diag/diag.jim @@ -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 " [file tail $file] ([pretty_size [file size $file]]) - + Clear
" } diff --git a/webif/html/diag/script.js b/webif/html/diag/script.js index 77a06523..f4e8f955 100644 --- a/webif/html/diag/script.js +++ b/webif/html/diag/script.js @@ -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 ' + file + '', - '/log/act.jim', { action: 'clear', file: file }); + '/log/act.jim', { action: act, file: file }); }); $.getJSON('/diag/rpc.jim?act=getall', function(data) {