diff options
author | Morris Jobke <morris.jobke@gmail.com> | 2013-03-27 14:51:30 +0100 |
---|---|---|
committer | Morris Jobke <morris.jobke@gmail.com> | 2013-03-27 15:14:09 +0100 |
commit | d3ca97dd2f6a12de191cd8bf178ca9132959c451 (patch) | |
tree | 0cffc014771b32eab5bbf819a71a953397351d15 /settings/js/log.js | |
parent | 0c666cb7640c062ecfb89c4f341dfc99f4c98875 (diff) | |
download | nextcloud-server-d3ca97dd2f6a12de191cd8bf178ca9132959c451.tar.gz nextcloud-server-d3ca97dd2f6a12de191cd8bf178ca9132959c451.zip |
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
Diffstat (limited to 'settings/js/log.js')
-rw-r--r-- | settings/js/log.js | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/settings/js/log.js b/settings/js/log.js index 09b8ec1ab44..fe40f6e5d56 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<entries.length;i++){ var entry=entries[i]; @@ -36,15 +49,15 @@ OC.Log={ var levelTd=$('<td/>'); levelTd.text(OC.Log.levels[entry.level]); row.append(levelTd); - + var appTd=$('<td/>'); appTd.text(entry.app); row.append(appTd); - + var messageTd=$('<td/>'); messageTd.text(entry.message); row.append(messageTd); - + var timeTd=$('<td/>'); 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(); + }) }); |