Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

change Add Build Queue list box in editSchedule.jsp to an optiontrans…

…ferselect box

git-svn-id: https://svn.apache.org/repos/asf/continuum/branches/continuum-parallel-builds@734072 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit af3deeb246b53fec3578ab1f249af35003580712 1 parent 8b9705c
@oching oching authored
View
112 continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ScheduleAction.java
@@ -21,7 +21,6 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import org.apache.maven.continuum.ContinuumException;
@@ -72,20 +71,49 @@
private String dayOfWeek = "?";
private String year;
-
- private List<BuildQueue> schedulesBuildQueue;
-
- private BuildQueue buildQueue;
-
- private List<BuildQueue> buildQueues;
-
- private List<String> buildQueueIds;
+
+ private List<String> availableBuildQueues;
+
+ private List<String> selectedBuildQueues = new ArrayList<String>();
public void prepare()
throws Exception
{
super.prepare();
+
+ populateBuildQueues();
+ }
+
+ private void populateBuildQueues()
+ throws ContinuumException
+ {
+ List<BuildQueue> buildQueues = null;
+ if( schedule != null )
+ {
+ buildQueues = schedule.getBuildQueues();
+ for( BuildQueue buildQueue : buildQueues )
+ {
+ selectedBuildQueues.add( buildQueue.getName() );
+ }
+
+ }
+
+ availableBuildQueues = new ArrayList<String>();
+
buildQueues = getContinuum().getAllBuildQueues();
+ for( BuildQueue buildQueue : buildQueues )
+ {
+ availableBuildQueues.add( buildQueue.getName() );
+ }
+
+ // remove selected build queues from available build queues
+ for( String buildQueue : selectedBuildQueues )
+ {
+ if( availableBuildQueues.contains( buildQueue ) )
+ {
+ availableBuildQueues.remove( buildQueue );
+ }
+ }
}
public String summary()
@@ -106,8 +134,7 @@ public String summary()
return REQUIRES_AUTHENTICATION;
}
- buildQueueIds = new ArrayList<String>();
-
+
schedules = getContinuum().getSchedules();
return SUCCESS;
@@ -154,7 +181,7 @@ public String input()
delay = schedule.getDelay();
maxJobExecutionTime = schedule.getMaxJobExecutionTime();
- getBuildQueueIdsFromSchedule();
+ populateBuildQueues();
}
else
{
@@ -165,22 +192,6 @@ public String input()
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
{
@@ -247,16 +258,15 @@ private Schedule setFields( Schedule schedule )
schedule.setName( name );
schedule.setMaxJobExecutionTime( maxJobExecutionTime );
- // remove old build queues
+ // remove old build queues
schedule.setBuildQueues( null );
- // add selected build queues
- for ( String buildQueueId : buildQueueIds )
+ for( String name : selectedBuildQueues )
{
- BuildQueue buildQueue = getContinuum().getBuildQueueByName( buildQueueId );
+ BuildQueue buildQueue = getContinuum().getBuildQueueByName( name );
schedule.addBuildQueue( buildQueue );
}
-
+
return schedule;
}
@@ -485,43 +495,23 @@ private String getCronExpression()
return ( second + " " + minute + " " + hour + " " + dayOfMonth + " " + month + " " + dayOfWeek + " " + year ).trim();
}
- public BuildQueue getBuildQueue()
- {
- return buildQueue;
- }
-
- public void setBuildQueue( BuildQueue buildQueue )
- {
- this.buildQueue = buildQueue;
- }
-
- public List<BuildQueue> getBuildQueues()
- {
- return buildQueues;
- }
-
- public void setBuildQueues( List<BuildQueue> buildQueues )
- {
- this.buildQueues = buildQueues;
- }
-
- public List<String> getBuildQueueIds()
+ public List<String> getAvailableBuildQueues()
{
- return buildQueueIds == null ? Collections.EMPTY_LIST : buildQueueIds;
+ return availableBuildQueues;
}
- public void setBuildQueueIds( List<String> buildQueueIds )
+ public void setAvailableBuildQueues( List<String> availableBuildQueues )
{
- this.buildQueueIds = buildQueueIds;
+ this.availableBuildQueues = availableBuildQueues;
}
- public List<BuildQueue> getSchedulesBuildQueue()
+ public List<String> getSelectedBuildQueues()
{
- return schedulesBuildQueue;
+ return selectedBuildQueues;
}
- public void setSchedulesBuildQueue( List<BuildQueue> schedulesBuildQueue )
+ public void setSelectedBuildQueues( List<String> selectedBuildQueues )
{
- this.schedulesBuildQueue = schedulesBuildQueue;
+ this.selectedBuildQueues = selectedBuildQueues;
}
}
View
1  continuum-webapp/src/main/resources/localization/Continuum.properties
@@ -618,6 +618,7 @@ schedule.month.label = Month
schedule.dayOfWeek.label = Day of Week
schedule.year.label = Year [optional]
schedule.remove.error = The schedule can't be removed, it is probably used by a build definition.
+schedule.buildqueues.label = Add Build Queue
schedule.buildqueues.define = Configure the used build queues
schedule.available.buildqueues = --- Available Build Queues ---
schedule.available.buildqueues.used = --- Used Build Queues ---
View
13 continuum-webapp/src/main/webapp/WEB-INF/jsp/editSchedule.jsp
@@ -72,9 +72,16 @@
<s:textfield label="%{getText('schedule.quietPeriod.label')}" name="delay">
<s:param name="desc"><p><s:text name="schedule.quietPeriod.message"/></p></s:param>
</s:textfield>
-
- <s:select label="Add Build Queue" id="buildQueueIds" name="buildQueueIds" listKey="name" listValue="name" multiple="true"
- list="buildQueues" />
+
+ <s:optiontransferselect label="%{getText('schedule.buildqueues.label')}" name="availableBuildQueues"
+ list="availableBuildQueues" size="8" multiple="true" emptyOption="false"
+ doubleName="selectedBuildQueues" doubleList="selectedBuildQueues" doubleSize="8"
+ doubleMultiple="true" doubleEmptyOption="false"
+ addAllToRightOnclick="selectAllOptions(document.getElementById('saveSchedule_availableBuildQueues'));selectAllOptions(document.getElementById('saveSchedule_selectedBuildQueues'));"
+ addToRightOnclick="selectAllOptions(document.getElementById('saveSchedule_availableBuildQueues'));selectAllOptions(document.getElementById('saveSchedule_selectedBuildQueues'));"
+ addAllToLeftOnclick="selectAllOptions(document.getElementById('saveSchedule_availableBuildQueues'));selectAllOptions(document.getElementById('saveSchedule_selectedBuildQueues'));"
+ addToLeftOnclick="selectAllOptions(document.getElementById('saveSchedule_availableBuildQueues'));selectAllOptions(document.getElementById('saveSchedule_selectedBuildQueues'));"
+ />
<s:checkbox label="%{getText('schedule.enabled.label')}" name="active" value="active" fieldValue="true">
<s:param name="desc"><p><s:text name="schedule.enabled.message"/></p></s:param>
Please sign in to comment.
Something went wrong with that request. Please try again.