hide stat log config unless already enabled

This commit is contained in:
zzz
2012-02-22 15:41:04 +00:00
parent 13731e7b35
commit 667bd46643
2 changed files with 54 additions and 11 deletions

View File

@ -59,7 +59,15 @@ public class ConfigStatsHelper extends HelperBase {
_filters.add(tok.nextToken().trim()); _filters.add(tok.nextToken().trim());
} }
public ConfigStatsHelper() {} /**
* Just hide for everybody unless already set.
* To enable set advanced config stat.logFilters=foo before starting...
* it has to be set at startup anyway for logging to be enabled at all
* @since 0.9
*/
public boolean shouldShowLog() {
return !_filters.isEmpty();
}
public String getFilename() { return _context.statManager().getStatFile(); } public String getFilename() { return _context.statManager().getStatFile(); }

View File

@ -78,8 +78,19 @@ function toggleAll(category)
<input type="checkbox" class="optbox" name="isFull" value="true" <% <input type="checkbox" class="optbox" name="isFull" value="true" <%
if (statshelper.getIsFull()) { %>checked="true" <% } %> > if (statshelper.getIsFull()) { %>checked="true" <% } %> >
(<%=intl._("change requires restart to take effect")%>)<br> (<%=intl._("change requires restart to take effect")%>)<br>
<%=intl._("Stat file")%>: <input type="text" name="filename" value="<%=statshelper.getFilename()%>" ><br> <%
<%=intl._("Filter")%>: (<a href="javascript:void(null);" onclick="toggleAll('*')"><%=intl._("toggle all")%></a>)<br></p>
// stats.log for devs only and grows without bounds, not recommended
boolean shouldShowLog = statshelper.shouldShowLog();
if (shouldShowLog) {
%><%=intl._("Stat file")%>: <input type="text" name="filename" value="<%=statshelper.getFilename()%>" ><br>
Warning - Log with care, stat file grows without limit.<br>
<%
} // shouldShowLog
%><%=intl._("Filter")%>: (<a href="javascript:void(null);" onclick="toggleAll('*')"><%=intl._("toggle all")%></a>)<br></p>
<div class="wideload"> <div class="wideload">
<table> <table>
<% while (statshelper.hasMoreStats()) { <% while (statshelper.hasMoreStats()) {
@ -90,27 +101,51 @@ function toggleAll(category)
(<a href="javascript:void(null);" onclick="toggleAll('<%=statshelper.getCurrentGroupName()%>')"><%=intl._("toggle all")%></a>) (<a href="javascript:void(null);" onclick="toggleAll('<%=statshelper.getCurrentGroupName()%>')"><%=intl._("toggle all")%></a>)
</td></tr> </td></tr>
<tr class="tablefooter"> <tr class="tablefooter">
<td align="center"><b><%=intl._("Log")%></b></td> <%
<td align="center"><b><%=intl._("Graph")%></b></td>
if (shouldShowLog) {
%> <td align="center"><b><%=intl._("Log")%></b></td>
<%
} // shouldShowLog
%> <td align="center"><b><%=intl._("Graph")%></b></td>
<td></td></tr> <td></td></tr>
<% <%
} // end iterating over required groups for the current stat %> } // end iterating over required groups for the current stat %>
<tr><td align="center"> <tr>
<%
if (shouldShowLog) {
%> <td align="center">
<a name="<%=statshelper.getCurrentStatName()%>"></a> <a name="<%=statshelper.getCurrentStatName()%>"></a>
<input type="checkbox" class="optbox <%=statshelper.getCurrentGroupName()%>" name="statList" value="<%=statshelper.getCurrentStatName()%>" <% <input type="checkbox" class="optbox <%=statshelper.getCurrentGroupName()%>" name="statList" value="<%=statshelper.getCurrentStatName()%>" <%
if (statshelper.getCurrentIsLogged()) { %>checked="true" <% } %> ></td> if (statshelper.getCurrentIsLogged()) { %>checked="true" <% } %> ></td>
<td align="center"> <%
} // shouldShowLog
%> <td align="center">
<% if (statshelper.getCurrentCanBeGraphed()) { %> <% if (statshelper.getCurrentCanBeGraphed()) { %>
<input type="checkbox" class="optbox <%=statshelper.getCurrentGroupName()%>" name="graphList" value="<%=statshelper.getCurrentGraphName()%>" <% <input type="checkbox" class="optbox <%=statshelper.getCurrentGroupName()%>" name="graphList" value="<%=statshelper.getCurrentGraphName()%>" <%
if (statshelper.getCurrentIsGraphed()) { %>checked="true" <% } %> ><% } %></td> if (statshelper.getCurrentIsGraphed()) { %>checked="true" <% } %> ><% } %></td>
<td align="left"><b><%=statshelper.getCurrentStatName()%>:</b><br> <td align="left"><b><%=statshelper.getCurrentStatName()%>:</b><br>
<%=statshelper.getCurrentStatDescription()%></td></tr><% <%=statshelper.getCurrentStatDescription()%></td></tr><%
} // end iterating over all stats %> } // end iterating over all stats
<tr><td colspan="3"></td></tr>
if (shouldShowLog) {
%> <tr><td colspan="3"></td></tr>
<tr><td align="center"><input type="checkbox" class="optbox" name="explicitFilter" ></td> <tr><td align="center"><input type="checkbox" class="optbox" name="explicitFilter" ></td>
<td colspan="2"><%=intl._("Advanced filter")%>: <td colspan="2"><%=intl._("Advanced filter")%>:
<input type="text" name="explicitFilterValue" value="<%=statshelper.getExplicitFilter()%>" size="40" ></td></tr> <input type="text" name="explicitFilterValue" value="<%=statshelper.getExplicitFilter()%>" size="40" ></td></tr>
<tr class="tablefooter"><td colspan="3" align="right"> <%
} // shouldShowLog
%> <tr class="tablefooter"><td colspan="3" align="right">
<input type="reset" class="cancel" value="<%=intl._("Cancel")%>" > <input type="reset" class="cancel" value="<%=intl._("Cancel")%>" >
<input type="submit" name="shouldsave" class="accept" value="<%=intl._("Save changes")%>" > <input type="submit" name="shouldsave" class="accept" value="<%=intl._("Save changes")%>" >
</td></tr> </td></tr>