Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

- added a log viewer to RichClient (alpha version, very slow)

apfelmaennchen2eabd989ce59
diff --git a/htroot/ViewLog_p.java b/htroot/ViewLog_p.java
index f07b70eb1..dbbd79032 100644
--- a/htroot/ViewLog_p.java
+++ b/htroot/ViewLog_p.java
@@ -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;
+ }
}
@@ -104,10 +108,10 @@ public class ViewLog_p {
else if (nextLogLine.startsWith("W ")) level = 3;
else if (nextLogLine.startsWith("S ")) level = 2;
else if (nextLogLine.startsWith("I ")) level = 1;
- else if (nextLogLine.startsWith("D ")) level = 0;
-
+ 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);
diff --git a/htroot/ViewLog_p.json b/htroot/ViewLog_p.json
new file mode 100644
index 000000000..cad3282c2
--- /dev/null
+++ b/htroot/ViewLog_p.json
@@ -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: ""}
+ ]
+}
\ No newline at end of file
diff --git a/htroot/yacy/ui/index.html b/htroot/yacy/ui/index.html
index abe6e3318..db07b618e 100644
--- a/htroot/yacy/ui/index.html
+++ b/htroot/yacy/ui/index.html
@@ -12,15 +12,14 @@
<link media="screen" type="text/css" href="css/base.css" rel="stylesheet" />
<link media="screen" type="text/css" href="css/jquery.flexigrid.css" rel="stylesheet" />
<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 */
@@ -310,7 +310,8 @@
<!-- initial tabs only, dynamic tabs are loaded via jQuery -->
<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-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">
@@ -380,16 +381,20 @@
<p>This dialog lets you select an alternate theme/skin for YaCy-UI.</p>
<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>
+ <select id="theme" name="theme" class="selector">
+ <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>
+
diff --git a/htroot/yacy/ui/yacyui-view-log.html b/htroot/yacy/ui/yacyui-view-log.html
new file mode 100644
index 000000000..634411ae5
--- /dev/null
+++ b/htroot/yacy/ui/yacyui-view-log.html
@@ -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>
\ No newline at end of file