yacy_search_server/htroot/yacy/ui/yacyui-view-log.html
2009-04-25 20:58:56 +00:00

84 lines
3.0 KiB
HTML

<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
var height = document.documentElement.clientHeight - 180;
$("#ylog").flexigrid({
url: "/ViewLog_p.json",
dataType: 'json',
method: 'GET',
colModel: [
{display: 'Level', name : 'icon', width : 25, sortable : true, align: 'center'},
{display: 'Date', name : 'date', width : 75, sortable : true, align: 'left'},
{display: 'Type', name : 'type', width : 125, sortable : true, align: 'left'},
{display: 'Server Log', name : 'logline', width : 700, sortable : true, align: 'left'}
],
hideOnSubmit: false,
striped: true,
nowrap: false,
height: height,
autoload: true,
preProcess: function(data) {
var clientname = data.clientname;
var lines = data.line;
var maxlines = data.maxlines;
var reverse = data.reverse;
var rows = {};
$.each (
data.loglines,
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'/>";
else if (item.loglevel == "Info") icon = "<img style='margin-top: 8px;' src='img-2/info.png' alt='Info' title='Info'/>";
else if (item.loglevel == "System") icon = "<img style='margin-top: 8px;' src='img-2/accept_green.png' alt='System' title='System'/>";
else if (item.loglevel == "Warning") icon = "<img style='margin-top: 8px;' src='img/blacklist.png' alt='Warning' title='Warning'/>";
else if (item.loglevel == "Error") icon = "<img style='margin-top: 8px;' src='img-2/stop.png' alt='Error' title='Error'/>";
var date = item.logline.substring(2,21);
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]};
}
}
);
var pdata = {
page: 1,
total: lines,
rows: rows
};
return pdata;
},
onSubmit: function() {
var p = this;
var g = $("#ylog");
$('.pPageStat',this.pDiv).html(p.procmsg);
$('.pReload',this.pDiv).addClass('loading');
if (g.bDiv) $(g.block).css({top:g.bDiv.offsetTop});
if (p.hideOnSubmit) $(this.gDiv).prepend(g.block); //$(t).hide();
// if ($.browser.opera) $(t).css('visibility','hidden');
if (!p.newp) p.newp = 1;
if (p.page>p.pages) p.page = p.pages;
var param = [
{ name : 'lines', value : "200" }
,{ name : 'filter', value : ".*.*" }
,{ 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){
g.flexAddData(json);
}
);
}
});
});
//]]>
</script>
<table id="ylog">
<tbody></tbody>
</table>