Skip to content

Commit dcc72a4

Browse files
Marc van Kalmthouthypery2k
authored andcommitted
LogParserAction now handles showGraphs as it implements SimpleBuildStep.LastBuildAction
Signed-off-by: Martin Reinhardt <[email protected]>
1 parent f517f9c commit dcc72a4

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

src/main/java/hudson/plugins/logparser/LogParserAction.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,28 @@ public class LogParserAction implements Action, SimpleBuildStep.LastBuildAction
4242

4343
final private Run<?, ?> build;
4444
final private LogParserResult result;
45+
final private boolean showGraphs;
4546

4647
private static String urlName = "parsed_console";
4748

4849
@Deprecated
49-
public LogParserAction(final AbstractBuild<?, ?> build, final LogParserResult result) {
50-
this((Run<?, ?>) build, result);
50+
public LogParserAction(final AbstractBuild<?, ?> build, final LogParserResult result, final boolean showGraphs) {
51+
this((Run<?, ?>) build, result, showGraphs);
5152
}
5253

53-
public LogParserAction(final Run<?, ?> build, final LogParserResult result) {
54+
public LogParserAction(final Run<?, ?> build, final LogParserResult result, final boolean showGraphs) {
5455
this.build = build;
5556
this.result = result;
57+
this.showGraphs = showGraphs;
5658
}
5759

5860
public Collection<? extends Action> getProjectActions() {
59-
final Job<?, ?> job = build.getParent();
60-
return Collections.singleton(new LogParserProjectAction(job));
61+
if (showGraphs) {
62+
final Job<?, ?> job = build.getParent();
63+
return Collections.singleton(new LogParserProjectAction(job));
64+
} else {
65+
return Collections.emptyList();
66+
}
6167
}
6268

6369
@Override

src/main/java/hudson/plugins/logparser/LogParserPublisher.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public void perform(Run<?, ?> build, FilePath workspace, Launcher launcher, Task
110110
logger.log(Level.SEVERE, LogParserConsts.CANNOT_PARSE + build, NULL_PARSING_RULES);
111111
result.setFailedToParseError(NULL_PARSING_RULES);
112112
build.setResult(Result.ABORTED);
113-
build.addAction(new LogParserAction(build, result));
113+
build.addAction(new LogParserAction(build, result, showGraphs));
114114
return;
115115
} else {
116116
parsingRulesFile = new FilePath(new File(parsingRulesPath));
@@ -139,7 +139,7 @@ public void perform(Run<?, ?> build, FilePath workspace, Launcher launcher, Task
139139
}
140140

141141
// Add an action created with the above results
142-
final LogParserAction action = new LogParserAction(build, result);
142+
final LogParserAction action = new LogParserAction(build, result, showGraphs);
143143
build.addAction(action);
144144
}
145145

0 commit comments

Comments
 (0)