continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From och...@apache.org
Subject svn commit: r727652 - in /continuum/branches/continuum-parallel-builds/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/ScheduleAction.java resources/localization/Continuum.properties webapp/WEB-INF/jsp/admin/buildQueueView.jsp
Date Thu, 18 Dec 2008 06:10:25 GMT
Author: oching
Date: Wed Dec 17 22:10:24 2008
New Revision: 727652

URL: http://svn.apache.org/viewvc?rev=727652&view=rev
Log:
o fix attaching of build queues to schedule
o fixed ui of queues page

Modified:
    continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
    continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/resources/localization/Continuum.properties
    continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/buildQueueView.jsp

Modified: continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java?rev=727652&r1=727651&r2=727652&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
Wed Dec 17 22:10:24 2008
@@ -159,7 +159,9 @@
             description = schedule.getDescription();
             name = schedule.getName();
             delay = schedule.getDelay();
-            maxJobExecutionTime = schedule.getMaxJobExecutionTime();            
+            maxJobExecutionTime = schedule.getMaxJobExecutionTime();       
+            
+            getBuildQueueIdsFromSchedule();
         }
         else
         {
@@ -170,6 +172,22 @@
         return SUCCESS;
     }
 
+    private void getBuildQueueIdsFromSchedule()
+    {
+        if( schedule != null )
+        {
+            List<BuildQueue> buildQueues = schedule.getBuildQueues();
+            if( buildQueueIds == null )
+            {
+                buildQueueIds = new ArrayList<String>();
+            }
+            for( BuildQueue buildQueue :  buildQueues )
+            {
+                buildQueueIds.add( buildQueue.getName() );
+            }
+        }
+    }
+
     public String save()
         throws ContinuumException
     {
@@ -196,21 +214,38 @@
             return ERROR;
         }
         else
-        {
+        {            
             if ( id == 0 )
             {
-                getContinuum().addSchedule( setFields( new Schedule() ) );
+                try
+                {
+                    getContinuum().addSchedule( setFields( new Schedule() ) );
+                }
+                catch ( ContinuumStoreException e )
+                {
+                    addActionError( "schedule.buildqueues.add.error" );
+                    return ERROR;
+                }
                 return SUCCESS;
             }
             else
             {
-                getContinuum().updateSchedule( setFields( getContinuum().getSchedule( id
) ) );
+                try
+                {
+                    getContinuum().updateSchedule( setFields( getContinuum().getSchedule(
id ) ) );
+                }
+                catch ( ContinuumStoreException e )
+                {   
+                    addActionError( "schedule.buildqueues.add.error" );
+                    return ERROR;
+                }
                 return SUCCESS;
             }
         }
     }
 
-    private Schedule setFields( Schedule schedule )
+    private Schedule setFields( Schedule schedule ) 
+        throws ContinuumStoreException
     {
         schedule.setActive( active );	
         schedule.setCronExpression( getCronExpression() );
@@ -218,29 +253,17 @@
         schedule.setDescription( description );
         schedule.setName( name );
         schedule.setMaxJobExecutionTime( maxJobExecutionTime );
-                
+       
         // remove old build queues
-        /*List<BuildQueue> existingBuildQueues = schedule.getBuildQueues();
-        for( BuildQueue buildQueue : existingBuildQueues )
-        {
-            schedule.removeBuildQueue( buildQueue );
-        }
-        */
+        schedule.setBuildQueues( null );
+                        
+        // add selected build queues
         for ( String buildQueueId : buildQueueIds )
-        {   
-            try
-            {
-                BuildQueue buildQueue = buildQueueDao.getBuildQueueByName( buildQueueId )
;
-                schedule.addBuildQueue( buildQueue );
-            }
-            catch ( ContinuumStoreException e)
-            {
-                addActionError( e.getMessage() );
-            }
+        {               
+            BuildQueue buildQueue = buildQueueDao.getBuildQueueByName( buildQueueId ) ;
+            schedule.addBuildQueue( buildQueue );           
         }
         
-        //schedule.setBuildQueues( getBuildQueuesFromSelectedBuildQueues() );
-
         return schedule;
     }
 
@@ -294,7 +317,6 @@
             catch ( ContinuumException e )
             {
                 addActionError( "schedule.remove.error" );
-
                 return ERROR;
             }
         }
@@ -308,31 +330,7 @@
         }
 
         return SUCCESS;
-    }
-    
-    private List<BuildQueue> getBuildQueuesFromSelectedBuildQueues()
-    {   
-        if ( this.buildQueueIds == null )
-        {
-            return Collections.EMPTY_LIST;
-        }
-     
-        List<BuildQueue> selectedBuildQueue = new ArrayList<BuildQueue>();  
     
-        for ( String buildQueueId : buildQueueIds )
-        {  
-        	try
-        	{
-        	    BuildQueue buildQueue = buildQueueDao.getBuildQueueByName( buildQueueId ) ;
-        	}
-        	catch ( ContinuumStoreException e)
-        	{
-        	    addActionError( e.getMessage() );
-        	}
-            
-            selectedBuildQueue.add( buildQueue );
-        }
-        return selectedBuildQueue;
-    }
+    }    
 
     public Collection getSchedules()
     {

Modified: continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/resources/localization/Continuum.properties
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/resources/localization/Continuum.properties?rev=727652&r1=727651&r2=727652&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/resources/localization/Continuum.properties
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/resources/localization/Continuum.properties
Wed Dec 17 22:10:24 2008
@@ -620,6 +620,7 @@
 schedule.buildqueues.define = Configure the used build queues
 schedule.available.buildqueues = --- Available Build Queues ---
 schedule.available.buildqueues.used = --- Used Build Queues ---
+schedule.buildqueues.add.error = Error attaching the build queue(s) to schedule.
 
 # ----------------------------------------------------------------------
 # Page: SurefireReport

Modified: continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/buildQueueView.jsp
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/buildQueueView.jsp?rev=727652&r1=727651&r2=727652&view=diff
==============================================================================
--- continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/buildQueueView.jsp
(original)
+++ continuum/branches/continuum-parallel-builds/continuum-webapp/src/main/webapp/WEB-INF/jsp/admin/buildQueueView.jsp
Wed Dec 17 22:10:24 2008
@@ -44,7 +44,6 @@
                 <th><s:text name="buildQueue.currentTask.buildDefinition"/></th>
                 <th>&nbsp;</th>
               </tr>
-              <%-- //deng - TODO: loop through each of the current tasks --%>
               <c:forEach var="element" items="${currentBuildProjectTasks}">
                 <tr>              
                   <td width="20%">${element.key}</td> 
@@ -71,6 +70,72 @@
           </table>
         </div>  
         
+        <div id="h3">
+          <h3>
+            <s:text name="buildQueue.section.title"/>
+          </h3>   
+          <table width="100%">
+            <s:if test="%{buildsInQueue != null}">
+            <tbody>
+              <tr>
+                <redback:ifAuthorized permission="continuum-manage-queues">
+                  <th>&nbsp;</th>
+                </redback:ifAuthorized>
+                <th><s:text name="buildQueue.currentTask.buildQueue"/></th>
+                <th><s:text name="buildQueue.currentTask.projectName"/></th>
+                <th><s:text name="buildQueue.currentTask.buildDefinition"/></th>
+                <th>&nbsp;</th>
+              </tr>
+              <c:forEach var="element" items="${buildsInQueue}">
+                <tr>                  
+                  <c:forEach var="buildTask" items="${element.value}">
+                    <td width="1%>
+                      <redback:ifAuthorized permission="continuum-manage-queues">
+                        <input type="checkbox" name="selectedBuildTaskHashCodes" value="${buildTask.hashCode}"
/>                                      
+                      </redback:ifAuthorized>
+                    </td>
+                  	<td width="29%">${element.key}</td>
+                  	<td width="50%">${buildTask.projectName}</td>
+                  	<td width="19%">${buildTask.buildDefinitionLabel}</td>
+                    <td width="1%">
+                      <redback:ifAuthorized permission="continuum-manage-queues">
+                        <s:url id="cancelUrl" action="removeBuildQueueEntry" method="remove"
namespace="/">
+                          <s:param name="projectId">${pageScope.buildTask.projectId}</s:param>
+                          <s:param name="buildDefinitionId">${pageScope.buildTask.buildDefinitionId}</s:param>
+                          <s:param name="trigger">${pageScope.buildTask.trigger}</s:param>
+                          <s:param name="projectName">${pageScope.buildTask.projectName}</s:param>
+                        </s:url>
+                        <s:a href="%{cancelUrl}"><img src="<s:url value='/images/cancelbuild.gif'
includeParams="none"/>" alt="<s:text name='cancel'/>" title="<s:text name='cancel'/>"
border="0"></s:a>
+                      </redback:ifAuthorized>
+                      <redback:elseAuthorized>
+                        <img src="<s:url value='/images/cancelbuild_disabled.gif' includeParams="none"/>"
alt="<s:text name='cancel'/>" title="<s:text name='cancel'/>" border="0">
+                      </redback:elseAuthorized>               
+                    </td>
+                  </c:forEach>                  
+                </tr>
+              </c:forEach>
+            </tbody>
+            </s:if>
+            <s:else>
+              <s:text name="buildQueue.empty"/>
+            </s:else>
+          </table>
+        </div>   
+        <c:if test="${not empty buildsInQueue}">
+          <div class="functnbar3">
+            <table>
+              <tbody>
+                <tr>
+                  <td>
+                    <input type="submit" value="<s:text name="buildQueue.removeEntries"/>"
+                           onclick="$('removeForm').action='removeBuildQueueEntries!removeBuildEntries.action';$('removeForm').submit();"
/> 
+                  </td>
+                </tr>
+              </tbody>
+            </table>
+          </div>
+        </c:if> 
+        
         <%-- deng - parallel builds
         TODO: might need to loop through each element of map (each returns a list) 
         
@@ -129,8 +194,7 @@
               </tbody>
             </table>
           </div>
-        </c:if>
-        
+        </c:if>        
         
         END OF COMMENT --%>
         
@@ -173,16 +237,66 @@
           </table>
         </div>    
         
-        <%-- deng - parallel builds 
-        TODO: might need to loop through each element of map (each returns a list) 
-        
+        <div id="h3">
+          <h3>
+            <s:text name="checkoutQueue.section.title"/>
+          </h3>   
+          <table width="100%">
+            <s:if test="%{checkoutsInQueue != null}">
+            <tbody>
+              <tr>
+                <redback:ifAuthorized permission="continuum-manage-queues">
+                  <th>&nbsp;</th>
+                </redback:ifAuthorized>
+                <th><s:text name="checkoutQueue.currentTask.buildQueue"/></th>
+                <th><s:text name="checkoutQueue.currentTask.projectName"/></th>
+                <th>&nbsp;</th>
+              </tr>
+              <c:forEach var="element" items="${checkoutsInQueue}">
+                <tr>                  
+                  <c:forEach var="checkoutTask" items="${element.value}">
+                    <td width="1%>
+                      <redback:ifAuthorized permission="continuum-manage-queues">
+                        <input type="checkbox" name="selectedCheckOutTaskHashCodes" value="${checkoutTask.hashCode}"
/>                                      
+                      </redback:ifAuthorized>
+                    </td>
+                  	<td width="29%">${element.key}</td>
+                  	<td width="69%">${checkoutTask.projectName}</td>
+                    <td width="1%">
+                      <redback:ifAuthorized permission="continuum-manage-queues">
+                        <s:url id="cancelUrl" action="removeCheckoutQueueEntry" method="removeCheckout">
+                          <s:param name="projectId">${checkoutTask.projectId}</s:param>
+                        </s:url>
+                        <s:a href="%{cancelUrl}"><img src="<s:url value='/images/cancelbuild.gif'
includeParams="none"/>" alt="<s:text name='cancel'/>" title="<s:text name='cancel'/>"
border="0"></s:a>
+                      </redback:ifAuthorized>
+                      <redback:elseAuthorized>
+                        <img src="<s:url value='/images/cancelbuild_disabled.gif' includeParams="none"/>"
alt="<s:text name='cancel'/>" title="<s:text name='cancel'/>" border="0">
+                      </redback:elseAuthorized>             
+                    </td>
+                  </c:forEach>                  
+                </tr>
+              </c:forEach>
+            </tbody>
+            </s:if>
+            <s:else>
+              <s:text name="checkoutQueue.no.currentTaks" />
+            </s:else>
+          </table>
+        </div>    
         
+        <%--
         <div id="h3">
           <h3>
             <s:text name="checkoutQueue.section.title"/>
           </h3>  
+          
+          
+          <c:forEach var="element" items="${checkoutsInQueue}">
+          <h4>          
+            Build Queue: ${element.key}
+          </h4>          
             <c:if test="${!empty checkoutsInQueue}">              
-              <ec:table items="checkoutsInQueue.values"
+              <ec:table items="checkoutsInQueue.values.value"
                         var="currentCheckOutTask"
                         showExports="false"
                         showPagination="false"
@@ -210,11 +324,12 @@
                 </ec:row>
               </ec:table>
             </c:if>
-            <c:if test="${empty currentCheckOutTasks}">
+            <c:if test="${empty checkoutsInQueue}">
               <s:text name="checkoutQueue.empty"/>
             </c:if>
+          </c:forEach>   
         </div>
-        <c:if test="${not empty currentCheckOutTasks}">
+        <c:if test="${not empty checkoutsInQueue}">
           <div class="functnbar3">
             <table>
               <tbody>
@@ -230,8 +345,7 @@
             </table>
           </div>
         </c:if>
-        
-        END OF COMMENT --%>
+        --%>
         
       </s:form>
     </body>



Mime
View raw message