From 138145d3af778338391a72b7d3c46e21fbc77819 Mon Sep 17 00:00:00 2001 From: Jan Faracik <43062514+janfaracik@users.noreply.github.com> Date: Fri, 17 Oct 2025 11:19:07 +0100 Subject: [PATCH 01/12] Adjust for experimental Run UI --- pom.xml | 6 +- .../tasks/test/AbstractTestResultAction.java | 20 ++- .../hudson/tasks/junit/CaseResult/index.jelly | 8 +- .../AbstractTestResultAction/action.jelly | 33 +++++ .../AbstractTestResultAction/summary.jelly | 77 +++++------ .../AbstractTestResultAction/widget.jelly | 62 +++++++++ .../hudson/tasks/test/TestResult/index.jelly | 129 +++++++++--------- .../hudson/test/edit-description-button.jelly | 40 ------ 8 files changed, 226 insertions(+), 149 deletions(-) create mode 100644 src/main/resources/hudson/tasks/test/AbstractTestResultAction/action.jelly create mode 100644 src/main/resources/hudson/tasks/test/AbstractTestResultAction/widget.jelly delete mode 100644 src/main/resources/lib/hudson/test/edit-description-button.jelly diff --git a/pom.xml b/pom.xml index 5cfb388e3..ad4766361 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.jenkins-ci.plugins plugin - 5.27 + 5.26 @@ -32,8 +32,8 @@ 999999-SNAPSHOT jenkinsci/${project.artifactId}-plugin - 2.504 - ${jenkins.baseline}.3 + 2.516 + 2.532 false false false diff --git a/src/main/java/hudson/tasks/test/AbstractTestResultAction.java b/src/main/java/hudson/tasks/test/AbstractTestResultAction.java index 34207eb53..e2c21ee67 100644 --- a/src/main/java/hudson/tasks/test/AbstractTestResultAction.java +++ b/src/main/java/hudson/tasks/test/AbstractTestResultAction.java @@ -51,7 +51,9 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import java.util.logging.Logger; +import jenkins.management.Badge; import jenkins.model.RunAction2; +import jenkins.model.Tab; import jenkins.model.lazy.LazyBuildMixIn; import org.jfree.chart.ChartFactory; import org.jfree.chart.JFreeChart; @@ -81,7 +83,7 @@ * @author Kohsuke Kawaguchi */ @ExportedBean -public abstract class AbstractTestResultAction +public abstract class AbstractTestResultAction extends Tab implements HealthReportingAction, RunAction2 { private static final Logger LOGGER = Logger.getLogger(AbstractTestResultAction.class.getName()); @@ -99,7 +101,9 @@ public abstract class AbstractTestResultAction descriptions = new ConcurrentHashMap<>(); /** @since 1.545 */ - protected AbstractTestResultAction() {} + protected AbstractTestResultAction() { + super(null); + } /** * @deprecated Use the default constructor and just call {@link Run#addAction} to associate the build with the action. @@ -107,6 +111,7 @@ protected AbstractTestResultAction() {} */ @Deprecated protected AbstractTestResultAction(Run owner) { + super(owner); onAttached(owner); } @@ -117,12 +122,14 @@ protected AbstractTestResultAction(AbstractBuild owner) { @Override public void onAttached(Run r) { + this.object = r; this.run = r; this.owner = r instanceof AbstractBuild ? (AbstractBuild) r : null; } @Override public void onLoad(Run r) { + this.object = r; this.run = r; this.owner = r instanceof AbstractBuild ? (AbstractBuild) r : null; } @@ -180,6 +187,15 @@ public String getIconFileName() { return "symbol-flask-outline plugin-ionicons-api"; } + @Override + public Badge getBadge() { + if (getFailCount() == 0) { + return null; + } + + return new Badge(String.valueOf(getFailCount()), getFailCount() + " test failure", Badge.Severity.DANGER); + } + @Override public HealthReport getBuildHealth() { final double scaleFactor = getHealthScaleFactor(); diff --git a/src/main/resources/hudson/tasks/junit/CaseResult/index.jelly b/src/main/resources/hudson/tasks/junit/CaseResult/index.jelly index 8b625b9fa..408598d61 100644 --- a/src/main/resources/hudson/tasks/junit/CaseResult/index.jelly +++ b/src/main/resources/hudson/tasks/junit/CaseResult/index.jelly @@ -83,8 +83,10 @@ THE SOFTWARE. - diff --git a/src/main/resources/hudson/tasks/test/AbstractTestResultAction/action.jelly b/src/main/resources/hudson/tasks/test/AbstractTestResultAction/action.jelly new file mode 100644 index 000000000..d37d42d8a --- /dev/null +++ b/src/main/resources/hudson/tasks/test/AbstractTestResultAction/action.jelly @@ -0,0 +1,33 @@ + + + + + + + + + + + diff --git a/src/main/resources/hudson/tasks/test/AbstractTestResultAction/summary.jelly b/src/main/resources/hudson/tasks/test/AbstractTestResultAction/summary.jelly index f764c9d0b..2c9b50259 100644 --- a/src/main/resources/hudson/tasks/test/AbstractTestResultAction/summary.jelly +++ b/src/main/resources/hudson/tasks/test/AbstractTestResultAction/summary.jelly @@ -25,48 +25,49 @@ THE SOFTWARE. + - - - ${it.displayName} - - + + + ${it.displayName} + + - - - - -
    - - - - - + + + + +
      + + + + + - - - - - - + + + + + + -
    • - - - - - -
    • -
      -
    +
  • + + + + + +
  • +
    +
- - - - ${%Show all failed tests} ${">>>"} + + + + ${%Show all failed tests} ${">>>"} + -
- -
+
+
diff --git a/src/main/resources/hudson/tasks/test/AbstractTestResultAction/widget.jelly b/src/main/resources/hudson/tasks/test/AbstractTestResultAction/widget.jelly new file mode 100644 index 000000000..cedd58980 --- /dev/null +++ b/src/main/resources/hudson/tasks/test/AbstractTestResultAction/widget.jelly @@ -0,0 +1,62 @@ + + + + + + +
+ + +
Some failures
+ +
+ ${it.failCount} failed, ${it.skipCount} skipped, ${it.totalCount} ran +
+ +
+ Took ${it.durationString} +
+
+
+ + +
+ + +
All tests are passing!
+ +
+ ${it.skipCount} skipped, ${it.totalCount} passed +
+ +
+ Took ${it.durationString} +
+
+
+
+
diff --git a/src/main/resources/hudson/tasks/test/TestResult/index.jelly b/src/main/resources/hudson/tasks/test/TestResult/index.jelly index b04109fa0..9fb90d867 100644 --- a/src/main/resources/hudson/tasks/test/TestResult/index.jelly +++ b/src/main/resources/hudson/tasks/test/TestResult/index.jelly @@ -24,82 +24,85 @@ THE SOFTWARE. - - + + - - + + - - - - + - + + + + - -