major overhaul of the manage app's api-documentation functions.

things can now be rendered to static html, new helma features are
supported (prototype extension), everyhting is done in a nice and
clean way with skins.
This commit is contained in:
stefanp 2002-11-21 18:36:03 +00:00
parent 76bbe4053b
commit 7633e98eea
59 changed files with 1052 additions and 578 deletions

View file

@ -149,20 +149,53 @@ function countFreeEvaluators_macro() {
/**
* Macro formatting the 5min average of requests.
* Macro returning the current number of objects in the cache
*/
function getRequestAvg_macro(par) {
if ( app.requestStat==null || app.requestStat.get(this.name)==null )
return 0;
if ( this.isActive() ) {
var obj = app.requestStat.get(this.name);
return obj.last5Min + formatCount(obj.last5Min,par);
function cacheusage_macro (param) {
return this.getCacheUsage ();
}
/**
* Macro returning the number of objects allowed in the cache
*/
function cachesize_macro (param) {
return this.getProperty ("cachesize", "1000");
}
/**
* Macro formatting the number of requests in the last 5 minutes
*/
function requestCount_macro(par) {
if (app.data.stat==null || app.data.stat.get (this.name)==null)
return "not available";
if (this.isActive()) {
var obj = app.data.stat.get (this.name);
return obj.requestCount + formatCount (obj.requestCount, par);
} else {
return 0 + formatCount(0,par);
return 0 + formatCount (0,par);
}
}
/**
* Macro formatting the number of errors in the last 5 minutes
*/
function errorCount_macro(par) {
if (app.data.stat==null || app.data.stat.get (this.name)==null)
return "not available";
if (this.isActive()) {
var obj = app.data.stat.get (this.name);
return obj.errorCount + formatCount (obj.errorCount, par);
} else {
return 0 + formatCount (0,par);
}
}
/**
* Macro formatting app.properties
*/
@ -170,3 +203,8 @@ function properties_macro(par) {
formatProperties( this.getProperties(), par );
}
function appdir_macro (param) {
return this.getAppDir ().toString ();
}

View file

@ -2,8 +2,10 @@
* renders AppManager
*/
if ( checkAddress()==false ) return;
if ( checkAuth(this)==false ) return;
if (checkAddress()==false)
return;
if (checkAuth(this)==false)
return;
res.data.body = this.renderSkinAsString("main");
renderSkin ("global");

View file

@ -1,42 +1,62 @@
<% this.skin name="head" %>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="list_separator" colspan="3">application</td>
</tr>
</table>
<table border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="list_property" align="right" width="200">active sessions:</td>
<td class="list_property" align="left">active sessions</td>
<td class="list_property" width="5">&nbsp;</td>
<td class="list_property" align="left"><% this.countSessions %></td>
</tr>
<tr>
<td class="list_property" align="right" width="200"><a href="<% this.href action="main" %>?showusers=true">logged-in users:</a></td>
<td class="list_property" align="left"><a href="<% this.href action="main" %>?showusers=true">logged-in users</a></td>
<td class="list_property" width="5">&nbsp;</td>
<td class="list_property" align="left"><% this.users %>&nbsp;</td>
</tr>
<tr>
<td class="list_property" align="right" width="200">active evaluators:</td>
<td class="list_property" align="left">active evaluators</td>
<td class="list_property" width="5">&nbsp;</td>
<td class="list_property" align="left"><% this.countActiveEvaluators %></td>
</tr>
<tr>
<td class="list_property" align="right" width="200">free evaluators:</td>
<td class="list_property" align="left">free evaluators</td>
<td class="list_property" width="5">&nbsp;</td>
<td class="list_property" align="left"><% this.countFreeEvaluators %></td>
</tr>
<tr>
<td class="list_property" align="right" width="200">requests / 5 min:</td>
<td class="list_property" align="left">requests / 5 min</td>
<td class="list_property" width="5">&nbsp;</td>
<td class="list_property" align="left"><% this.getRequestAvg %></td>
<td class="list_property" align="left"><% this.requestCount %></td>
</tr>
<tr>
<td class="list_property" align="right" width="200">uptime:</td>
<td class="list_property" align="left">errors / 5 min</td>
<td class="list_property" width="5">&nbsp;</td>
<td class="list_property" align="left"><% this.errorCount %></td>
</tr>
<tr>
<td class="list_property" align="left">cache usage</td>
<td class="list_property" width="5">&nbsp;</td>
<td class="list_property" align="left"><% this.cacheusage %> objects of <% this.cachesize %></td>
</tr>
<tr>
<td class="list_property" align="left">uptime</td>
<td class="list_property" width="5">&nbsp;</td>
<td class="list_property" align="left"><% this.uptime %></td>
</tr>
<tr>
<td class="list_separator" colspan="3">app.properties</td>
<td class="list_property" align="left">app directory</td>
<td class="list_property" width="5">&nbsp;</td>
<td class="list_property" align="left"><% this.appdir %></td>
</tr>
<% this.properties itemprefix='<tr><td class="list_property" align="right" valign="top" width="200">' separator='</td><td class="list_property" width="5">&nbsp;</td><td class="list_property" align="left" valign="top">' itemsuffix='</td></tr>' % -->
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="list_separator" colspan="3">app.properties</td>
</tr>
<% this.properties itemprefix='<tr><td class="list_property" valign="top">' separator='</td><td class="list_property" width="5">&nbsp;</td><td class="list_property" valign="top">' itemsuffix='</td></tr>' %>
</table>

View file

@ -1,23 +1,42 @@
/**
* prints session- and thread-stats for mrtg-tool
* doesn't check username or password, so that we don't have
* to write them cleartext in a mrtg-configfile
* to write them cleartext in a mrtg-configfile but checks the
* remote address.
*/
if ( checkAddress()==false ) return;
if ( checkAddress()==false )
return;
if ( this.isActive()==false ) {
res.write ( "0\n0\n0\n0\n");
return;
}
if ( req.data.action=="sessions" ) {
res.write ( this.sessions.size() + "\n0\n0\n0\n" );
return;
}
if (req.data.action=="sessions") {
if ( req.data.action=="threads" ) {
res.write ( this.countActiveEvaluators() + "\n" + this.countFreeEvaluators() + "\n0\n0\n");
return;
res.write (this.sessions.size());
res.write ("\n0\n0\n0\n");
} else if (req.data.action=="threads") {
res.write (this.countActiveEvaluators () + "\n");
res.write (this.countEvaluators () + "\n");
res.write ("0\n0\n");
} else if (req.data.action=="cache") {
res.write (this.getCacheUsage () + "\n");
res.write (this.getProperty ("cachesize", "1000") + "\n");
res.write ("0\n0\n");
} else if (req.data.action=="requests") {
// res.write (
} else {
res.write ( "0\n0\n0\n0\n");
}

View file

@ -2,14 +2,15 @@
<b><a href="<% this.href action="main" %>"><% this.title %></a></b><br />
<small><% this.countSessions singular=" Session" plural=" Sessions" %>, <% this.getRequestAvg singular=" Request" plural=" Requests" %>/5min</small>
<div align="right">
<!--<table border="0" cellspacing="0" cellpadding="0">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right" valign="top"><small>
<a href="<% this.href action="api" %>/render">render AppDoc</a>
<a href="<% this.href action="api" %>/main">AppDoc</a>
<a href="<% root.href action="main" %>?app=<% this.title %>&action=flush">flush</a>
<a href="<% root.href action="main" %>?app=<% this.title %>&action=restart">restart</a>
</small></td>
</tr>
</table>-->
</table>
</div>
</div>