forked from I2P_Developers/i2p.i2p
hide stat log config unless already enabled
This commit is contained in:
@ -59,8 +59,16 @@ public class ConfigStatsHelper extends HelperBase {
|
||||
_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(); }
|
||||
|
||||
/**
|
||||
|
@ -78,8 +78,19 @@ function toggleAll(category)
|
||||
<input type="checkbox" class="optbox" name="isFull" value="true" <%
|
||||
if (statshelper.getIsFull()) { %>checked="true" <% } %> >
|
||||
(<%=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">
|
||||
<table>
|
||||
<% while (statshelper.hasMoreStats()) {
|
||||
@ -90,27 +101,51 @@ function toggleAll(category)
|
||||
(<a href="javascript:void(null);" onclick="toggleAll('<%=statshelper.getCurrentGroupName()%>')"><%=intl._("toggle all")%></a>)
|
||||
</td></tr>
|
||||
<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>
|
||||
<%
|
||||
} // end iterating over required groups for the current stat %>
|
||||
<tr><td align="center">
|
||||
<tr>
|
||||
<%
|
||||
|
||||
if (shouldShowLog) {
|
||||
|
||||
%> <td align="center">
|
||||
<a name="<%=statshelper.getCurrentStatName()%>"></a>
|
||||
<input type="checkbox" class="optbox <%=statshelper.getCurrentGroupName()%>" name="statList" value="<%=statshelper.getCurrentStatName()%>" <%
|
||||
if (statshelper.getCurrentIsLogged()) { %>checked="true" <% } %> ></td>
|
||||
<td align="center">
|
||||
<%
|
||||
|
||||
} // shouldShowLog
|
||||
|
||||
%> <td align="center">
|
||||
<% if (statshelper.getCurrentCanBeGraphed()) { %>
|
||||
<input type="checkbox" class="optbox <%=statshelper.getCurrentGroupName()%>" name="graphList" value="<%=statshelper.getCurrentGraphName()%>" <%
|
||||
if (statshelper.getCurrentIsGraphed()) { %>checked="true" <% } %> ><% } %></td>
|
||||
<td align="left"><b><%=statshelper.getCurrentStatName()%>:</b><br>
|
||||
<%=statshelper.getCurrentStatDescription()%></td></tr><%
|
||||
} // end iterating over all stats %>
|
||||
<tr><td colspan="3"></td></tr>
|
||||
} // end iterating over all stats
|
||||
|
||||
if (shouldShowLog) {
|
||||
|
||||
%> <tr><td colspan="3"></td></tr>
|
||||
<tr><td align="center"><input type="checkbox" class="optbox" name="explicitFilter" ></td>
|
||||
<td colspan="2"><%=intl._("Advanced filter")%>:
|
||||
<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="submit" name="shouldsave" class="accept" value="<%=intl._("Save changes")%>" >
|
||||
</td></tr>
|
||||
|
Reference in New Issue
Block a user