mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
- added a log viewer to RichClient (alpha version, very slow)
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5878 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
138a0747e3
commit
2eabd989ce
|
@ -45,6 +45,7 @@ public class ViewLog_p {
|
|||
final serverObjects prop = new serverObjects();
|
||||
String[] log = new String[0];
|
||||
boolean reversed = false;
|
||||
boolean json = false;
|
||||
int maxlines = 400, lines = 200;
|
||||
String filter = ".*.*";
|
||||
|
||||
|
@ -58,6 +59,9 @@ public class ViewLog_p {
|
|||
if(post.containsKey("filter")){
|
||||
filter = post.get("filter");
|
||||
}
|
||||
if(post.containsKey("json")){
|
||||
json = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -105,9 +109,9 @@ public class ViewLog_p {
|
|||
else if (nextLogLine.startsWith("S ")) level = 2;
|
||||
else if (nextLogLine.startsWith("I ")) level = 1;
|
||||
else if (nextLogLine.startsWith("D ")) level = 0;
|
||||
|
||||
prop.put("log_" + lc + "_level", level);
|
||||
prop.putHTML("log_" + lc + "_line", nextLogLine);
|
||||
if (json) prop.putJSON("log_" + lc + "_line", nextLogLine);
|
||||
else prop.put("log_" + lc + "_line", nextLogLine);
|
||||
lc++;
|
||||
}
|
||||
prop.put("log", lc);
|
||||
|
|
13
htroot/ViewLog_p.json
Normal file
13
htroot/ViewLog_p.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"clientname": "#[clientname]#",
|
||||
"line": "#[lines]#",
|
||||
"maxlines": "#[maxlines]#",
|
||||
"reverse": "#(reverseChecked)#false::true#(/reverseChecked)#",
|
||||
"filter": "#[filter]#",
|
||||
"loglines": [
|
||||
#{log}#{
|
||||
"loglevel": "#(level)#Debug::Info::System::Warning::Error#(/level)#",
|
||||
"logline": "#[line]#"
|
||||
},#{/log}#{loglevel: "", logline: ""}
|
||||
]
|
||||
}
|
|
@ -14,13 +14,12 @@
|
|||
<link media="screen" type="text/css" href="css/jquery.treeview.css" rel="stylesheet" />
|
||||
|
||||
<link media="screen" type="text/css" href="css/themes/start/ui.all.css" rel="stylesheet" title="start"/>
|
||||
<link media="screen" type="text/css" href="css/themes/base/ui.all.css" rel="alternate stylesheet" title="base"/>
|
||||
<link media="screen" type="text/css" href="css/themes/humanity/ui.all.css" rel="alternate stylesheet" title="humanity"/>
|
||||
<link media="screen" type="text/css" href="css/themes/cupertino/ui.all.css" rel="alternate stylesheet" title="cupertino"/>
|
||||
<link media="screen" type="text/css" href="css/themes/redmond/ui.all.css" rel="alternate stylesheet" title="redmond"/>
|
||||
<link media="screen" type="text/css" href="css/themes/smoothness/ui.all.css" rel="alternate stylesheet" title="smoothness"/>
|
||||
<link media="screen" type="text/css" href="css/themes/darkness/ui.all.css" rel="alternate stylesheet" title="darkness"/>
|
||||
|
||||
<link media="screen" type="text/css" href="css/themes/ui-darkness/ui.all.css" rel="alternate stylesheet" title="ui-darkness"/>
|
||||
<link media="screen" type="text/css" href="css/themes/ui-lightness/ui.all.css" rel="alternate stylesheet" title="ui-lightness"/>
|
||||
|
||||
<script src="js/jquery-1.3.1.min.js" type="text/javascript"></script>
|
||||
<script src="js/jquery.ui.all.min.js" type="text/javascript"></script>
|
||||
|
@ -52,6 +51,7 @@
|
|||
return (this.match(str+"$")==str)
|
||||
}
|
||||
$(function() {
|
||||
theme = "start";
|
||||
qtag = "";
|
||||
flex = {};
|
||||
bmk_tab = 2;
|
||||
|
@ -157,7 +157,7 @@
|
|||
/* Select Theme Dialog */
|
||||
$("#theme_select").dialog({
|
||||
autoOpen: false,
|
||||
height: 220,
|
||||
height: 270,
|
||||
width: 275,
|
||||
position: ['top',200],
|
||||
modal: true,
|
||||
|
@ -172,7 +172,7 @@
|
|||
}
|
||||
});
|
||||
$("#theme").change(function() {
|
||||
var src = "css/themes/" + $("#theme").getValue() +"/images/theme.png";
|
||||
var src = "img/themes/"+$("#theme").getValue()+".png";
|
||||
$("#theme_preview").attr("src", src).trigger("update");
|
||||
});
|
||||
/* Initialize Edit Tags Dialog */
|
||||
|
@ -311,6 +311,7 @@
|
|||
<li><a href="yacyui-welcome.html" title="About YaCy-UI"><span>About YaCy-UI</span></a></li>
|
||||
<li><a href="yacyui-admin.html" title="Admin Console"><span>Admin Console</span></a></li>
|
||||
<li><a href="yacyui-bookmarks.html" title="Bookmarks"><span>Bookmarks</span></a></li>
|
||||
<li><a href="yacyui-view-log.html" title="Server Log"><span>Server Log</span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="dialog-container">
|
||||
|
@ -381,15 +382,19 @@
|
|||
<form method="post" accept-charset="UTF-8" action="jQuery">
|
||||
<div>
|
||||
<select id="theme" name="theme" class="selector">
|
||||
<option value="base" selected="selected">Base Theme</option>
|
||||
<option value="start" selected="selected">Base Theme</option>
|
||||
<option value="redmond" >Redmond</option>
|
||||
<option value="cupertino" >Cupertino</option>
|
||||
<option value="smoothness" >Smoothness</option>
|
||||
<option value="darkness" >Darkness</option>
|
||||
<option value="ui-darkness" >UI Darkness</option>
|
||||
<option value="ui-lightness" >UI Lightness</option>
|
||||
<option value="humanity" >Humanity</option>
|
||||
<option value="custom" >Custom Theme</option>
|
||||
</select>
|
||||
<img id="theme_preview" src="css/themes/base/images/theme.png" style="padding-left: 10px;"/>
|
||||
<img id="theme_preview" src="img/themes/start.png" style="padding-left: 10px;"/>
|
||||
<p>You can <a href="http://jquery-ui.googlecode.com/files/jquery-ui-themes-1.7.zip" target="_blank">
|
||||
download</a> ready made themes or <a href="http://jqueryui.com/themeroller/" target="_blank">create</a>
|
||||
your own custom theme. Themes are installed into<br/>DATA/HTDOCS/yacy/ui/css/themes/</p>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -397,3 +402,4 @@
|
|||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
|
84
htroot/yacy/ui/yacyui-view-log.html
Normal file
84
htroot/yacy/ui/yacyui-view-log.html
Normal file
|
@ -0,0 +1,84 @@
|
|||
<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>
|
Loading…
Reference in New Issue
Block a user