Package io.jenkins.plugins.echarts
Class AsyncTrendJobAction<T extends io.jenkins.plugins.util.BuildAction<?>>
java.lang.Object
io.jenkins.plugins.util.JobAction<T>
io.jenkins.plugins.echarts.AsyncTrendJobAction<T>
- Type Parameters:
T- type of the results
- All Implemented Interfaces:
Action,ModelObject,AsyncTrendChart
- Direct Known Subclasses:
AsyncConfigurableTrendJobAction
public abstract class AsyncTrendJobAction<T extends io.jenkins.plugins.util.BuildAction<?>>
extends io.jenkins.plugins.util.JobAction<T>
implements AsyncTrendChart
A job action displays a link on the side panel of a job that refers to the last build that contains results (i.e., a
BuildAction with a corresponding result). This action also is responsible to render the historical trend via
its associated 'floatingBox.jelly' view. ECharts will render the trend chart: the model of the chart will be
obtained using an asynchronous Ajax call.- Author:
- Ullrich Hafner
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAsyncTrendJobAction(Job<?, ?> owner, Class<T> buildActionClass) Creates a new instance ofAsyncTrendJobAction. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract edu.hm.hafner.echarts.LinesChartModelCreates the model of the trend chart.Returns the UI model for an ECharts chart that shows the build trend.protected intgetIntegerFromJson(String json, String property, int defaultValue) Returns the text value of the specified JSON property.protected StringgetStringFromJson(String json, String property, String defaultValue) Returns the text value of the specified JSON property.booleanThis default implementation checks whether there are at least two build results available.Methods inherited from class io.jenkins.plugins.util.JobAction
doIndex, getBuildActionClass, getLatestAction, getOwnerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.model.Action
getDisplayName, getIconFileName, getUrlName
-
Constructor Details
-
AsyncTrendJobAction
Creates a new instance ofAsyncTrendJobAction.- Parameters:
owner- the job that owns this actionbuildActionClass- the type of the action to find
-
-
Method Details
-
getBuildTrendModel
Description copied from interface:AsyncTrendChartReturns the UI model for an ECharts chart that shows the build trend. The model has to be a JSON representation of a correspondingLinesChartModelinstance, that will be inserted into the client side model of the corresponding ECharts instance.- Specified by:
getBuildTrendModelin interfaceAsyncTrendChart- Returns:
- the UI model as JSON
- See Also:
-
isTrendVisible
public boolean isTrendVisible()This default implementation checks whether there are at least two build results available. Override if this behavior does not make sense in your job action.- Specified by:
isTrendVisiblein interfaceAsyncTrendChart- Returns:
trueif there are at least two results,falseotherwise
-
createChartModel
protected abstract edu.hm.hafner.echarts.LinesChartModel createChartModel()Creates the model of the trend chart. The returned model will be converted to JSON and inserted into the client side model of the corresponding ECharts instance.- Returns:
- the model of the trend chart
- See Also:
-
createBuildHistory
-
getStringFromJson
Returns the text value of the specified JSON property.- Parameters:
json- the JSON object to extract the property value fromproperty- the name of the propertydefaultValue- the default value if the property is undefined or invalid- Returns:
- the value of the property
-
getIntegerFromJson
Returns the text value of the specified JSON property.- Parameters:
json- the JSON object to extract the property value fromproperty- the name of the propertydefaultValue- the default value if the property is undefined or invalid- Returns:
- the value of the property
-