Skip to content

Commit

Permalink
UX improvements: "show only this" link, more compact/usable list of r…
Browse files Browse the repository at this point in the history
…esults
  • Loading branch information
szalapski authored and hypery2k committed Jun 26, 2019
1 parent 3cf8911 commit aedc348
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
18 changes: 14 additions & 4 deletions src/main/java/hudson/plugins/logparser/LogParserParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ public LogParserResult parseLog(final Run<?, ?> build) throws IOException, Inter
// this header
headerForSection.add(shortLink);
writer.write(LogParserConsts.getHtmlOpeningTags());

// write styles for log body
final String styles = "<style>\n"
+ " body {margin-left:.5em; }\n"
+ " pre {font-family: Consolas, \"Courier New\"; word-wrap: break-word; }\n"
+ " pre span {word-wrap: break-word; } \n"
+ "</style>\n";
writer.write(styles);

if (this.preformattedHtml)
writer.write("<pre>");
// Read bulks of lines, parse
Expand Down Expand Up @@ -241,9 +250,10 @@ public void incrementCounterPerSection(final String status,
}

private String colorLine(final String line, final String status) {
final String color = (String) displayConstants.getColorTable().get(
status);
final StringBuffer result = new StringBuffer("<span style=\"color:");
final String color = (String) displayConstants.getColorTable().get(status);
final StringBuffer result = new StringBuffer("<span class=\"");
result.append(status.toLowerCase());
result.append("\" style=\"color:");
result.append(color);
result.append("\">");
result.append(line);
Expand All @@ -270,7 +280,7 @@ private String addMarkerAndLink(final String line,
final StringBuffer link = new StringBuffer("<li>");
link.append(statusCountStr);
link.append(shortLink);
link.append("</li><br/>");
link.append("</li>");

final BufferedWriter linkWriter = (BufferedWriter) writers
.get(effectiveStatus);
Expand Down
20 changes: 15 additions & 5 deletions src/main/java/hudson/plugins/logparser/LogParserWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,24 @@ private static void writeLinks(final BufferedWriter writer,
.toString();

final String hudsonRoot = Hudson.getInstance().getRootUrl();
final String iconLocation = String.format("%s/images/16x16/",
Functions.getResourcePath());
final String iconLocation = String.format("%s/images/16x16/", Functions.getResourcePath());

final String styles =
"<style>\n"
+ " ul {margin-left: 0; padding-left: 1em;}\n"
+ " ul li {font-size: small; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; margin-top: .5em; }\n"
+ " ul li:hover {white-space: normal;}\n"
+ " ul li a:link {text-decoration: none;}\n"
+ " ul li:hover a:link {text-decoration: underline;}\n"
+ "</style>\n";
writer.write(styles);

final String linksStart = "<img src=\"" + hudsonRoot + "/" + iconLocation + statusIcon
+ "\" style=\"margin: 2px;\" width=\"24\" alt=\"" + linkListDisplayStr + " Icon\" height=\"24\" />\n"
+ "<a href=\"javascript:toggleList('" + linkListDisplayStr + "')\" target=\"_self\"><STRONG>"
+ linkListDisplayStr + " (" + linkListCount + ")</STRONG></a><br />\n" + "<ul id=\""
+ linkListDisplayStr + "\" style=\"display:none; margin-left:0; padding-left:3em\">\n";

+ linkListDisplayStr + " (" + linkListCount + ")</STRONG></a><br />\n"
+ "<ul style=\"display: none;\" id=\""
+ linkListDisplayStr + "\" >\n";
writer.write(linksStart);

// Read the links file and insert here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<tr>
<td width="100%">
<h2>Console Output (parsed)</h2>
<a href="${it.result.parsedLogURL}">Show only this</a>
<iframe src="${it.result.parsedLogURL}" width="100%" height="600" scrolling="auto" frameborder="0"/>
</td>
</tr>
Expand Down

0 comments on commit aedc348

Please sign in to comment.