Package io.jenkins.plugins.monitoring
Class MonitoringDefaultAction
- java.lang.Object
- 
- io.jenkins.plugins.monitoring.MonitoringDefaultAction
 
- 
- All Implemented Interfaces:
- Action,- ModelObject,- RunAction2,- org.kohsuke.stapler.StaplerProxy
 
 public class MonitoringDefaultAction extends Object implements RunAction2, org.kohsuke.stapler.StaplerProxy This action displays a link on the side panel of aRun. The action is only displayed if the parent job is a pull request. The action is responsible to render the summary via its associated 'summary.jelly' view and render the main plugin page, where the user can configure the dashboard with all supported plugins via its associated 'index.jelly view.- Author:
- Simon Symhoven
 
- 
- 
Constructor SummaryConstructors Constructor Description MonitoringDefaultAction(Run<?,?> run)Creates a new instance ofMonitoringDefaultAction.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanareJsonNodesEquals(String s1, String s2)Compares to json nodes, if they are equals.static List<? extends MonitorPortlet>getAvailablePortlets(Run<?,?> build)Gets allMonitorPortletfor correspondingMonitorPortletFactory.static List<? extends MonitorPortlet>getAvailablePortletsForFactory(Run<?,?> build, MonitorPortletFactory factory)Gets allMonitorPortletfor oneMonitorPortletFactory.StringgetConfiguration()Get the current dashboard configuration of user.StringgetConfigurationId()Get the project it based on the currentRun.Optional<jenkins.scm.api.metadata.ContributorMetadataAction>getContributorMetadataAction()Get theContributorMetadataActionfor the current build.StringgetDisplayName()static List<? extends MonitorPortletFactory>getFactories()Get all portlet factories, type ofMonitorPortletFactory.StringgetIconFileName()Optional<jenkins.scm.api.metadata.ObjectMetadataAction>getObjectMetadataAction()Get theObjectMetadataActionfor the current build.StringgetPortlets()StringgetPullRequestMetadataBody()Creates the body for the pull request metadata accordion.StringgetPullRequestMetadataTitle()Creates the heading for the pull request metadata accordion.StringgetPullRequestReferenceBuildDescription()Creates the reference build link for the pull request metadata title.Run<?,?>getRun()jenkins.scm.api.mixin.ChangeRequestSCMHead2getScmHead()Get theChangeRequestSCMHead2for a specificRun.ObjectgetTarget()List<String>getUnavailablePortlets()Get all portlets, which are not available anymore.StringgetUrlName()booleanhasChanges()Checks if there are changes in the configuration since the last build.booleanisMonitorConfigurationSynced()Checks if the actual configuration is synced with the default one (Jenkinsfile or empty one).voidonAttached(Run<?,?> build)voidonLoad(Run<?,?> build)voidresetMonitorConfiguration()Reset the current project configuration to default.StringresolvePortlets()Resolves the portlet string of theMonitor.voidupdateMonitorConfiguration(String config)Saves the actual dashboard configuration toMonitorConfigurationProperty.
 
- 
- 
- 
Constructor Detail- 
MonitoringDefaultActionpublic MonitoringDefaultAction(Run<?,?> run) Creates a new instance ofMonitoringDefaultAction.- Parameters:
- run- the run that owns this action.
 
 
- 
 - 
Method Detail- 
getIconFileNamepublic String getIconFileName() - Specified by:
- getIconFileNamein interface- Action
 
 - 
getDisplayNamepublic String getDisplayName() - Specified by:
- getDisplayNamein interface- Action
- Specified by:
- getDisplayNamein interface- ModelObject
 
 - 
getUrlNamepublic String getUrlName() - Specified by:
- getUrlNamein interface- Action
 
 - 
onAttachedpublic void onAttached(Run<?,?> build) - Specified by:
- onAttachedin interface- RunAction2
 
 - 
onLoadpublic void onLoad(Run<?,?> build) - Specified by:
- onLoadin interface- RunAction2
 
 - 
getRunpublic Run<?,?> getRun() 
 - 
getPortletspublic String getPortlets() 
 - 
