reload log after changing log level

This commit is contained in:
Robin Appelman 2012-04-16 12:27:21 +02:00
parent 5720bd296d
commit e59c87ee36
2 changed files with 17 additions and 4 deletions

View file

@ -1,5 +1,7 @@
$(document).ready(function(){ $(document).ready(function(){
$('#loglevel').change(function(){ $('#loglevel').change(function(){
$.post(OC.filePath('settings','ajax','setloglevel.php'), { level: $(this).val() } ); $.post(OC.filePath('settings','ajax','setloglevel.php'), { level: $(this).val() },function(){
OC.Log.reload();
} );
}) })
}); });

View file

@ -5,16 +5,27 @@
*/ */
OC.Log={ OC.Log={
reload:function(count){
if(!count){
count=OC.Log.loaded;
}
OC.Log.loaded=0;
$('#log tbody').empty();
OC.Log.getMore(count);
},
levels:['Debug','Info','Warning','Error','Fatal'], levels:['Debug','Info','Warning','Error','Fatal'],
loaded:3,//are initially loaded loaded:3,//are initially loaded
getMore:function(){ getMore:function(count){
$.get(OC.filePath('settings','ajax','getlog.php'),{offset:OC.Log.loaded,count:10},function(result){ if(!count){
count=10;
}
$.get(OC.filePath('settings','ajax','getlog.php'),{offset:OC.Log.loaded,count:count},function(result){
if(result.status=='success'){ if(result.status=='success'){
OC.Log.addEntries(result.data); OC.Log.addEntries(result.data);
$('html, body').animate({scrollTop: $(document).height()}, 800); $('html, body').animate({scrollTop: $(document).height()}, 800);
} }
}); });
OC.Log.loaded+=10; OC.Log.loaded+=count;
}, },
addEntries:function(entries){ addEntries:function(entries){
for(var i=0;i<entries.length;i++){ for(var i=0;i<entries.length;i++){