forked from I2P_Developers/i2p.i2p
/graphs:
- Add option to hide legends - Adjust size of up/down bw graph to match other graphs (ticket #1996) - Modify image font color to better blend with themes - Tweak spacing of elements for non-Debian installs
This commit is contained in:
@ -286,11 +286,11 @@ public interface RrdGraphConstants {
|
|||||||
/**
|
/**
|
||||||
* Used internally
|
* Used internally
|
||||||
*/
|
*/
|
||||||
int PADDING_LEFT = 5; // pix
|
int PADDING_LEFT = 0; // pix - absent vertical label provides padding here
|
||||||
/**
|
/**
|
||||||
* Used internally
|
* Used internally
|
||||||
*/
|
*/
|
||||||
int PADDING_TOP = 9; // pix
|
int PADDING_TOP = 5; // pix -- additional top pixels added by frame border
|
||||||
/**
|
/**
|
||||||
* Used internally
|
* Used internally
|
||||||
*/
|
*/
|
||||||
@ -314,7 +314,7 @@ public interface RrdGraphConstants {
|
|||||||
/**
|
/**
|
||||||
* Used internally
|
* Used internally
|
||||||
*/
|
*/
|
||||||
int PADDING_VLABEL = 7; // pix
|
int PADDING_VLABEL = 8; // pix
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stroke used to draw grid
|
* Stroke used to draw grid
|
||||||
|
@ -24,6 +24,7 @@ public class GraphHelper extends FormHandler {
|
|||||||
private int _height;
|
private int _height;
|
||||||
private int _refreshDelaySeconds;
|
private int _refreshDelaySeconds;
|
||||||
private boolean _persistent;
|
private boolean _persistent;
|
||||||
|
private boolean _graphHideLegend;
|
||||||
private String _stat;
|
private String _stat;
|
||||||
private int _end;
|
private int _end;
|
||||||
|
|
||||||
@ -32,6 +33,7 @@ public class GraphHelper extends FormHandler {
|
|||||||
private static final String PROP_REFRESH = "routerconsole.graphRefresh";
|
private static final String PROP_REFRESH = "routerconsole.graphRefresh";
|
||||||
private static final String PROP_PERIODS = "routerconsole.graphPeriods";
|
private static final String PROP_PERIODS = "routerconsole.graphPeriods";
|
||||||
private static final String PROP_EVENTS = "routerconsole.graphEvents";
|
private static final String PROP_EVENTS = "routerconsole.graphEvents";
|
||||||
|
private static final String PROP_LEGEND = "routerconsole.graphHideLegend";
|
||||||
public static final int DEFAULT_X = 400;
|
public static final int DEFAULT_X = 400;
|
||||||
public static final int DEFAULT_Y = 100;
|
public static final int DEFAULT_Y = 100;
|
||||||
private static final int DEFAULT_REFRESH = 5*60;
|
private static final int DEFAULT_REFRESH = 5*60;
|
||||||
@ -53,6 +55,7 @@ public class GraphHelper extends FormHandler {
|
|||||||
_periodCount = _context.getProperty(PROP_PERIODS, DEFAULT_PERIODS);
|
_periodCount = _context.getProperty(PROP_PERIODS, DEFAULT_PERIODS);
|
||||||
_refreshDelaySeconds = _context.getProperty(PROP_REFRESH, DEFAULT_REFRESH);
|
_refreshDelaySeconds = _context.getProperty(PROP_REFRESH, DEFAULT_REFRESH);
|
||||||
_showEvents = _context.getBooleanProperty(PROP_EVENTS);
|
_showEvents = _context.getBooleanProperty(PROP_EVENTS);
|
||||||
|
_graphHideLegend = _context.getBooleanProperty(PROP_LEGEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -128,6 +131,9 @@ public class GraphHelper extends FormHandler {
|
|||||||
/** @since 0.8.7 */
|
/** @since 0.8.7 */
|
||||||
public void setPersistent(String foo) { _persistent = true; }
|
public void setPersistent(String foo) { _persistent = true; }
|
||||||
|
|
||||||
|
/** @since 0.9.32 */
|
||||||
|
public void setHideLegend(String foo) { _graphHideLegend = true; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For single stat page
|
* For single stat page
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
@ -163,8 +169,16 @@ public class GraphHelper extends FormHandler {
|
|||||||
_out.write("<img class=\"statimage\""
|
_out.write("<img class=\"statimage\""
|
||||||
+ " src=\"viewstat.jsp?stat=bw.combined"
|
+ " src=\"viewstat.jsp?stat=bw.combined"
|
||||||
+ "&periodCount=" + _periodCount
|
+ "&periodCount=" + _periodCount
|
||||||
+ "&width=" + _width
|
+ "&width=" + _width);
|
||||||
+ "&height=" + (_height - 13)
|
if (!_graphHideLegend) {
|
||||||
|
// bw.combined graph has two entries in its legend
|
||||||
|
// -26 pixels equalizes its height with the other images
|
||||||
|
_out.write("&height=" + (_height - 26));
|
||||||
|
} else {
|
||||||
|
// no legend, no height difference needed
|
||||||
|
_out.write("&height=" + (_height));
|
||||||
|
}
|
||||||
|
_out.write("&hideLegend=" + _graphHideLegend
|
||||||
+ "\" alt=\"" + title + "\" title=\"" + title + "\"></a>\n");
|
+ "\" alt=\"" + title + "\" title=\"" + title + "\"></a>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,6 +202,7 @@ public class GraphHelper extends FormHandler {
|
|||||||
+ "&periodCount=" + _periodCount
|
+ "&periodCount=" + _periodCount
|
||||||
+ "&width=" + _width
|
+ "&width=" + _width
|
||||||
+ "&height=" + _height
|
+ "&height=" + _height
|
||||||
|
+ "&hideLegend=" + _graphHideLegend
|
||||||
+ "\" alt=\"" + title
|
+ "\" alt=\"" + title
|
||||||
+ "\" title=\"" + title + "\"></a>\n");
|
+ "\" title=\"" + title + "\"></a>\n");
|
||||||
}
|
}
|
||||||
@ -247,6 +262,7 @@ public class GraphHelper extends FormHandler {
|
|||||||
+ "&end=" + _end
|
+ "&end=" + _end
|
||||||
+ "&width=" + _width
|
+ "&width=" + _width
|
||||||
+ "&height=" + _height
|
+ "&height=" + _height
|
||||||
|
+ "&hideLegend=" + _graphHideLegend
|
||||||
+ "\"></div><p id=\"graphopts\">\n");
|
+ "\"></div><p id=\"graphopts\">\n");
|
||||||
|
|
||||||
if (_width < MAX_X && _height < MAX_Y) {
|
if (_width < MAX_X && _height < MAX_Y) {
|
||||||
@ -365,6 +381,11 @@ public class GraphHelper extends FormHandler {
|
|||||||
_out.write(_t("Graph size") + ":</td><td><input size=\"4\" style=\"text-align: right;\" type=\"text\" name=\"width\" value=\"" + _width
|
_out.write(_t("Graph size") + ":</td><td><input size=\"4\" style=\"text-align: right;\" type=\"text\" name=\"width\" value=\"" + _width
|
||||||
+ "\">" + _t("pixels wide") + " <input size=\"4\" style=\"text-align: right;\" type=\"text\" name=\"height\" value=\"" + _height
|
+ "\">" + _t("pixels wide") + " <input size=\"4\" style=\"text-align: right;\" type=\"text\" name=\"height\" value=\"" + _height
|
||||||
+ "\">" + _t("pixels high") + "</td><td class=\"infohelp\">" + _t("Note: Dimensions are for graph only (excludes title, labels and legend).") + "</td></tr><tr><td>\n");
|
+ "\">" + _t("pixels high") + "</td><td class=\"infohelp\">" + _t("Note: Dimensions are for graph only (excludes title, labels and legend).") + "</td></tr><tr><td>\n");
|
||||||
|
_out.write(_t("Hide legend") + ":</td><td colspan=\"2\">");
|
||||||
|
_out.write("<label><input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"hideLegend\"");
|
||||||
|
if (_graphHideLegend)
|
||||||
|
_out.write(HelperBase.CHECKED);
|
||||||
|
_out.write(">" + _t("Do not show legend on graphs") + "</label></td></tr><tr><td>\n");
|
||||||
_out.write(_t("Refresh delay") + ":</td><td colspan=\"2\"><select name=\"refreshDelay\">");
|
_out.write(_t("Refresh delay") + ":</td><td colspan=\"2\"><select name=\"refreshDelay\">");
|
||||||
for (int i = 0; i < times.length; i++) {
|
for (int i = 0; i < times.length; i++) {
|
||||||
_out.write("<option value=\"");
|
_out.write("<option value=\"");
|
||||||
@ -432,6 +453,7 @@ public class GraphHelper extends FormHandler {
|
|||||||
_periodCount != _context.getProperty(PROP_PERIODS, DEFAULT_PERIODS) ||
|
_periodCount != _context.getProperty(PROP_PERIODS, DEFAULT_PERIODS) ||
|
||||||
_refreshDelaySeconds != _context.getProperty(PROP_REFRESH, DEFAULT_REFRESH) ||
|
_refreshDelaySeconds != _context.getProperty(PROP_REFRESH, DEFAULT_REFRESH) ||
|
||||||
_showEvents != _context.getBooleanProperty(PROP_EVENTS) ||
|
_showEvents != _context.getBooleanProperty(PROP_EVENTS) ||
|
||||||
|
_graphHideLegend != _context.getBooleanProperty(PROP_LEGEND) ||
|
||||||
_persistent != _context.getBooleanPropertyDefaultTrue(SummaryListener.PROP_PERSISTENT)) {
|
_persistent != _context.getBooleanPropertyDefaultTrue(SummaryListener.PROP_PERSISTENT)) {
|
||||||
Map<String, String> changes = new HashMap<String, String>();
|
Map<String, String> changes = new HashMap<String, String>();
|
||||||
changes.put(PROP_X, "" + _width);
|
changes.put(PROP_X, "" + _width);
|
||||||
@ -439,6 +461,7 @@ public class GraphHelper extends FormHandler {
|
|||||||
changes.put(PROP_PERIODS, "" + _periodCount);
|
changes.put(PROP_PERIODS, "" + _periodCount);
|
||||||
changes.put(PROP_REFRESH, "" + _refreshDelaySeconds);
|
changes.put(PROP_REFRESH, "" + _refreshDelaySeconds);
|
||||||
changes.put(PROP_EVENTS, "" + _showEvents);
|
changes.put(PROP_EVENTS, "" + _showEvents);
|
||||||
|
changes.put(PROP_LEGEND, "" + _graphHideLegend);
|
||||||
changes.put(SummaryListener.PROP_PERSISTENT, "" + _persistent);
|
changes.put(SummaryListener.PROP_PERSISTENT, "" + _persistent);
|
||||||
_context.router().saveConfig(changes, null);
|
_context.router().saveConfig(changes, null);
|
||||||
addFormNotice(_t("Graph settings saved"));
|
addFormNotice(_t("Graph settings saved"));
|
||||||
|
@ -40,6 +40,8 @@ class SummaryRenderer {
|
|||||||
private static final Color SHADEB_COLOR = new Color(246, 246, 255);
|
private static final Color SHADEB_COLOR = new Color(246, 246, 255);
|
||||||
private static final Color GRID_COLOR = new Color(100, 100, 100, 75);
|
private static final Color GRID_COLOR = new Color(100, 100, 100, 75);
|
||||||
private static final Color MGRID_COLOR = new Color(255, 91, 91, 110);
|
private static final Color MGRID_COLOR = new Color(255, 91, 91, 110);
|
||||||
|
private static final Color FONT_COLOR = new Color(51, 51, 63);
|
||||||
|
private static final Color FRAME_COLOR = new Color(51, 51, 63);
|
||||||
private static final Color AREA_COLOR = new Color(100, 160, 200, 200);
|
private static final Color AREA_COLOR = new Color(100, 160, 200, 200);
|
||||||
private static final Color LINE_COLOR = new Color(0, 30, 110, 255);
|
private static final Color LINE_COLOR = new Color(0, 30, 110, 255);
|
||||||
private static final Color RESTART_BAR_COLOR = new Color(223, 13, 13, 255);
|
private static final Color RESTART_BAR_COLOR = new Color(223, 13, 13, 255);
|
||||||
@ -139,6 +141,8 @@ class SummaryRenderer {
|
|||||||
def.setColor(RrdGraphDef.COLOR_SHADEB, SHADEB_COLOR);
|
def.setColor(RrdGraphDef.COLOR_SHADEB, SHADEB_COLOR);
|
||||||
def.setColor(RrdGraphDef.COLOR_GRID, GRID_COLOR);
|
def.setColor(RrdGraphDef.COLOR_GRID, GRID_COLOR);
|
||||||
def.setColor(RrdGraphDef.COLOR_MGRID, MGRID_COLOR);
|
def.setColor(RrdGraphDef.COLOR_MGRID, MGRID_COLOR);
|
||||||
|
def.setColor(RrdGraphDef.COLOR_FONT, FONT_COLOR);
|
||||||
|
def.setColor(RrdGraphDef.COLOR_FRAME, FRAME_COLOR);
|
||||||
def.setFont(RrdGraphDef.FONTTAG_DEFAULT, new Font(DEFAULT_FONT_NAME, Font.PLAIN, 10));
|
def.setFont(RrdGraphDef.FONTTAG_DEFAULT, new Font(DEFAULT_FONT_NAME, Font.PLAIN, 10));
|
||||||
def.setFont(RrdGraphDef.FONTTAG_TITLE, new Font(DEFAULT_FONT_NAME, Font.PLAIN, 10));
|
def.setFont(RrdGraphDef.FONTTAG_TITLE, new Font(DEFAULT_FONT_NAME, Font.PLAIN, 10));
|
||||||
def.setFont(RrdGraphDef.FONTTAG_AXIS, new Font("Droid Sans Mono", Font.PLAIN, 10));
|
def.setFont(RrdGraphDef.FONTTAG_AXIS, new Font("Droid Sans Mono", Font.PLAIN, 10));
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2017-10-25 str4d
|
||||||
|
* Console:
|
||||||
|
- /graphs:
|
||||||
|
- Add option to hide legends
|
||||||
|
- Adjust size of up/down bw graph to match other graphs (ticket #1996)
|
||||||
|
- Modify image font color to better blend with themes
|
||||||
|
- Tweak spacing of elements for non-Debian installs
|
||||||
|
|
||||||
2017-10-11 zzz
|
2017-10-11 zzz
|
||||||
* Console: Validate host header (thx Kevin Froman)
|
* Console: Validate host header (thx Kevin Froman)
|
||||||
* Router: Honor IPv6 setting when converting configured hostnames
|
* Router: Honor IPv6 setting when converting configured hostnames
|
||||||
|
Reference in New Issue
Block a user