Issue Details (XML | Word | Printable)

Key: MPDASHBOARD-3
Type: Wish Wish
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Vincent Massol
Reporter: Sean Timm
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Maven 1.x Dashboard Plugin

Provide percentage bar graph

Created: 18/Nov/03 11:43 AM   Updated: 28/Sep/04 04:47 AM   Resolved: 28/Sep/04 04:47 AM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: 1.5

Time Tracking:
Not Specified

File Attachments: 1. File dashboard.jsl (5 kB)
2. File dashboard.jsl (4 kB)
3. Text File dashboard.jsl.patch (3 kB)
4. Text File dashboard.patch (11 kB)
5. Text File dashboard2.patch (10 kB)
6. Text File mpdashboard-3-patch-vma (7 kB)

Image Attachments:

1. green.png
(0.2 kB)

2. red.png
(0.2 kB)

3. screenshot-1.jpg
(185 kB)

4. screenshot-1.jpg
(185 kB)

5. trans.gif
(0.0 kB)


 Description  « Hide

For percentage-based values, provide the ability to show a bar graph rather than the number itself. Allow configuration of low, medium, and high values to show bar as either red, yellow, or green.



Vincent Massol added a comment - 18/Nov/03 02:43 PM

Cool. Got a patch?


Carlos Sanchez added a comment - 08/Aug/04 04:22 PM

This is from clover reports, uses width in a scale 0-200, so a 50% will be width="100"

<TABLE class="barGraph" cellspacing="0">
<TBODY>
<TR>
<TD class="covered">
<!-- 35.5% covered -->
<img alt="coverage" src="img/trans.gif" width="71" height="12">
</TD>
<TD class="uncovered">
<!-- 64.5% uncovered -->
<img alt="coverage" src="img/trans.gif" width="129" height="12">
</TD>
</TR>
</TBODY>
</TABLE>

The styles are
<!-- red color -->
TD.covered {
FONT-SIZE: 2px; BACKGROUND: #00df00; BORDER-LEFT:#9c9c9c 1px solid;BORDER-TOP:#9c9c9c 1px solid;BORDER-BOTTOM:#9c9c9c 1px solid;
}
<!-- green color -->
TD.uncovered {
FONT-SIZE: 2px; BACKGROUND: #df0000; BORDER:#9c9c9c 1px solid;
}

The image is available here
http://oness.sourceforge.net/multiproject/oness-common-model/clover/img/trans.gif


Nascif A. Abousalh-Neto added a comment - 22/Sep/04 08:30 PM

This modified version of the .jsl will detect if the value provided by an aggregator ends in the character '%'. If that is the case it will generate a progress bar using a technique similar to the one described in a previous comment.

The generation relies on the following new properties:
maven.dashboard.report.bar.left=images/green.png
maven.dashboard.report.bar.right=images/red.png
maven.dashboard.report.bar.height=10
maven.dashboard.report.bar.border=0

It works for both JUnit pass rate and JCoverage; only problem I was not able to solve so far was the spacing (padding?) between the left and right images (see screenshot). I believe it is introduced by the Maven CSS.

Any idea on how to eliminate it?


Nascif A. Abousalh-Neto added a comment - 22/Sep/04 08:32 PM

See how there is a space between the left and right halves of the progress bar...


Nascif A. Abousalh-Neto added a comment - 22/Sep/04 08:33 PM

See how there is a space between the left and right halves of the progress bar...


Nascif A. Abousalh-Neto added a comment - 22/Sep/04 08:35 PM

image used for right side of progress bar.


Nascif A. Abousalh-Neto added a comment - 22/Sep/04 08:35 PM

image used for green side of progress bar.


Nascif A. Abousalh-Neto added a comment - 23/Sep/04 01:00 AM

This version uses the "clover technique" of using a transparent gif ply cell background colors. It also breaks the bar graph to a second row, to prevent a visually annoying effect when the bar was full (100 or 0 percent), in which case the bar uses only one cell instead of two.


