code-coverage-api-plugin icon indicating copy to clipboard operation
code-coverage-api-plugin copied to clipboard

Show trend chart on details view only if there are at least 2 builds

Open uhafner opened this issue 4 years ago • 4 comments

UI improvement for https://github.com/jenkinsci/code-coverage-api-plugin/pull/203

Bildschirmfoto 2021-09-23 um 22 20 04

uhafner avatar Sep 23 '21 13:09 uhafner

Hello @uhafner Can you guide me on how to approach this issue?

Amanjain4269 avatar Oct 23 '23 07:10 Amanjain4269

There needs to be an if guard around https://github.com/jenkinsci/coverage-plugin/blob/ee3e8c2926bef8c4efd3da68445795d38dd6b6e1/plugin/src/main/resources/io/jenkins/plugins/coverage/metrics/steps/CoverageViewModel/index.jelly#L56.

In the CoverageViewModel an associated boolean method needs to be added if not already there. (On the action we have it already.)

Please note that I am currently moving the code of this plugin to https://github.com/jenkinsci/coverage-plugin. So the PR needs to go on that plugin. The code-coverage-api plugin will be end-of-life soon. All code has been moved to https://github.com/jenkinsci/coverage-plugin.

uhafner avatar Oct 23 '23 10:10 uhafner

There needs to be an if guard around https://github.com/jenkinsci/coverage-plugin/blob/ee3e8c2926bef8c4efd3da68445795d38dd6b6e1/plugin/src/main/resources/io/jenkins/plugins/coverage/metrics/steps/CoverageViewModel/index.jelly#L56.

In the CoverageViewModel an associated boolean method needs to be added if not already there.

Thanks, I understood the approach of checking the value of no. of builds (at least 2) by adding a boolean method in the CoverageViewModel.java file and showing the trend chart as per the output (true/false).

(On the action we have it already.)

Sorry, but I didn't get you here. Is this kind of method already implemented?

Please note that I am currently moving the code of this plugin to https://github.com/jenkinsci/coverage-plugin. So the PR needs to go on that plugin. The code-coverage-api plugin will be end-of-life soon. All code has been moved to https://github.com/jenkinsci/coverage-plugin.

Ohk...Thanks for the update.

Amanjain4269 avatar Oct 23 '23 21:10 Amanjain4269

There needs to be an if guard around https://github.com/jenkinsci/coverage-plugin/blob/ee3e8c2926bef8c4efd3da68445795d38dd6b6e1/plugin/src/main/resources/io/jenkins/plugins/coverage/metrics/steps/CoverageViewModel/index.jelly#L56. In the CoverageViewModel an associated boolean method needs to be added if not already there.

Thanks, I understood the approach of checking the value of no. of builds (at least 2) by adding a boolean method in the CoverageViewModel.java file and showing the trend chart as per the output (true/false).

(On the action we have it already.)

Sorry, but I didn't get you here. Is this kind of method already implemented?

The CoverageAction (that creates the CoverageViewModel) has a CoverageProjectAction with the method isTrendVisible(). This value needs to be used as a property for view model. It would make sense to use a new enum {DRAW_TREND, HIDE_TREND} in the constructor of the CoverageViewModel.

Please note that I am currently moving the code of this plugin to https://github.com/jenkinsci/coverage-plugin. So the PR needs to go on that plugin. The code-coverage-api plugin will be end-of-life soon. All code has been moved to https://github.com/jenkinsci/coverage-plugin.

Ohk...Thanks for the update.

uhafner avatar Oct 24 '23 09:10 uhafner