@ -1,8 +1,7 @@
< script type = "text/javascript" >
//< ![CDATA[
$(document).ready(function() {
var height = document.documentElement.clientHeight - 180;
$(document).ready(function() {
var height = document.documentElement.clientHeight - 230;
$("#ylog").flexigrid({
url: "/ViewLog_p.json",
dataType: 'json',
@ -17,16 +16,38 @@
striped: true,
nowrap: false,
height: height,
autoload: true,
autoload: true,
useRp: true,
rp: 50,
usepager: false,
rpOptions: [50,100,200,300,400],
searchitems : [
{display: 'Filter RegExp', name : 'filter'}
],
query: '.*.*',
buttons: [
{name: '50', bclass: 'log-new', onpress: filter},
{name: '200', bclass: 'log-more', onpress: filter},
{name: '400', bclass: 'log-more', onpress: filter},
{separator: true},
{name: 'Debug', bclass: 'log-debug', onpress: filter},
{name: 'Info', bclass: 'log-info', onpress: filter},
{name: 'System', bclass: 'log-system', onpress: filter},
{name: 'Warning', bclass: 'log-warning', onpress: filter},
{name: 'Error', bclass: 'log-error', onpress: filter},
{separator: true},
{name: 'Help', bclass: 'help', onpress: function() {}},
],
preProcess: function(data) {
var clientname = data.clientname;
var lines = data.line;
var maxlines = data.maxlines;
var reverse = data.reverse;
var rows = {};
var counter = 0;
$.each (
data.loglines,
function(i,item) {
function(i,item) {
if (item) {
var icon = "";
if (item.loglevel == "Debug") icon = "< img style = 'margin-top: 8px;' src = 'img-2/magnify.png' alt = 'Debug' title = 'Debug' / > ";
@ -38,18 +59,25 @@
var type = item.logline.substring(22,40).split(' ');
var log = item.logline.substring(22+type[0].length);
rows[i] = {id: i, cell: [icon, date, type[0], log]};
counter++;
}
}
);
counter--;
this.pagestat = "Displaying "+counter+" matching log lines of "+this.rp+" parsed log lines";
var pdata = {
page: 1,
total: lines,
rows: rows
};
$('#ylog tbody').empty();
return pdata;
},
onSubmit: function() {
var p = this;
$('#ylog').empty();
$('#ylog').append("< div class = 'yloading' > < h3 class = 'linktitle' > < em > Loading Server Log...< / em > < br / > < img src = '/yacy/ui/img/loading2.gif' align = 'absmiddle' / > < / h3 > < / div > ");
var p = this;
var g = $("#ylog");
$('.pPageStat',this.pDiv).html(p.procmsg);
@ -61,25 +89,43 @@
if (p.page>p.pages) p.page = p.pages;
var param = [
{ name : 'lines', value : "200" }
{ name : 'lines', value : p.rp }
,{ name : 'json', value : "true" }
,{ name : 'filter', value : ".*.*" }
,{ name : 'filter', value : p.query }
,{ name : 'reverse', value : "true"}
];
];
if (p.params) {
for (var pi = 0; pi < p.params.length ; pi + + ) param [ param . length ] = p . params [ pi ] ;
}
$.getJSON(p.url, param,
function(json, status){
function(json, status){
g.flexAddData(json);
}
);
}
});
});
});
function filter(com) {
var f = ".*.*";
var rp = 400;
if(com == "50") { f=".*.*"; rp = 50; };
if(com == "200") { f=".*.*"; rp = 200; };
if(com == "400") { f=".*.*"; rp = 400; };
if(com == "Debug") f="^D.*";
if(com == "Info") f="^I.*";
if(com == "System") f="^S.*";
if(com == "Warning") f="^W.*";
if(com == "Error") f="^E.*";
$('#ylog').flexOptions({
query: f,
qtype: "filter",
rp: rp
});
$('#ylog').flexReload();
}
//]]>
< / script >
<!-- Flexigrid -->
< table id = "ylog" >
< tbody > < / tbody >
< / table >
< / table >