Vincent Massol added a comment - 23/Sep/04 04:56 AM

Hi Sean,

Thanks for the patch. I've tried to apply it and I have a few issues:

1/ It's not in patch format which means I have a lot of work to do to apply it and I may not be doing the right thing. Please find attached as a CVS patch (the format that you need to provide) what I have understood of your patch.

2/ It's not working. Running "maven plugin:test" in the dashboard plugin fails.

3/ I don't get the PNG images displayed in the master report. I got some weird images appearing in blue. I'm using IE. Please try it with IE as it has to work with IE.

Thanks


Vincent Massol added a comment - 23/Sep/04 05:04 AM

Transformed in a proper CVS patch


Nascif A. Abousalh-Neto added a comment - 23/Sep/04 10:45 AM

> Hi Sean,
It is Nascif, actually.

> Thanks for the patch. I've tried to apply it and I have a few issues:
>
> 1/ It's not in patch format which means I have a lot of work to do
> apply it and I may not be doing the right thing. Please find
> attached as a CVS patch (the format that you need to provide) what I
> have understood of your patch.
Sorry about that. I created it from the latest CVS version, so I was hoping it wouldn't be a problem. I am attaching a patch created on my system.

> 2/ It's not working. Running "maven plugin:test" in the dashboard
> plugin fails.
Maybe it was the patch transformation/application... did you try to just replace the file with the one I sent? Can you send me the error messages?

> 3/ I don't get the PNG images displayed in the master report. I got
> some weird images appearing in blue. I'm using IE. Please try it
> with IE as it has to work with IE.
Works on my machine (the old excuse) on Opera, IE and Firefox.
Where are you copying the images to? Maybe the are not on the proper directory. They have to go inside the <maven_site>/images directory in the web server.

> Thanks
My pleasure,
Nascif


Nascif A. Abousalh-Neto added a comment - 23/Sep/04 10:46 AM

CVS diff for latest version of dashboard.jsl


Vincent Massol added a comment - 23/Sep/04 11:11 AM

Hi Nascif (sorry for mistaking you for Sean ),

1/ I have already attached the patch. Could you please apply it on your machine on a clean checkout and verify you can run "maven plugin:test"?

2/ Your patch is still not valid. It is missing several files (see the patch I have attached which contains everything)

3/ I have spent some time fixing the errors in indentation you have introduced in the dashboard.jsl file (see my patch)...

We'll get there!


Nascif A. Abousalh-Neto added a comment - 23/Sep/04 11:42 AM

Hi Vincent,

I found a problem with the patch; the second version I posted uses slightly different variables. Here they are (for plugin.properties):

  1. images used when generating the progress bar for the dashboard
  2. HTML color for left bar
    maven.dashboard.report.bar.left=green
  3. HTML color for right bar
    maven.dashboard.report.bar.right=red
  4. image to set cells with (should be transparent)
    maven.dashboard.report.bar.image=images/trans.gif
    maven.dashboard.report.bar.height=10
    maven.dashboard.report.bar.border=0
    maven.dashboard.report.bar.displayLabel=true

Please make a new patch and I will give it a try. But if plugin.install is failing, there is something else wrong, probably with the .jsl syntax. I will create a new checkout later and take a look.

Also, what is the best approach for adding an image to the plugin, and have it be copied to the maven images file?


Vincent Massol added a comment - 23/Sep/04 01:46 PM

> I found a problem with the patch; the second version I posted uses > slightly different variables. Here they are (for
> plugin.properties):

Please add those to your patch of course.

> Please make a new patch and I will give it a try.

Er? You're the one providing a patch, right?

> Also, what is the best approach for adding an image to the plugin,
> and have it be copied to the maven images file?

I've implemented that in the patch I've attached earlier on.

Let me know when you have a fully working patch that includes everything.

Thanks


Nascif A. Abousalh-Neto added a comment - 24/Sep/04 04:28 PM

Patch for progress bar feature (created with "cvs diff -u");
also has changes for new plugin for FindBugs, see MPDASHBOARD-13 for attachments.


Nascif A. Abousalh-Neto added a comment - 24/Sep/04 04:29 PM

transparent .gif used in the creation of percentage bar charts.


Vincent Massol added a comment - 25/Sep/04 07:13 AM

Thanks again for the patch.

Here's the outcome for me:

1/ A few minor things I've had to modify:

  • the properties were not placed in the right location in the plugin.properties file. You had place them in the single project properties whereas they are used for the main dashboard
  • I think you're mimssing ${plugin.resources} for the maven.dashboard.report.bar.image property

2/ The report works and has the nice progress bar! Cool

3/ The dashboard tests do NOT pass. Could you please always ensure you run the tests before submitting the patch? Do you think you could have a look and either fix the tests or fix the code (whichever is wrong)? The tests are run by typing "maven plugin:test" in the dashboard directory.

We need to have 3 before I can commit the code.

Thanks again (we're almost there!)


Nascif A. Abousalh-Neto added a comment - 25/Sep/04 02:05 PM

Sorry about the tests. I will check them next week and provide a new patch. I was not aware of the resource property as well.

Glad you liked the progress bar. I am not 100% happy with it though, notice the small line (1-2 pixels wide) between the left and right blocks; I would like to get rid of it entirely, which is possible if you are generating plain HTML. But with all the layers (JSL -> XML -XDOC -> CSS -> HTML) between the aggregator and the final report, I was not able to. I spent quite some time trying but was not able to get it the way I wanted...

Maybe a new image CSS class would do the trick - the default CSS for maven adds a border to all images.

Regards,
Nascif


Nascif A. Abousalh-Neto added a comment - 27/Sep/04 12:02 PM

Hi Vicent,

> / A few minor things I've had to modify:
> - the properties were not placed in the right location in the
> lugin.properties file. You had place them in the single project properties
> hereas they are used for the main dashboard
> - I think you're mimssing ${plugin.resources} for the maven.
> dashboard.report.bar.image property

I was not able to find any documentation on that property, sorry.
I even checked the source code of other plugins but was not able to find anything. Could you point me to some documentation on how to use this property, or show me how it can be used?

> 2/ The report works and has the nice progress bar! Cool
Glad to know it is working!

> 3/ The dashboard tests do NOT pass. Could you please always ensure you run the
> tests before submitting the patch? Do you think you could have a look and either
> fix the tests or fix the code (whichever is wrong)? The tests are run by typing
> "maven plugin:test" in the dashboard directory.

> We need to have 3 before I can commit the code.
I got the tests to run; the core problem was with the way the XML structure was validate, by counting the number of table/tr nodes; the new tables introduced by the progress bar got it to fail. I just had to make the test more strict and it worked again.

I had make those other changes though, which I believe are on your side:

  • comment a checkstyle license dependency to a directory four levels up; it will only work for someone checking out the entire maven plugins branch. It fails for someone checking out (like I did) just the dashboard plugin.
  • add LICENSE.txt dummy files to the subproject[1-3] directories.

Please note the dependency on the FindBugs aggregator files; I know I should not add this cross-feature dependency but I couldn't help it I have already an idea for another aggregator, for JDepend.

Regards,
Nascif


Nascif A. Abousalh-Neto added a comment - 27/Sep/04 12:03 PM

New patch to fix unit tests.


Vincent Massol added a comment - 28/Sep/04 04:47 AM

Applied! Thanks a lot

> I had make those other changes though, which I believe are on your
> side:
> * comment a checkstyle license dependency to a directory four [...]
> * add LICENSE.txt dummy files to the subproject[1-3] directories. [...]

No, this is correct. The plugin depends on global files located in maven-plugins/ and in maven-plugins/plugin-parent. You need to check these out.