Changeset 91977aa


Ignore:
Timestamp:
Nov 3, 2017 2:39:05 AM (3 years ago)
Author:
str4d <str4d@…>
Branches:
master
Children:
3b1a1fa
Parents:
a715d2b
Message:

/graphs:

  • Reorganised config form
  • Fixed "hide legends" option
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/GraphHelper.java

    ra715d2b r91977aa  
    3939    private static final int DEFAULT_REFRESH = 5*60;
    4040    private static final int DEFAULT_PERIODS = 60;
     41    private static final boolean DEFAULT_LEGEND = false;
    4142    static final int MAX_X = 2048;
    4243    static final int MAX_Y = 1024;
     
    5657        _refreshDelaySeconds = _context.getProperty(PROP_REFRESH, DEFAULT_REFRESH);
    5758        _showEvents = _context.getBooleanProperty(PROP_EVENTS);
    58         _graphHideLegend = _context.getBooleanProperty(PROP_LEGEND);
    5959    }
    6060
     
    159159                else if (title.equals("bw.recvRate")) hasRx = true;
    160160            }
     161            boolean hideLegend = _context.getProperty(PROP_LEGEND, DEFAULT_LEGEND);
    161162
    162163            if (hasTx && hasRx && !_showEvents) {
     
    171172                           + "&amp;periodCount=" + _periodCount
    172173                           + "&amp;width=" + _width);
    173                 if (!_graphHideLegend) {
     174                if (!hideLegend) {
    174175                    // bw.combined graph has two entries in its legend
    175176                    // -26 pixels equalizes its height with the other images
     
    179180                    _out.write("&amp;height=" + (_height));
    180181                }
    181                 _out.write("&amp;hideLegend=" + _graphHideLegend
     182                _out.write("&amp;hideLegend=" + hideLegend
    182183                           + "\" alt=\"" + title + "\" title=\"" + title + "\"></a>\n");
    183184            }
     
    203204                           + "&amp;width=" + _width
    204205                           + "&amp;height=" + _height
    205                            + "&amp;hideLegend=" + _graphHideLegend
     206                           + "&amp;hideLegend=" + hideLegend
    206207                           + "\" alt=\"" + title
    207208                           + "\" title=\"" + title + "\"></a>\n");
     
    253254                _out.write(' ' + _t("ending {0} ago", DataHelper.formatDuration2(_end * period)));
    254255
     256            boolean hideLegend = _context.getProperty(PROP_LEGEND, DEFAULT_LEGEND);
    255257            _out.write("&nbsp;<a href=\"graphs\">[" + _t("Return to main graphs page") + "]</a></h3>\n"
    256258                       + "<div class=\"graphspanel\"><img class=\"statimage\" border=\"0\""
     
    263265                       + "&amp;width=" + _width
    264266                       + "&amp;height=" + _height
    265                        + "&amp;hideLegend=" + _graphHideLegend
     267                       + "&amp;hideLegend=" + hideLegend
    266268                       + "\"></div><p id=\"graphopts\">\n");
    267269
     
    373375            _out.write("<br><h3 id=\"graphdisplay\">" + _t("Configure Graph Display") + " <a href=\"configstats\">[" + _t("Select Stats") + "]</a></h3>");
    374376            _out.write("<form action=\"graphs\" method=\"POST\">\n" +
    375                        "<table><tr><td><input type=\"hidden\" name=\"action\" value=\"save\">\n" +
     377                       "<table><tr><td><div class=\"optionlist\"><input type=\"hidden\" name=\"action\" value=\"save\">\n" +
    376378                       "<input type=\"hidden\" name=\"nonce\" value=\"" + nonce + "\" >\n");
    377             _out.write(_t("Display period") + ":</td><td colspan=\"2\"><input size=\"5\" style=\"text-align: right;\" type=\"text\" name=\"periodCount\" value=\"" + _periodCount + "\">" + _t("minutes") + "</td></tr><tr><td>\n");
    378             _out.write(_t("Plot type") + ":</td><td colspan=\"2\">");
    379             _out.write("<label><input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"false\" " + (_showEvents ? "" : HelperBase.CHECKED) + ">" + _t("Averages") + "</label>&nbsp;&nbsp;&nbsp;");
    380             _out.write ("<label><input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"true\" "+ (_showEvents ? HelperBase.CHECKED : "") + ">" + _t("Events") + "</label></td></tr><tr><td>\n");
    381             _out.write(_t("Graph size") + ":</td><td><input size=\"4\" style=\"text-align: right;\" type=\"text\" name=\"width\" value=\"" + _width
     379            _out.write("<span class=\"nowrap\" title=\"" +
     380                       _t("Note: Dimensions are for graph only (excludes title, labels and legend).") +"\"><b>");
     381            _out.write(_t("Graph size") + ":</b> <input size=\"4\" style=\"text-align: right;\" type=\"text\" name=\"width\" value=\"" + _width
    382382                       + "\">" + _t("pixels wide") + "&nbsp;&nbsp;&nbsp;<input size=\"4\" style=\"text-align: right;\" type=\"text\" name=\"height\" value=\"" + _height
    383                        + "\">" + _t("pixels high") + "</td><td class=\"infohelp\">" + _t("Note: Dimensions are for graph only (excludes title, labels and legend).") + "</td></tr><tr><td>\n");
    384             _out.write(_t("Hide legend") + ":</td><td colspan=\"2\">");
    385             _out.write("<label><input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"hideLegend\"");
    386             if (_graphHideLegend)
    387                 _out.write(HelperBase.CHECKED);
    388             _out.write(">" + _t("Do not show legend on graphs") + "</label></td></tr><tr><td>\n");
    389             _out.write(_t("Refresh delay") + ":</td><td colspan=\"2\"><select name=\"refreshDelay\">");
     383                       + "\">" + _t("pixels high") + "</span><br><span class=\"nowrap\">\n<b>");
     384
     385            _out.write(_t("Display period") + ":</b> <input size=\"5\" style=\"text-align: right;\" type=\"text\" name=\"periodCount\" value=\"" + _periodCount + "\">" + _t("minutes") + "</span><br><span class=\"nowrap\">\n<b>");
     386
     387
     388            _out.write(_t("Refresh delay") + ":</b> <select name=\"refreshDelay\">");
    390389            for (int i = 0; i < times.length; i++) {
    391390                _out.write("<option value=\"");
     
    401400                _out.write("</option>\n");
    402401            }
    403             _out.write("</select></td></tr><tr><td>\n" + _t("Persistence") +
    404                        ":</td><td colspan=\"2\"><label><input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"persistent\"");
     402            _out.write("</select></span><br><span class=\"nowrap\">\n<b>");
     403
     404            _out.write(_t("Plot type") + ":</b> ");
     405            _out.write("<label><input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"false\" " + (_showEvents ? "" : HelperBase.CHECKED) + ">" + _t("Averages") + "</label>&nbsp;&nbsp;&nbsp;");
     406            _out.write ("<label><input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"true\" "+ (_showEvents ? HelperBase.CHECKED : "") + ">" + _t("Events") + "</label></span><br><span class=\"nowrap\">\n<b>");
     407            _out.write(_t("Hide legend") + ":</b> ");
     408            _out.write("<label><input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"hideLegend\"");
     409            boolean hideLegend = _context.getProperty(PROP_LEGEND, DEFAULT_LEGEND);
     410            if (hideLegend)
     411                _out.write(HelperBase.CHECKED);
     412            _out.write(">" + _t("Do not show legend on graphs") + "</label></span><br><span class=\"nowrap\">\n<b>");
     413            _out.write(_t("Persistence") +
     414                       ":</b> <label><input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"persistent\"");
    405415            boolean persistent = _context.getBooleanPropertyDefaultTrue(SummaryListener.PROP_PERSISTENT);
    406416            if (persistent)
    407417                _out.write(HelperBase.CHECKED);
    408             _out.write(">" + _t("Store graph data on disk") + "</label></td></tr></table>" +
     418            _out.write(">" + _t("Store graph data on disk") + "</label></span></div></td></tr></table>" +
    409419                       "<hr><div class=\"formaction\" id=\"graphing\"><input type=\"submit\" class=\"accept\" value=\"" + _t("Save settings and redraw graphs") + "\"></div></form>");
    410420        } catch (IOException ioe) {
     
    454464            _refreshDelaySeconds != _context.getProperty(PROP_REFRESH, DEFAULT_REFRESH) ||
    455465            _showEvents != _context.getBooleanProperty(PROP_EVENTS) ||
    456             _graphHideLegend != _context.getBooleanProperty(PROP_LEGEND) ||
     466            _graphHideLegend != _context.getProperty(PROP_LEGEND, DEFAULT_LEGEND) ||
    457467            _persistent != _context.getBooleanPropertyDefaultTrue(SummaryListener.PROP_PERSISTENT)) {
    458468            Map<String, String> changes = new HashMap<String, String>();
  • history.txt

    ra715d2b r91977aa  
     12017-11-03 str4d
     2 * Console:
     3   - /graphs:
     4     - Reorganised config form
     5     - Fixed "hide legends" option
     6
    172017-11-02 str4d
    28 * Console:
Note: See TracChangeset for help on using the changeset viewer.