Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-3465

Option for view to display Last Stable/Unstable rather than Last Success/Failure

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • None
    • Platform: All, OS: All

      At the indicated URL we care about stable builds. Unstable builds are little
      better than failed builds. So we want to see when the build was last stable.
      Unstable builds could be counted in the failed column, or have their own column.
      Would like to be able to set this as an option at

      http://deadlock.netbeans.org/hudson/view/Push%20To%20main-silver%20builds/configure

          [JENKINS-3465] Option for view to display Last Stable/Unstable rather than Last Success/Failure

          Jesse Glick added a comment -

          What is the intended future for configurability of ListViewColumn? Currently all
          columns are hardcoded in ListView.defaultColumnDescriptors. While you could add
          another column as an @Extension in a plugin, it would be shown at the end
          (weird) and you could not suppress other columns. Nor could you control which
          views the column would be shown in - it would appear in all.

          What I want: for specific views, to replace LastSuccessColumn and
          LastFailureColumn with (newly added) LastStableColumn and LastUnstableColumn.
          Ideally I guess a ListView would have a nontransient field of type
          DescriptorExtensionList<ListViewColumn, Descriptor<ListViewColumn>>.

          ListViewColumn Javadoc implies a somewhat different plan: "the intention is
          eventually make each ListViewColumn fully configurable like Publisher"

          Jesse Glick added a comment - What is the intended future for configurability of ListViewColumn? Currently all columns are hardcoded in ListView.defaultColumnDescriptors. While you could add another column as an @Extension in a plugin, it would be shown at the end (weird) and you could not suppress other columns. Nor could you control which views the column would be shown in - it would appear in all. What I want: for specific views, to replace LastSuccessColumn and LastFailureColumn with (newly added) LastStableColumn and LastUnstableColumn. Ideally I guess a ListView would have a nontransient field of type DescriptorExtensionList<ListViewColumn, Descriptor<ListViewColumn>>. ListViewColumn Javadoc implies a somewhat different plan: "the intention is eventually make each ListViewColumn fully configurable like Publisher"

          Jesse Glick added a comment -

          Created an attachment (id=671)
          Start of experiment; but ListView is not Savable (why?) so cannot trivially persist displayedColumns

          Jesse Glick added a comment - Created an attachment (id=671) Start of experiment; but ListView is not Savable (why?) so cannot trivially persist displayedColumns

          Jesse Glick added a comment -

          Created an attachment (id=673)
          Working if imperfect patch

          Jesse Glick added a comment - Created an attachment (id=673) Working if imperfect patch

          Jesse Glick added a comment -

          The last-attached patch works - it lets you check or uncheck certain columns in
          a view, and offers Last Stable as a new option (unchecked by default, before
          Last Successful). Things that could be better:

          1. There is no way to configure a column besides showing or hiding it. The
          original Javadoc comment "the intention is eventually make each ListViewColumn
          fully configurable like Publisher" is thus not fully honored. Of course, no
          current column types have anything to configure, but you might wish for them
          to have a config.jelly where you could configure some TBD special options.

          2. You cannot change the order of columns. In particular, columns added by
          plug-ins will always come last.

          3. config.xml stores Java class names when you pick a nondefault set of columns,
          which might be undesirable:

          <columnNames class="tree-set">
          <no-comparator/>
          <string>hudson.views.BuildButtonColumn</string>
          <string>hudson.views.JobColumn</string>
          <string>hudson.views.LastDurationColumn</string>
          <string>hudson.views.LastFailureColumn</string>
          <string>hudson.views.LastStableColumn</string>
          <string>hudson.views.LastSuccessColumn</string>
          <string>hudson.views.StatusColumn</string>
          </columnNames>

          All of these issues could be solved, if desired, by using a DescribableList - I
          think. The 'Saveable owner' could just be null. I am less familiar with how this
          code works so I did not try it yet.

          Jesse Glick added a comment - The last-attached patch works - it lets you check or uncheck certain columns in a view, and offers Last Stable as a new option (unchecked by default, before Last Successful). Things that could be better: 1. There is no way to configure a column besides showing or hiding it. The original Javadoc comment "the intention is eventually make each ListViewColumn fully configurable like Publisher" is thus not fully honored. Of course, no current column types have anything to configure, but you might wish for them to have a config.jelly where you could configure some TBD special options. 2. You cannot change the order of columns. In particular, columns added by plug-ins will always come last. 3. config.xml stores Java class names when you pick a nondefault set of columns, which might be undesirable: <columnNames class="tree-set"> <no-comparator/> <string>hudson.views.BuildButtonColumn</string> <string>hudson.views.JobColumn</string> <string>hudson.views.LastDurationColumn</string> <string>hudson.views.LastFailureColumn</string> <string>hudson.views.LastStableColumn</string> <string>hudson.views.LastSuccessColumn</string> <string>hudson.views.StatusColumn</string> </columnNames> All of these issues could be solved, if desired, by using a DescribableList - I think. The 'Saveable owner' could just be null. I am less familiar with how this code works so I did not try it yet.

          Jesse Glick added a comment -

          DescribableList-based approach under investigation in

          https://hudson.dev.java.net/svn/hudson/branches/configurable-view-columns-3465

          Jesse Glick added a comment - DescribableList-based approach under investigation in https://hudson.dev.java.net/svn/hudson/branches/configurable-view-columns-3465

          Jesse Glick added a comment -

          Created an attachment (id=674)
          Demo usage - adds an option for Last Success column to show # of test failures

          Jesse Glick added a comment - Created an attachment (id=674) Demo usage - adds an option for Last Success column to show # of test failures

          Jesse Glick added a comment -

          Note messiness with newInstance which is called with req==null. Cleaner would
          perhaps be to have a ListViewColumnDescriptor with a dedicated method such as

          public ListViewColumn newAutoInstance() {
          return null;
          }

          and ListView could call this instead of the current

          descriptor.newInstance(null, null)

          which throws NPE unless newInstance is overridden in each descriptor subclass.

          I won't do this for now: (1) would be incompatible for existing ListViewColumn
          impls (would need to change descriptor supertype); (2) the generics would get
          pretty complicated, since ListViewColumn implements Describable<ListViewColumn>
          rather than Describable<T extends ListViewColumn> or something like this; (3)
          the workaround is not hard:

          @Override
          public ListViewColumn newInstance(StaplerRequest _1, JSONObject _2)

          { return new LastSuccessColumn(false); }

          Jesse Glick added a comment - Note messiness with newInstance which is called with req==null. Cleaner would perhaps be to have a ListViewColumnDescriptor with a dedicated method such as public ListViewColumn newAutoInstance() { return null; } and ListView could call this instead of the current descriptor.newInstance(null, null) which throws NPE unless newInstance is overridden in each descriptor subclass. I won't do this for now: (1) would be incompatible for existing ListViewColumn impls (would need to change descriptor supertype); (2) the generics would get pretty complicated, since ListViewColumn implements Describable<ListViewColumn> rather than Describable<T extends ListViewColumn> or something like this; (3) the workaround is not hard: @Override public ListViewColumn newInstance(StaplerRequest _1, JSONObject _2) { return new LastSuccessColumn(false); }

          Code changed in hudson
          User: : jglick
          Path:
          trunk/hudson/main/core/src/main/java/hudson/model/ListView.java
          trunk/hudson/main/core/src/main/java/hudson/views/ListViewColumn.java
          trunk/hudson/main/core/src/main/resources/hudson/model/ListView/configure-entries.jelly
          trunk/hudson/main/core/src/main/resources/lib/form/hetero-list.jelly
          http://fisheye4.cenqua.com/changelog/hudson/?cs=17352
          Log:
          [FIXED JENKINS-3465] Permit configurable column lists in views, and add optional Last Stable column.
          Currently no columns have configurable data, but this can be added if desired (see issue report for demo).
          API changes: type change in ListView.columns and getColumns; ListViewColumn.shownByDefault added.
          [merged https://hudson.dev.java.net/svn/hudson/branches/configurable-view-columns-3465]

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : jglick Path: trunk/hudson/main/core/src/main/java/hudson/model/ListView.java trunk/hudson/main/core/src/main/java/hudson/views/ListViewColumn.java trunk/hudson/main/core/src/main/resources/hudson/model/ListView/configure-entries.jelly trunk/hudson/main/core/src/main/resources/lib/form/hetero-list.jelly http://fisheye4.cenqua.com/changelog/hudson/?cs=17352 Log: [FIXED JENKINS-3465] Permit configurable column lists in views, and add optional Last Stable column. Currently no columns have configurable data, but this can be added if desired (see issue report for demo). API changes: type change in ListView.columns and getColumns; ListViewColumn.shownByDefault added. [merged https://hudson.dev.java.net/svn/hudson/branches/configurable-view-columns-3465]

          Code changed in hudson
          User: : jglick
          Path:
          trunk/www/changelog.html
          http://fisheye4.cenqua.com/changelog/hudson/?cs=17353
          Log:
          JENKINS-3465 Noting.

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : jglick Path: trunk/www/changelog.html http://fisheye4.cenqua.com/changelog/hudson/?cs=17353 Log: JENKINS-3465 Noting.

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: