Skip to content

Commit

Permalink
report visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
sultan committed Oct 16, 2022
1 parent cc7ba5b commit f5231de
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ protected void renderOverview()
*/
protected <Q extends OverviewStats> void renderOverviewTableRow( Q stats )
{
renderStatRow( "report.overview.numUpToDate", stats.getUpToDate() );
renderStatRow( "report.overview.numNewerVersionAvailable", stats.getAny() );
renderStatRow( "report.overview.numNewerIncrementalAvailable", stats.getIncremental() );
renderStatRow( "report.overview.numNewerMinorAvailable", stats.getMinor() );
renderStatRow( "report.overview.numNewerMajorAvailable", stats.getMajor() );
renderStatRow( "report.overview.numUpToDate", stats.getUpToDate(), true );
renderStatRow( "report.overview.numNewerVersionAvailable", stats.getAny(), false );
renderStatRow( "report.overview.numNewerIncrementalAvailable", stats.getIncremental(), false );
renderStatRow( "report.overview.numNewerMinorAvailable", stats.getMinor(), false );
renderStatRow( "report.overview.numNewerMajorAvailable", stats.getMajor(), false );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import org.codehaus.mojo.versions.reporting.model.DependencyUpdatesModel;
import org.codehaus.plexus.i18n.I18N;

import static java.util.Optional.empty;

/**
* @param <K> type of the model
* @since 1.0-beta-1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected void renderSummaryTable( Map<Dependency, PluginUpdatesDetails> content
@Override
protected PluginOverviewStats computeOverviewStats()
{
return PluginOverviewStats.fromUpdates( model.getAllUpdates().values(), oldestUpdateCache );
return PluginOverviewStats.fromUpdates( model.getAllUpdates().values(), newestUpdateCache );
}

@Override
Expand All @@ -144,7 +144,7 @@ protected <T extends OverviewStats> void renderOverviewTableRow( T stats )
{
super.renderOverviewTableRow( stats );
super.renderStatRow( "report.overview.numNewerDependenciesAvailable",
( (PluginOverviewStats) stats ).getDependencies() );
( (PluginOverviewStats) stats ).getDependencies(), false );
}

protected void renderSummaryTableRow( Dependency artifact, PluginUpdatesDetails details )
Expand Down Expand Up @@ -268,9 +268,9 @@ private void renderPluginDetail( Dependency artifact, PluginUpdatesDetails detai
sink.section2_();
}

private void renderPluginDetailTable( PluginUpdatesDetails plugin )
private void renderPluginDetailTable( PluginUpdatesDetails details )
{
ArtifactVersion[] allUpdates = plugin.getAllUpdates( empty() );
ArtifactVersion[] allUpdates = details.getAllUpdates( empty() );
boolean upToDate = allUpdates == null || allUpdates.length == 0;

final SinkEventAttributes headerAttributes = new SinkEventAttributeSet();
Expand All @@ -284,25 +284,25 @@ private void renderPluginDetailTable( PluginUpdatesDetails plugin )
sink.text( getText( "report.status" ) );
sink.tableHeaderCell_();
sink.tableCell( cellAttributes );
if ( plugin.getNewestUpdate( of( SUBINCREMENTAL ) ) != null )
if ( details.getNewestUpdate( of( SUBINCREMENTAL ) ) != null )
{
renderWarningIcon();
sink.nonBreakingSpace();
sink.text( getText( "report.otherUpdatesAvailable" ) );
}
else if ( plugin.getNewestUpdate( of( INCREMENTAL ) ) != null )
else if ( details.getNewestUpdate( of( INCREMENTAL ) ) != null )
{
renderWarningIcon();
sink.nonBreakingSpace();
sink.text( getText( "report.incrementalUpdatesAvailable" ) );
}
else if ( plugin.getNewestUpdate( of( MINOR ) ) != null )
else if ( details.getNewestUpdate( of( MINOR ) ) != null )
{
renderWarningIcon();
sink.nonBreakingSpace();
sink.text( getText( "report.minorUpdatesAvailable" ) );
}
else if ( plugin.getNewestUpdate( of( MAJOR ) ) != null )
else if ( details.getNewestUpdate( of( MAJOR ) ) != null )
{
renderWarningIcon();
sink.nonBreakingSpace();
Expand All @@ -321,23 +321,23 @@ else if ( plugin.getNewestUpdate( of( MAJOR ) ) != null )
sink.text( getText( "report.groupId" ) );
sink.tableHeaderCell_();
sink.tableCell( cellAttributes );
sink.text( plugin.getGroupId() );
sink.text( details.getGroupId() );
sink.tableCell_();
sink.tableRow_();
sink.tableRow();
sink.tableHeaderCell( headerAttributes );
sink.text( getText( "report.artifactId" ) );
sink.tableHeaderCell_();
sink.tableCell( cellAttributes );
sink.text( plugin.getArtifactId() );
sink.text( details.getArtifactId() );
sink.tableCell_();
sink.tableRow_();
sink.tableRow();
sink.tableHeaderCell( headerAttributes );
sink.text( getText( "report.currentVersion" ) );
sink.tableHeaderCell_();
sink.tableCell( cellAttributes );
sink.text( plugin.getVersion() );
sink.text( details.getVersion() );
sink.tableCell_();
sink.tableRow_();
if ( !upToDate )
Expand All @@ -353,7 +353,7 @@ else if ( plugin.getNewestUpdate( of( MAJOR ) ) != null )
{
sink.lineBreak();
}
String label = getLabel( allUpdates[i], plugin );
String label = getLabel( allUpdates[i], details );
if ( label != null )
{
safeBold();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ protected void renderSuccessIcon()
sink.figureGraphics( "images/icon_success_sml.gif" );
}

protected void renderStatRow( String textKey, int statCount )
protected void renderStatRow( String textKey, int statCount, boolean forceSuccessIcon )
{
sink.tableRow();
sink.tableCell();
if ( statCount == 0 )
if ( statCount == 0 || forceSuccessIcon )
{
renderSuccessIcon();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,6 @@ public void testReportLabels()

assertThat( instance.getNewestUpdate( of( SUBINCREMENTAL ) ).toString(), is( "1.1.0-2" ) );
assertThat( instance.getOldestUpdate( of( INCREMENTAL ) ).toString(), is( "1.1.1" ) );
assertThat( instance.getNewestUpdate( of( INCREMENTAL ) ).toString(), is( "1.1.3" ) );
}
}

0 comments on commit f5231de

Please sign in to comment.