Class TrendModel

java.lang.Object
io.jenkins.plugins.analysis.core.model.TrendModel
All Implemented Interfaces:
ModelObject

public class TrendModel extends Object implements ModelObject
Server side model that provides the data for the "Trend" page of the Warnings tab of a run. The page answers the question: "How did the number of warnings evolve in the builds up to this build?". It shows a trend chart for one of the results of the run or for all results together. The history ends with the run that owns this page, so older builds show the trend up to that build (and not up to the latest build of the job).

The following settings can be changed on the client side in the app bar, see trend-model.js:

  • the trend source: all tools (only if the run has more than one result) or a single tool
  • the chart type: issues by severity, issues and health, new and fixed issues, or issues per tool. Not all chart types are available for each source, see TrendModel.TrendSource.getChartTypes().
  • the number of builds to show

The chart models are created by the existing trend charts of the package io.jenkins.plugins.analysis.core.charts, which are also used on the job page. The history of a single tool is provided by ResultAction.createBuildHistory(), the history of all tools by CompositeBuildResultsIterable, which sums up the results of all tools of a build.

Author:
Ullrich Hafner
  • Method Details

    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in interface ModelObject
    • getUrlName

      public String getUrlName()
      Returns the URL of this page, relative to the Warnings tab.
      Returns:
      the URL name
    • getObject

      public Actionable getObject()
      Returns the run that owns the results. Required by l:run-subpage.
      Returns:
      the run
    • getTab

      public RunTab getTab()
      Returns the Warnings tab of the run. Used to render the app bar and the side panel.
      Returns:
      the tab
    • getSources

      public List<TrendModel.TrendSource> getSources()
      Returns the sources that can be selected for the trend chart. If the run has more than one result, the first source combines all tools. Then a source for each tool follows.
      Returns:
      the trend sources, never empty
    • getChartTypes

      public List<TrendModel.ChartType> getChartTypes()
      Returns all chart types. Which of them are available for a given source is determined on the client side using TrendModel.TrendSource.getChartIds().
      Returns:
      all chart types
    • getTrendChart

      @JavaScriptMethod public String getTrendChart(String configuration)
      Returns the trend chart for the specified configuration. The configuration is a JSON object with the properties tool (the ID of the TrendModel.TrendSource), chart (the ID of the TrendModel.ChartType), and numberOfBuilds. Unknown or missing values are replaced by defaults: the first source, the default chart type of the source, and 50 builds.
      Parameters:
      configuration - JSON object to configure the trend chart
      Returns:
      the trend chart model (converted to a JSON string)