continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r570554 - in /maven/continuum/trunk/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/SummaryAction.java resources/localization/Continuum.properties webapp/WEB-INF/jsp/components/projectSummaryComponent.jsp
Date Tue, 28 Aug 2007 19:58:12 GMT
Author: evenisse
Date: Tue Aug 28 12:58:11 2007
New Revision: 570554

URL: http://svn.apache.org/viewvc?rev=570554&view=rev
Log:
[CONTINUUM-1333] Add the status counter in the projectgroup summary page
Submitted by: Olivier Lamy

Modified:
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java
    maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
    maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/components/projectSummaryComponent.jsp

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java?rev=570554&r1=570553&r2=570554&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java
Tue Aug 28 12:58:11 2007
@@ -19,18 +19,20 @@
  * under the License.
  */
 
-import org.apache.maven.continuum.ContinuumException;
-import org.apache.maven.continuum.model.project.BuildResult;
-import org.apache.maven.continuum.model.project.Project;
-import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
-import org.apache.maven.continuum.web.model.ProjectSummary;
-
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.model.project.BuildResult;
+import org.apache.maven.continuum.model.project.Project;
+import org.apache.maven.continuum.project.ContinuumProjectState;
+import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.apache.maven.continuum.web.model.GroupSummary;
+import org.apache.maven.continuum.web.model.ProjectSummary;
+
 /**
  * Used to render the list of projects in the project group page.
  *
@@ -46,6 +48,8 @@
     private String projectGroupName;
 
     private List summary;
+    
+    private GroupSummary groupSummary = new GroupSummary();
 
     public String execute()
         throws ContinuumException
@@ -122,6 +126,7 @@
                 if ( latestBuild != null )
                 {
                     model.setLatestBuildId( latestBuild.getId() );
+                    populateGroupSummary( latestBuild );
                 }
             }
 
@@ -130,6 +135,63 @@
 
         return SUCCESS;
     }
+    
+    private void populateGroupSummary(BuildResult latestBuild)
+    {
+        switch ( latestBuild.getState() )
+        {
+            case ContinuumProjectState.ERROR:
+                // default value -1 so +2 first time
+                if ( groupSummary.getNumErrors() < 0 )
+                {
+                    groupSummary.setNumErrors( groupSummary.getNumErrors() + 2 );
+                }
+                else
+                {
+                    groupSummary.setNumErrors( groupSummary.getNumErrors() + 1 );
+                }
+                break;
+            case ContinuumProjectState.OK:
+                // default value -1 so +2 first time
+                if ( groupSummary.getNumSuccesses() < 0 )
+                {
+                    groupSummary.setNumSuccesses( groupSummary.getNumSuccesses() + 2 );
+                }
+                else
+                {
+                    groupSummary.setNumSuccesses( groupSummary.getNumSuccesses() + 1 );
+                }
+                break;
+            case ContinuumProjectState.FAILED:
+                // default value -1 so +2 first time
+                if ( groupSummary.getNumFailures() < 0 )
+                {
+                    groupSummary.setNumFailures( groupSummary.getNumFailures() + 2 );
+                }
+                else
+                {
+                    groupSummary.setNumFailures( groupSummary.getNumFailures() + 1 );
+                }
+                break;
+            default:
+                getLogger().warn(
+                                  "unknown buildState value " + latestBuild.getState() +
" with build "
+                                      + latestBuild.getId() );
+        }
+        // to not display -1
+        if (groupSummary.getNumFailures() < 0)
+        {
+            groupSummary.setNumFailures( 0 );
+        }
+        if (groupSummary.getNumErrors() < 0 )
+        {
+            groupSummary.setNumErrors( 0 );
+        }
+        if (groupSummary.getNumSuccesses() < 0 )
+        {
+            groupSummary.setNumSuccesses( 0 );
+        }
+    }
 
     public List getProjects()
     {
@@ -155,5 +217,15 @@
     public void setProjectGroupName( String projectGroupName )
     {
         this.projectGroupName = projectGroupName;
+    }
+
+    public GroupSummary getGroupSummary()
+    {
+        return groupSummary;
+    }
+
+    public void setGroupSummary( GroupSummary groupSummary )
+    {
+        this.groupSummary = groupSummary;
     }
 }

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=570554&r1=570553&r2=570554&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/localization/Continuum.properties
Tue Aug 28 12:58:11 2007
@@ -149,6 +149,10 @@
 projectGroup.buildGroup = Build all projects
 projectGroup.deleteProjects = Delete Project(s)
 projectGroup.buildProjects = Build Project(s)
+projectGroup.buildsStatut.title = Project Group Last Build Result Overview
+projectGroup.buildsStatut.errors = Errors
+projectGroup.buildsStatut.failures = Failed
+projectGroup.buildsStatut.success = Success
 
 # ----------------------------------------------------------------------
 # Page: Add Project Group
@@ -628,6 +632,7 @@
 installation.envvar.type.label = Environment Variable
 installation.ant.type.label = ANT
 installation.automaticProfile.label=Create a Profile with the installation name
+
 
 
 

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/components/projectSummaryComponent.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/components/projectSummaryComponent.jsp?rev=570554&r1=570553&r2=570554&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/components/projectSummaryComponent.jsp
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/components/projectSummaryComponent.jsp
Tue Aug 28 12:58:11 2007
@@ -26,6 +26,20 @@
 <ww:i18n name="localization.Continuum">
 <ww:if test="${not empty projects}">
 
+  <h3><ww:text name="projectGroup.buildsStatut.title"/></h3>
+  <table>
+    <tr>
+      <td>
+          <ww:text name="projectGroup.buildsStatut.success"/> : ${groupSummary.numSuccesses}
+          &nbsp;<img src="${request.contextPath}/images/icon_success_sml.gif" alt="<ww:text
name="projectGroup.buildsStatut.success"/>">    
+          &nbsp; <ww:text name="projectGroup.buildsStatut.errors"/> : ${groupSummary.numErrors}
+          &nbsp;<img src="${request.contextPath}/images/icon_error_sml.gif" alt="<ww:text
name="projectGroup.buildsStatut.errors"/>">
+          &nbsp; <ww:text name="projectGroup.buildsStatut.failures"/> : ${groupSummary.numFailures}
+          &nbsp;<img src="${request.contextPath}/images/icon_warning_sml.gif" alt="<ww:text
name="projectGroup.buildsStatut.failures"/>">
+      <td>      
+    </tr>
+  </table>
+
   <h3><ww:text name="projectGroup.projects.title"/></h3>
 
   <form id="projectsForm" action="ProjectsList.action" method="post">



Mime
View raw message