From d3ca97dd2f6a12de191cd8bf178ca9132959c451 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Wed, 27 Mar 2013 14:51:30 +0100 Subject: [PATCH] Make it possible to show less log entries again - fix owncloud/core#1593 * show "less" button only if there are more than 3 entries * only "remove" logs till last 3 entries --- settings/js/log.js | 22 +++++++++++++++++++--- settings/templates/admin.php | 1 + 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/settings/js/log.js b/settings/js/log.js index 09b8ec1ab4..fe40f6e5d5 100644 --- a/settings/js/log.js +++ b/settings/js/log.js @@ -26,9 +26,22 @@ OC.Log={ if(!result.remain){ $('#moreLog').css('display', 'none'); } + $('#lessLog').css('display', ''); } }); }, + showLess:function(count){ + count = count || 10; + $('#moreLog').css('display', ''); + $('html, body').animate({scrollTop: $(document).height()}, 800); + while(OC.Log.loaded > 3 && count){ + $('#log tr').last().remove() + OC.Log.loaded -= 1; + count--; + } + if(OC.Log.loaded <= 3) + $('#lessLog').css('display', 'none'); + }, addEntries:function(entries){ for(var i=0;i'); levelTd.text(OC.Log.levels[entry.level]); row.append(levelTd); - + var appTd=$(''); appTd.text(entry.app); row.append(appTd); - + var messageTd=$(''); messageTd.text(entry.message); row.append(messageTd); - + var timeTd=$(''); timeTd.text(formatDate(entry.time*1000)); row.append(timeTd); @@ -58,4 +71,7 @@ $(document).ready(function(){ $('#moreLog').click(function(){ OC.Log.getMore(); }) + $('#lessLog').click(function(){ + OC.Log.showLess(); + }) }); diff --git a/settings/templates/admin.php b/settings/templates/admin.php index dd5e89b8f8..bdf4e676c1 100644 --- a/settings/templates/admin.php +++ b/settings/templates/admin.php @@ -221,6 +221,7 @@ endfor;?> ...'> + ...'>