getObjectMetadataActionpublic Optional<jenkins.scm.api.metadata.ObjectMetadataAction> getObjectMetadataAction() Get theObjectMetadataActionfor the current build.- Returns:
- the ObjectMetadataAction.
 
 - 
getContributorMetadataActionpublic Optional<jenkins.scm.api.metadata.ContributorMetadataAction> getContributorMetadataAction() Get theContributorMetadataActionfor the current build.- Returns:
- the ContributorMetadataAction.
 
 - 
getScmHeadpublic jenkins.scm.api.mixin.ChangeRequestSCMHead2 getScmHead() Get theChangeRequestSCMHead2for a specificRun.- Returns:
- the ChangeRequestSCMHead2of run.
 
 - 
getPullRequestMetadataTitlepublic String getPullRequestMetadataTitle() Creates the heading for the pull request metadata accordion.- Returns:
- the title as html element.
 
 - 
getPullRequestReferenceBuildDescriptionpublic String getPullRequestReferenceBuildDescription() Creates the reference build link for the pull request metadata title.- Returns:
- the reference build as html element.
 
 - 
getPullRequestMetadataBodypublic String getPullRequestMetadataBody() Creates the body for the pull request metadata accordion.- Returns:
- the body as html element.
 
 - 
getConfigurationIdpublic String getConfigurationId() Get the project it based on the currentRun.- Returns:
- the display name of the current project as id.
 
 - 
getUnavailablePortletspublic List<String> getUnavailablePortlets() Get all portlets, which are not available anymore.- Returns:
- a list of all unavailable portlet ids.
 
 - 
hasChangespublic boolean hasChanges() Checks if there are changes in the configuration since the last build.- Returns:
- true if both configurations are equal, else false.
 
 - 
areJsonNodesEqualspublic boolean areJsonNodesEquals(String s1, String s2) Compares to json nodes, if they are equals.- Parameters:
- s1- the first json node as string.
- s2- the second json node as string.
- Returns:
- true, if both are equals, else false.
 
 - 
updateMonitorConfiguration@JavaScriptMethod public void updateMonitorConfiguration(String config) Saves the actual dashboard configuration toMonitorConfigurationProperty.- Parameters:
- config- the config string to update.
 
 - 
getConfiguration@JavaScriptMethod public String getConfiguration() Get the current dashboard configuration of user.- Returns:
- the config of the corresponding MonitorConfigurationPropertyof the actual project or the default configuration of Jenkinsfile if no config exists inMonitorConfigurationPropertyfor actual project.
 
 - 
isMonitorConfigurationSynced@JavaScriptMethod public boolean isMonitorConfigurationSynced() Checks if the actual configuration is synced with the default one (Jenkinsfile or empty one).- Returns:
- true, if synced, else false.
 
 - 
resolvePortlets@JavaScriptMethod public String resolvePortlets() Resolves the portlet string of theMonitor.- Returns:
- the portlet string of MonitoringCustomActionif exists, else the one ofMonitoringDefaultAction.
 
 - 
resetMonitorConfiguration@JavaScriptMethod public void resetMonitorConfiguration() Reset the current project configuration to default.
 - 
getTargetpublic Object getTarget() - Specified by:
- getTargetin interface- org.kohsuke.stapler.StaplerProxy
 
 - 
getAvailablePortletspublic static List<? extends MonitorPortlet> getAvailablePortlets(Run<?,?> build) Gets allMonitorPortletfor correspondingMonitorPortletFactory.- Parameters:
- build- the reference build.
- Returns:
- all available MonitorPortlet.
 
 - 
getFactoriespublic static List<? extends MonitorPortletFactory> getFactories() Get all portlet factories, type ofMonitorPortletFactory.- Returns:
- all factories as list.
 
 - 
getAvailablePortletsForFactorypublic static List<? extends MonitorPortlet> getAvailablePortletsForFactory(Run<?,?> build, MonitorPortletFactory factory) Gets allMonitorPortletfor oneMonitorPortletFactory.- Parameters:
- build- the build to get the portlets for.
- factory- the factory to get the portlets for.
- Returns:
- the filtered portlets.
 
 
- 
 
-