java/code/src/com/redhat/rhn/frontend/action/tasko/BunchDetailAction.java | 91 +++
java/code/src/com/redhat/rhn/frontend/action/tasko/DeleteScheduleAction.java | 107 ++++
java/code/src/com/redhat/rhn/frontend/action/tasko/SatSchedulesAction.java | 65 ++
java/code/src/com/redhat/rhn/frontend/action/tasko/ScheduleDetailAction.java | 194
++++++++
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml | 24
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 242
++++++++++
java/code/src/com/redhat/rhn/taskomatic/TaskoFactory.java | 36 +
java/code/src/com/redhat/rhn/taskomatic/TaskoRun.hbm.xml | 4
java/code/src/com/redhat/rhn/taskomatic/TaskoRun.java | 4
java/code/src/com/redhat/rhn/taskomatic/TaskoSchedule.hbm.xml | 4
java/code/src/com/redhat/rhn/taskomatic/TaskoXmlRpcHandler.java | 36 +
java/code/src/com/redhat/rhn/taskomatic/TaskomaticApi.java | 124
+++++
java/code/webapp/WEB-INF/nav/sitenav-authenticated.xml | 7
java/code/webapp/WEB-INF/pages/admin/bunchDetail.jsp | 74 +++
java/code/webapp/WEB-INF/pages/admin/deleteSchedule.jsp | 66 ++
java/code/webapp/WEB-INF/pages/admin/scheduleDetail.jsp | 128
+++++
java/code/webapp/WEB-INF/pages/admin/schedules.jsp | 57 ++
java/code/webapp/WEB-INF/pages/common/fragments/repeat-task-picker.jspf | 49 --
java/code/webapp/WEB-INF/struts-config.xml | 50 +-
19 files changed, 1334 insertions(+), 28 deletions(-)
New commits:
commit 101b4b425e8839f5006c0c4fa356d55a51ecc410
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Apr 29 13:12:13 2011 +0200
659138 - set start time for skipped queue jobs
diff --git a/java/code/src/com/redhat/rhn/taskomatic/TaskoRun.java
b/java/code/src/com/redhat/rhn/taskomatic/TaskoRun.java
index 8048fa0..ceae63e 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/TaskoRun.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/TaskoRun.java
@@ -115,7 +115,9 @@ public class TaskoRun {
* if task execution will be skipped (used for queue tasks)
*/
public void skipped() {
- setEndTime(new Date());
+ Date now = new Date();
+ setStartTime(now);
+ setEndTime(now);
setStatus(STATUS_SKIPPED);
}
commit 9bd27dab18ff55e535282e080588c2e858201bdd
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri Apr 29 17:32:08 2011 +0200
659138 - style id support for repeat-task-picker
diff --git a/java/code/webapp/WEB-INF/pages/common/fragments/repeat-task-picker.jspf
b/java/code/webapp/WEB-INF/pages/common/fragments/repeat-task-picker.jspf
index 5d56ac0..4ac0c85 100644
--- a/java/code/webapp/WEB-INF/pages/common/fragments/repeat-task-picker.jspf
+++ b/java/code/webapp/WEB-INF/pages/common/fragments/repeat-task-picker.jspf
@@ -10,21 +10,23 @@
-<input type="radio" name="${picker.name}_status"
value="disabled"
- <c:if test="${picker.status ==
'disabled'}">checked="true"</c:if> />
- <bean:message key="schedule.disabled"/>
+<input type="radio" name="${picker.name}_status"
value="disabled" id="disabled"
+ <c:if test="${picker.status ==
'disabled'}">checked="true"</c:if> />
+ <label for="disabled"><bean:message
key="schedule.disabled"/></label>
<br/>
-<input type="radio" name="${picker.name}_status"
value="daily" <c:if test="${picker.status ==
'daily'}">checked="true"</c:if> />
- <bean:message key="schedule.daily"/>:
+<input type="radio" name="${picker.name}_status"
value="daily" id="daily"
+<c:if test="${picker.status ==
'daily'}">checked="true"</c:if> />
+ <label for="daily"><bean:message
key="schedule.daily"/>:
<c:set var="timeName" value="daily" />
<%@ include
file="/WEB-INF/pages/common/fragments/hour-minute-picker.jspf" %>
-
+ </label>
<br/>
-<input type="radio" name="${picker.name}_status"
value="weekly" <c:if test="${picker.status ==
'weekly'}">checked="true"</c:if> />
- <bean:message key="schedule.weekly"/>:
+<input type="radio" name="${picker.name}_status"
value="weekly" id="weekly"
+<c:if test="${picker.status ==
'weekly'}">checked="true"</c:if> />
+ <label for="weekly"><bean:message
key="schedule.weekly"/>:
<bean:message key="schedule.weekly.every"/>
<select name='${picker.name}_day_week' size="1">
<c:forEach var="day" begin="0" end="6">
@@ -36,33 +38,30 @@
<c:set var="timeName" value="weekly" />
<%@ include
file="/WEB-INF/pages/common/fragments/hour-minute-picker.jspf" %>
-
-
-
-
+ </label>
<br/>
-<input type="radio" name="${picker.name}_status"
value="monthly" <c:if test="${picker.status ==
'monthly'}">checked="true"</c:if> />
- <bean:message key="schedule.monthly"/>:
+<input type="radio" name="${picker.name}_status"
value="monthly" id="monthly"
+<c:if test="${picker.status ==
'monthly'}">checked="true"</c:if> />
+ <label for="monthly"><bean:message
key="schedule.monthly"/>:
- <bean:message key="schedule.monthly.day"/>
+ <bean:message key="schedule.monthly.day"/>
<select name='${picker.name}_day_month' size="1">
<c:forEach var="day" begin="1" end="28">
- <option <c:if test="${picker.dayOfMonthLong ==
day}">selected="selected"</c:if>
value='${day}'>${day}</option>
+ <option <c:if test="${picker.dayOfMonthLong ==
day}">selected="selected"</c:if>
value='${day}'>${day}</option>
</c:forEach>
- </select>
- <bean:message key="schedule.weekly.at"/>
- <c:set var="timeName" value="monthly" />
+ </select>
+ <bean:message key="schedule.weekly.at"/>
+ <c:set var="timeName" value="monthly" />
<%@ include
file="/WEB-INF/pages/common/fragments/hour-minute-picker.jspf" %>
-
-
-
+ </label>
<br/>
-
-<input type="radio" name="${picker.name}_status"
value="cron" <c:if test="${picker.status ==
'cron'}">checked="true"</c:if> />
- <bean:message key="schedule.cron"/>:
+<input type="radio" name="${picker.name}_status"
value="cron" id="cron"
+<c:if test="${picker.status ==
'cron'}">checked="true"</c:if> />
+ <label for="cron"><bean:message key="schedule.cron"/>:
<input type="text" size="20" name="${picker.name}_cron"
value="${picker.cronEntry}">
+ </label>
commit eaf6ae607fdf17541c72ae02218fa9c66ce61660
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Wed Apr 6 17:18:48 2011 +0200
659138 - introduce WebUI interface for taskomatic schedule management
diff --git a/java/code/src/com/redhat/rhn/frontend/action/tasko/BunchDetailAction.java
b/java/code/src/com/redhat/rhn/frontend/action/tasko/BunchDetailAction.java
new file mode 100644
index 0000000..2bf580e
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/action/tasko/BunchDetailAction.java
@@ -0,0 +1,91 @@
+/**
+ * Copyright (c) 2011 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ *
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.frontend.action.tasko;
+
+import com.redhat.rhn.common.localization.LocalizationService;
+import com.redhat.rhn.domain.user.User;
+import com.redhat.rhn.frontend.struts.RequestContext;
+import com.redhat.rhn.frontend.struts.RhnAction;
+import com.redhat.rhn.frontend.struts.RhnHelper;
+import com.redhat.rhn.frontend.taglibs.list.helper.ListHelper;
+import com.redhat.rhn.frontend.taglibs.list.helper.Listable;
+import com.redhat.rhn.taskomatic.TaskomaticApi;
+import com.redhat.rhn.taskomatic.TaskomaticApiException;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+
+/**
+ * BunchDetailAction
+ * @version $Rev$
+ */
+public class BunchDetailAction extends RhnAction implements Listable {
+
+ public static final String LIST_NAME = "runList";
+
+ /** {@inheritDoc} */
+ public ActionForward execute(ActionMapping mapping,
+ ActionForm formIn,
+ HttpServletRequest request,
+ HttpServletResponse response) {
+ RequestContext ctx = new RequestContext(request);
+ User loggedInUser = ctx.getLoggedInUser();
+ String bunchLabel = request.getParameter("label");
+ request.setAttribute("label", bunchLabel);
+ request.setAttribute("bunchdescription",
LocalizationService.getInstance().
+ getMessage("bunch.jsp.description." + bunchLabel));
+ ListHelper helper = new ListHelper(this, request);
+ helper.setListName(LIST_NAME);
+ helper.setParentUrl(request.getRequestURI() + "?label=" + bunchLabel);
+ helper.execute();
+
+ if (ctx.isSubmitted()) {
+ try {
+ new TaskomaticApi().scheduleSingleSatBunch(loggedInUser, bunchLabel);
+ createSuccessMessage(request, "message.bunch.singlescheduled",
bunchLabel);
+ }
+ catch (TaskomaticApiException e) {
+ createErrorMessage(request,
+ "repos.jsp.message.taskomaticdown", null);
+ }
+ }
+
+ return mapping.findForward(RhnHelper.DEFAULT_FORWARD);
+ }
+
+ /** {@inheritDoc} */
+ public List getResult(RequestContext contextIn) {
+ User user = contextIn.getLoggedInUser();
+ String bunchName = contextIn.getParam("label", true);
+ try {
+ List<Map> runs = new TaskomaticApi().findRunsByBunch(user, bunchName);
+ return runs;
+ }
+ catch (TaskomaticApiException e) {
+ createErrorMessage(contextIn.getRequest(),
+ "repos.jsp.message.taskomaticdown", null);
+ return new ArrayList();
+ }
+ }
+}
diff --git a/java/code/src/com/redhat/rhn/frontend/action/tasko/DeleteScheduleAction.java
b/java/code/src/com/redhat/rhn/frontend/action/tasko/DeleteScheduleAction.java
new file mode 100644
index 0000000..c9f4a7c
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/action/tasko/DeleteScheduleAction.java
@@ -0,0 +1,107 @@
+/**
+ * Copyright (c) 2011 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ *
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.frontend.action.tasko;
+
+import com.redhat.rhn.domain.user.User;
+import com.redhat.rhn.frontend.struts.RequestContext;
+import com.redhat.rhn.frontend.struts.RhnAction;
+import com.redhat.rhn.taskomatic.TaskomaticApi;
+import com.redhat.rhn.taskomatic.TaskomaticApiException;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+
+/**
+ * DeleteScheduleAction
+ * @version $Rev$
+ */
+public class DeleteScheduleAction extends RhnAction {
+
+ /** {@inheritDoc} */
+ public ActionForward execute(ActionMapping mapping,
+ ActionForm formIn,
+ HttpServletRequest request,
+ HttpServletResponse response) {
+
+ RequestContext ctx = new RequestContext(request);
+ User loggedInUser = ctx.getLoggedInUser();
+
+ if (ctx.hasParam("schid")) {
+ Long scheduleId = ctx.getParamAsLong(("schid"));
+ TaskomaticApi tapi = new TaskomaticApi();
+ Map schedule = new HashMap();
+ try {
+ schedule = tapi.lookupScheduleById(loggedInUser, scheduleId);
+ }
+ catch (TaskomaticApiException e) {
+ createErrorMessage(request,
+ "repos.jsp.message.taskomaticdown", null);
+ }
+ String scheduleName = (String) schedule.get("job_label");
+ String bunchName = (String) schedule.get("bunch");
+ request.setAttribute("schedulename", scheduleName);
+ request.setAttribute("bunch", bunchName);
+ request.setAttribute("cronexpr",
schedule.get("cron_expr"));
+ request.setAttribute("activetill",
schedule.get("active_till"));
+ if (isActive(schedule)) {
+ if (ctx.isSubmitted()) {
+ try {
+ tapi.unscheduleSatTask(scheduleName, loggedInUser);
+ // there's not a good way to check
+ // whether the bunch was unscheduled
+ schedule = tapi.lookupScheduleByBunchAndLabel(loggedInUser,
+ bunchName, scheduleName);
+ if (schedule == null) {
+ createSuccessMessage(request,
"message.scheduledeleted",
+ scheduleName);
+ }
+ return getStrutsDelegate().forwardParams(
+ mapping.findForward("success"),
+ request.getParameterMap());
+ }
+ catch (TaskomaticApiException e) {
+ createErrorMessage(request,
+ "repos.jsp.message.taskomaticdown", null);
+
+ }
+ }
+ }
+ else {
+ createErrorMessage(request, "message.schedulenotactive",
scheduleName);
+ }
+ }
+ return getStrutsDelegate().forwardParams(
+ mapping.findForward("default"),
+ request.getParameterMap());
+ }
+
+ private Boolean isActive(Map schedule) {
+ Date till = (Date) schedule.get("active_till");
+ if (till == null) {
+ return Boolean.TRUE;
+ }
+ Date now = new Date();
+ return now.before(till);
+ }
+}
diff --git a/java/code/src/com/redhat/rhn/frontend/action/tasko/SatSchedulesAction.java
b/java/code/src/com/redhat/rhn/frontend/action/tasko/SatSchedulesAction.java
new file mode 100644
index 0000000..f908ba4
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/action/tasko/SatSchedulesAction.java
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2011 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ *
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.frontend.action.tasko;
+
+import com.redhat.rhn.domain.user.User;
+import com.redhat.rhn.frontend.struts.RequestContext;
+import com.redhat.rhn.frontend.struts.RhnAction;
+import com.redhat.rhn.frontend.struts.RhnHelper;
+import com.redhat.rhn.frontend.taglibs.list.helper.ListHelper;
+import com.redhat.rhn.frontend.taglibs.list.helper.Listable;
+import com.redhat.rhn.taskomatic.TaskomaticApi;
+import com.redhat.rhn.taskomatic.TaskomaticApiException;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+
+/**
+ * SatSchedulesAction
+ * @version $Rev$
+ */
+public class SatSchedulesAction extends RhnAction implements Listable {
+
+ /** {@inheritDoc} */
+ public ActionForward execute(ActionMapping mapping,
+ ActionForm formIn,
+ HttpServletRequest request,
+ HttpServletResponse response) {
+ ListHelper helper = new ListHelper(this, request);
+ helper.execute();
+ return mapping.findForward(RhnHelper.DEFAULT_FORWARD);
+ }
+
+ /** {@inheritDoc} */
+ public List getResult(RequestContext contextIn) {
+ User user = contextIn.getLoggedInUser();
+ try {
+ return new TaskomaticApi().findActiveSchedules(user);
+ }
+ catch (TaskomaticApiException e) {
+ createErrorMessage(contextIn.getRequest(),
+ "repos.jsp.message.taskomaticdown", null);
+ return new ArrayList();
+ }
+ }
+}
diff --git a/java/code/src/com/redhat/rhn/frontend/action/tasko/ScheduleDetailAction.java
b/java/code/src/com/redhat/rhn/frontend/action/tasko/ScheduleDetailAction.java
new file mode 100644
index 0000000..ddac2ff
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/action/tasko/ScheduleDetailAction.java
@@ -0,0 +1,194 @@
+/**
+ * Copyright (c) 2011 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ *
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.frontend.action.tasko;
+
+import com.redhat.rhn.common.util.RecurringEventPicker;
+import com.redhat.rhn.domain.user.User;
+import com.redhat.rhn.frontend.struts.RequestContext;
+import com.redhat.rhn.frontend.struts.RhnAction;
+import com.redhat.rhn.taskomatic.TaskomaticApi;
+import com.redhat.rhn.taskomatic.TaskomaticApiException;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.DynaActionForm;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+
+/**
+ * ScheduleDetailAction
+ * @version $Rev$
+ */
+public class ScheduleDetailAction extends RhnAction {
+
+ /** {@inheritDoc} */
+ public ActionForward execute(ActionMapping mapping,
+ ActionForm formIn,
+ HttpServletRequest request,
+ HttpServletResponse response) {
+
+ DynaActionForm form = (DynaActionForm)formIn;
+ Map params = makeParamMap(request);
+ RequestContext ctx = new RequestContext(request);
+ User loggedInUser = ctx.getLoggedInUser();
+ Long scheduleId = ctx.getParamAsLong(("schid"));
+
+ if (ctx.hasParam("schid")) {
+ params.put("schid", scheduleId);
+ Map schedule = new HashMap();
+ try {
+ schedule = new TaskomaticApi().lookupScheduleById(loggedInUser,
scheduleId);
+ }
+ catch (TaskomaticApiException e) {
+ createErrorMessage(request,
+ "repos.jsp.message.taskomaticdown", null);
+ }
+ String scheduleName = (String) schedule.get("job_label");
+ String bunchName = (String) schedule.get("bunch");
+ request.setAttribute("schedulename", scheduleName);
+ form.set("schedulename", scheduleName);
+ request.setAttribute("bunch", bunchName);
+ Boolean active = isActive(schedule);
+ request.setAttribute("active", active);
+ if (!active) {
+ request.setAttribute("activetill",
schedule.get("active_till"));
+ }
+ }
+
+ if (!isSubmitted(form)) {
+ setupForm(request, form);
+ return getStrutsDelegate().forwardParams(
+ mapping.findForward("default"),
+ request.getParameterMap());
+ }
+
+ RecurringEventPicker picker = RecurringEventPicker.prepopulatePicker(
+ request, "date", null);
+
+ if (picker.isDisabled()) {
+ if (scheduleId == null) {
+ prepDropdowns(ctx);
+ createErrorMessage(request, "message.scheduledisabled", null);
+
+ return getStrutsDelegate().forwardParams(
+ mapping.findForward("default"), params);
+ }
+ return getStrutsDelegate().forwardParams(
+ mapping.findForward("disable"), params);
+ }
+
+ String scheduleName = form.getString("schedulename");
+ String bunchName = form.getString("bunch");
+
+ try {
+ TaskomaticApi tapi = new TaskomaticApi();
+ tapi.scheduleSatBunch(loggedInUser,
+ scheduleName,
+ bunchName,
+ picker.getCronEntry()
+ );
+ if (ctx.hasParam("create_button")) {
+ createSuccessMessage(request, "message.schedulecreated",
scheduleName);
+ }
+ else {
+ createSuccessMessage(request, "message.scheduleupdated",
scheduleName);
+ }
+ Map schedule = tapi.lookupScheduleByBunchAndLabel(loggedInUser, bunchName,
+ scheduleName);
+ params.put("schid", schedule.get("id"));
+ return getStrutsDelegate().forwardParams(
+ mapping.findForward("success"), params);
+ }
+ catch (TaskomaticApiException e) {
+ createErrorMessage(request,
+ "repos.jsp.message.taskomaticdown", null);
+ return getStrutsDelegate().forwardParams(
+ mapping.findForward("default"), params);
+ }
+ }
+
+ private Boolean isActive(Map schedule) {
+ Date till = (Date) schedule.get("active_till");
+ if (till == null) {
+ return Boolean.TRUE;
+ }
+ Date now = new Date();
+ return now.before(till);
+ }
+
+ private void setupForm(HttpServletRequest request, DynaActionForm form) {
+ RequestContext ctx = new RequestContext(request);
+ User loggedInUser = ctx.getLoggedInUser();
+ prepDropdowns(ctx);
+ Long schid = ctx.getParamAsLong("schid");
+
+ if (schid != null) {
+ try {
+ TaskomaticApi tapi = new TaskomaticApi();
+ Map schedule = tapi.lookupScheduleById(loggedInUser, schid);
+ String scheduleName = (String) schedule.get("job_label");
+ String bunchName = (String) schedule.get("bunch");
+ request.setAttribute("schedulename", scheduleName);
+ form.set("schedulename", scheduleName);
+ request.setAttribute("bunch", bunchName);
+ Map bunch = tapi.lookupBunchByName(loggedInUser, bunchName);
+ request.setAttribute("bunchdescription",
(String)bunch.get("description"));
+ RecurringEventPicker.prepopulatePicker(request, "date",
+ (String) schedule.get(("cron_expr")));
+ }
+ catch (TaskomaticApiException e) {
+ createErrorMessage(request,
+ "repos.jsp.message.taskomaticdown", null);
+ }
+ }
+ else {
+ RecurringEventPicker.prepopulatePicker(request, "date", null);
+ }
+ }
+
+ private void prepDropdowns(RequestContext ctx) {
+ User loggedInUser = ctx.getLoggedInUser();
+ // populate parent base channels
+ List dropDown = new ArrayList();
+ try {
+ List<Map> bunches = new
TaskomaticApi().listSatBunchSchedules(loggedInUser);
+
+ for (Map b : bunches) {
+ addOption(dropDown, (String)b.get("name"),
(String)b.get("name"));
+ }
+ }
+ catch (TaskomaticApiException e) {
+ createErrorMessage(ctx.getRequest(),
+ "repos.jsp.message.taskomaticdown", null);
+ }
+ ctx.getRequest().setAttribute("bunches", dropDown);
+ }
+
+ private void addOption(List options, String key, String value) {
+ Map selection = new HashMap();
+ selection.put("label", key);
+ selection.put("value", value);
+ options.add(selection);
+ }
+}
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
index 6ef0227..bafe513 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
@@ -939,6 +939,12 @@
http://www.oasis-open.org/committees/xliff/documents/xliff-core-1.1.xsd&q...
<context context-type="sourcefile">Navigation
Menu</context>
</context-group>
</trans-unit>
+ <trans-unit id="Task Schedules">
+<source>Task Schedules</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">Navigation
Menu</context>
+ </context-group>
+ </trans-unit>
<trans-unit id="Task Engine Status">
<source>Task Engine Status</source>
<context-group name="ctx">
@@ -8648,6 +8654,24 @@ Follow this url to see the full list of inactive systems:
<trans-unit id="message.channelsubscribers">
<source>Per-User subscription restrictions may be applied in the
Subscribers tab</source>
</trans-unit>
+ <trans-unit id="message.bunch.singlescheduled">
+ <source>Single run of <strong>{0}</strong>
bunch was scheduled.</source>
+ </trans-unit>
+ <trans-unit id="message.schedulecreated">
+ <source>Schedule <strong>{0}</strong>
created.</source>
+ </trans-unit>
+ <trans-unit id="message.scheduleupdated">
+ <source>Schedule <strong>{0}</strong> has been
updated.</source>
+ </trans-unit>
+ <trans-unit id="message.scheduledeleted">
+ <source>Schedule <strong>{0}</strong> has been
deleted.</source>
+ </trans-unit>
+ <trans-unit id="message.schedulenotactive">
+ <source>Schedule <strong>{0}</strong> isn't
active any more. It's part of the system just for information purposes and will be
deleted automatically.</source>
+ </trans-unit>
+ <trans-unit id="message.scheduledisabled">
+ <source>Please set frequency for the new schedule.</source>
+ </trans-unit>
<trans-unit id="kickstart.cobbler.profile.invalidvirt">
<source>Para-Virtualization is unsupported with the selected kickstart tree
or distribution.</source>
</trans-unit>
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
index d4233fd..5eee44c 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
@@ -22693,6 +22693,248 @@ given channel.</source>
<context
context-type="sourcefile">/rhn/channels/manage/ConfirmPrivate.do</context>
</context-group>
</trans-unit>
+ <trans-unit id="bunch.edit.jsp.toolbar">
+ <source>Bunch {0}</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.edit.jsp.bunchdescription">
+ <source>Bunch Description</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.edit.jsp.button-schedule">
+ <source>Single Run Schedule</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.jsp.generaldescription">
+ <source>Bellow is the list of runs of the specific bunch type. Several
tasks may be run within a bunch in a predefined order. It's possible to see the
schedule the task was scheduled within by following the start time link. A single run of
the bunch may be scheduled here.</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.jsp.description.daily-status-bunch">
+ <source>Sends daily report</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.jsp.description.clear-taskologs-bunch">
+ <source>Clears taskomatic run log history</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.jsp.description.cobbler-sync-bunch">
+ <source>Applies any cobbler configuration changes</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.jsp.description.compare-configs-bunch">
+ <source>Schedules a comparison of config files on all
systems</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.jsp.description.clean-alerts-bunch">
+ <source>Clears current monitoring alerts</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.jsp.description.sync-probe-bunch">
+ <source>Synchronizes probe state</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.jsp.description.session-cleanup-bunch">
+ <source>Deletes expired rows from the PXTSessions table to keep it from
growing too large</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.jsp.description.sandbox-cleanup-bunch">
+ <source>Cleans up sandbox</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.jsp.description.package-cleanup-bunch">
+ <source>Cleans up orphaned packages</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.jsp.description.kickstartfile-sync-bunch">
+ <source>Synchronizes kickstart profiles that were generated using the
wizard</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.jsp.description.kickstart-cleanup-bunch">
+ <source>Cleans up stale kickstarts</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.jsp.description.errata-queue-bunch">
+ <source>Processes errata</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.jsp.description.errata-cache-bunch">
+ <source>Recalculates errata cache for a given server or
channel</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.jsp.description.channel-repodata-bunch">
+ <source>Generates channel repodata</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.jsp.description.satcert-check-bunch">
+ <source>Checks whether satellite certificate has not
expired</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="bunch.jsp.description.cleanup-data-bunch">
+ <source>Cleans up orphaned and outdated data</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="schedule.jsp.noschedules">
+ <source>There're no schedules available.</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/ScheduleDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="schedule.edit.jsp.introparagraph">
+ <source>You can set a schedule of the selected bunch here.</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/ScheduleDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="schedule.delete.jsp.introparagraph">
+ <source>Are you sure you want to delete the schedule? Associated bunch
won't get scheduled any more. This can have a huge impact on satellite functionality.
Proceed only if you know what you're doing.</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/DeleteSchedule.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="schedule.edit.jsp.toolbar">
+ <source>Schedule {0}</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/ScheduleDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="toolbar.create.schedule">
+ <source>create schedule</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/ScheduleDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="toolbar.delete.schedule">
+ <source>delete schedule</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/ScheduleDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="schedule.edit.jsp.basicscheduledetails">
+ <source>Basic Schedule Details</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/ScheduleDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="schedule.edit.jsp.name">
+ <source>Schedule name</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/ScheduleDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="schedule.edit.jsp.bunch">
+ <source>Bunch</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/SatSchedules.do</context>
+ <context
context-type="sourcefile">/rhn/admin/ScheduleDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="schedule.edit.jsp.bunchdescription">
+ <source>Bunch Description</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/ScheduleDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="schedule.edit.jsp.activefrom">
+ <source>Active From</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/SatSchedules.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="schedule.edit.jsp.activetill">
+ <source>Active Till</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/ScheduleDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="schedule.edit.jsp.notactive">
+ <source>Schedule isn't active any more.</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/ScheduleDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="schedule.edit.jsp.frequency">
+ <source>Frequency</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/SatSchedules.do</context>
+ <context
context-type="sourcefile">/rhn/admin/ScheduleDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="schedule.edit.jsp.createschedule">
+ <source>Create Schedule</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/ScheduleDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="schedule.edit.jsp.editschedule">
+ <source>Edit Schedule</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/ScheduleDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="schedule.delete.jsp.deleteschedule">
+ <source>Delete Schedule</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/DeleteSchedule.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="task.edit.jsp.name">
+ <source>Task Name</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="task.edit.jsp.stattime">
+ <source>Start Time</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="task.edit.jsp.endtime">
+ <source>End Time</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/admin/BunchDetail.do</context>
+ </context-group>
+ </trans-unit>
<trans-unit id="confirmprivate.jsp.confirmmsg">
<source>Are you sure you want to set this channel to
<strong>private</strong>, accessible only by systems
in your
diff --git a/java/code/src/com/redhat/rhn/taskomatic/TaskoFactory.java
b/java/code/src/com/redhat/rhn/taskomatic/TaskoFactory.java
index 1363e49..5686900 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/TaskoFactory.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/TaskoFactory.java
@@ -321,6 +321,30 @@ public class TaskoFactory extends HibernateFactory {
}
/**
+ * lookup schedule by label
+ * @param jobLabel schedule label
+ * @return schedule
+ */
+ public static TaskoSchedule lookupScheduleByLabel(String jobLabel) {
+ Map params = new HashMap();
+ params.put("job_label", jobLabel);
+ return (TaskoSchedule) singleton.lookupObjectByNamedQuery(
+ "TaskoSchedule.lookupByLabel", params);
+ }
+
+ /**
+ * lookup bunch by label
+ * @param bunchName bunch label
+ * @return bunch
+ */
+ public static TaskoBunch lookupBunchByName(String bunchName) {
+ Map params = new HashMap();
+ params.put("name", bunchName);
+ return (TaskoBunch) singleton.lookupObjectByNamedQuery(
+ "TaskoBunch.lookupByName", params);
+ }
+
+ /**
* lists all schedules for an org
* @param orgId organizational id
* @return list of all schedules
@@ -450,6 +474,18 @@ public class TaskoFactory extends HibernateFactory {
return runs;
}
+ /**
+ * lists runs by bunch
+ * @param bunchName bunch name
+ * @return list of runs
+ */
+ public static List<TaskoRun> listRunsByBunch(String bunchName) {
+ Map params = new HashMap();
+ params.put("bunch_name", bunchName);
+ return singleton.listObjectsByNamedQuery(
+ "TaskoRun.listByBunch", params);
+ }
+
private static boolean runBelongToOrg(Integer orgId, TaskoRun run) {
if (orgId == null) {
return (run.getOrgId() == null);
diff --git a/java/code/src/com/redhat/rhn/taskomatic/TaskoRun.hbm.xml
b/java/code/src/com/redhat/rhn/taskomatic/TaskoRun.hbm.xml
index 3c17977..3da3c70 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/TaskoRun.hbm.xml
+++ b/java/code/src/com/redhat/rhn/taskomatic/TaskoRun.hbm.xml
@@ -41,6 +41,10 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<![CDATA[FROM com.redhat.rhn.taskomatic.TaskoRun WHERE scheduleId =
:schedule_id]]>
</query>
+ <query name="TaskoRun.listByBunch">
+ <![CDATA[FROM com.redhat.rhn.taskomatic.TaskoRun WHERE template.bunch.name
= :bunch_name ORDER BY startTime DESC, template.ordering, endTime DESC]]>
+ </query>
+
<query name="TaskoRun.listRunsWithStatus">
<![CDATA[FROM com.redhat.rhn.taskomatic.TaskoRun WHERE template.task.id =
:task_id AND (status = :status1 OR status = :status2)]]>
</query>
diff --git a/java/code/src/com/redhat/rhn/taskomatic/TaskoSchedule.hbm.xml
b/java/code/src/com/redhat/rhn/taskomatic/TaskoSchedule.hbm.xml
index 81b9513..30375d8 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/TaskoSchedule.hbm.xml
+++ b/java/code/src/com/redhat/rhn/taskomatic/TaskoSchedule.hbm.xml
@@ -36,6 +36,10 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<![CDATA[FROM com.redhat.rhn.taskomatic.TaskoSchedule WHERE id =
:schedule_id]]>
</query>
+ <query name="TaskoSchedule.lookupByLabel">
+ <![CDATA[FROM com.redhat.rhn.taskomatic.TaskoSchedule WHERE jobLabel =
:job_label]]>
+ </query>
+
<query name="TaskoSchedule.listOlderThan">
<![CDATA[FROM com.redhat.rhn.taskomatic.TaskoSchedule WHERE activeTill
< :limit_time]]>
</query>
diff --git a/java/code/src/com/redhat/rhn/taskomatic/TaskoXmlRpcHandler.java
b/java/code/src/com/redhat/rhn/taskomatic/TaskoXmlRpcHandler.java
index d9419aa..46776e0 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/TaskoXmlRpcHandler.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/TaskoXmlRpcHandler.java
@@ -58,6 +58,33 @@ public class TaskoXmlRpcHandler {
}
/**
+ * lookup schedule by id
+ * @param scheduleId schedule id
+ * @return schedule
+ */
+ public TaskoSchedule lookupScheduleById(Integer scheduleId) {
+ return TaskoFactory.lookupScheduleById(scheduleId.longValue());
+ }
+
+ /**
+ * lookup schedule by label
+ * @param jobLabel schedule label
+ * @return schedule
+ */
+ public TaskoSchedule lookupScheduleByLabel(String jobLabel) {
+ return TaskoFactory.lookupScheduleByLabel(jobLabel);
+ }
+
+ /**
+ * lookup bunch by label
+ * @param bunchName bunch label
+ * @return bunch
+ */
+ public TaskoBunch lookupBunchByName(String bunchName) {
+ return TaskoFactory.lookupBunchByName(bunchName);
+ }
+
+ /**
* start scheduling a organizational bunch
* @param orgId organization id
* @param bunchName bunch name
@@ -397,6 +424,15 @@ public class TaskoXmlRpcHandler {
}
/**
+ * lists all satellite runs of a give bunch
+ * @param bunchName bunch name
+ * @return list of runs
+ */
+ public List<TaskoRun> listBunchSatRuns(String bunchName) {
+ return TaskoFactory.listRunsByBunch(bunchName);
+ }
+
+ /**
* get last specified number of bytes of the organizational run std output log
* whole log is returned if nBytes is negative
* @param orgId organization id
diff --git a/java/code/src/com/redhat/rhn/taskomatic/TaskomaticApi.java
b/java/code/src/com/redhat/rhn/taskomatic/TaskomaticApi.java
index eebbc03..838d7fd 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/TaskomaticApi.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/TaskomaticApi.java
@@ -15,7 +15,9 @@
package com.redhat.rhn.taskomatic;
import com.redhat.rhn.common.conf.ConfigDefaults;
+import com.redhat.rhn.common.validator.ValidatorException;
import com.redhat.rhn.domain.channel.Channel;
+import com.redhat.rhn.domain.role.RoleFactory;
import com.redhat.rhn.domain.user.User;
import java.net.MalformedURLException;
@@ -115,6 +117,45 @@ public class TaskomaticApi {
scheduleParams);
}
+ /**
+ * Creates a new single satellite schedule
+ * @param user shall be sat admin
+ * @param bunchName bunch name
+ * @return date of the first schedule
+ * @throws TaskomaticApiException if there was an error
+ */
+ public Date scheduleSingleSatBunch(User user, String bunchName)
+ throws TaskomaticApiException {
+ ensureSatAdminRole(user);
+ return (Date) invoke("tasko.scheduleSingleSatBunchRun", bunchName, new
HashMap());
+ }
+
+ private void ensureSatAdminRole(User user) {
+ if (!user.hasRole(RoleFactory.SAT_ADMIN)) {
+
ValidatorException.raiseException("satadmin.jsp.error.notsatadmin",
+ user.getLogin());
+ }
+ }
+
+ /**
+ * Creates a new schedule, unschedules, if en existing is defined
+ * @param user shall be sat admin
+ * @param jobLabel name of the schedule
+ * @param bunchName bunch name
+ * @param cron cron expression
+ * @return date of the first schedule
+ * @throws TaskomaticApiException if there was an error
+ */
+ public Date scheduleSatBunch(User user, String jobLabel, String bunchName, String
cron)
+ throws TaskomaticApiException {
+ ensureSatAdminRole(user);
+ Map task = findSatScheduleByBunchAndLabel(bunchName, jobLabel, user);
+ if (task != null) {
+ unscheduleSatTask(jobLabel, user);
+ }
+ return (Date) invoke("tasko.scheduleSatBunch", bunchName, jobLabel ,
cron,
+ new HashMap());
+ }
/**
* Unchedule a reposync task
@@ -126,10 +167,40 @@ public class TaskomaticApi {
}
private void unscheduleTask(String jobLabel, User user) {
+ ensureSatAdminRole(user);
invoke("tasko.unscheduleBunch", user.getOrg().getId(), jobLabel);
}
+ /**
+ * unschedule satellite task
+ * @param jobLabel schedule name
+ * @param user shall be satellite admin
+ */
+ public void unscheduleSatTask(String jobLabel, User user) {
+ ensureSatAdminRole(user);
+ invoke("tasko.unscheduleSatBunch", jobLabel);
+ }
+
+ /**
+ * Return list of active schedules
+ * @param user shall be sat admin
+ * @return list of schedules
+ */
+ public List findActiveSchedules(User user) {
+ List<Map> schedules = (List<Map>)
invoke("tasko.listActiveSatSchedules");
+ return schedules;
+ }
+ /**
+ * Return list of bunch runs
+ * @param user shall be sat admin
+ * @param bunchName name of the bunch
+ * @return list of schedules
+ */
+ public List findRunsByBunch(User user, String bunchName) {
+ List<Map> runs = (List<Map>)
invoke("tasko.listBunchSatRuns", bunchName);
+ return runs;
+ }
private Map findScheduleByBunchAndLabel(String bunchName, String jobLabel, User user)
{
List<Map> schedules = (List<Map>)
invoke("tasko.listActiveSchedulesByBunch",
@@ -142,6 +213,18 @@ public class TaskomaticApi {
return null;
}
+ private Map findSatScheduleByBunchAndLabel(String bunchName, String jobLabel,
+ User user) {
+ List<Map> schedules = (List<Map>)
invoke("tasko.listActiveSatSchedulesByBunch",
+ bunchName);
+ for (Map schedule : schedules) {
+ if (schedule.get("job_label").equals(jobLabel)) {
+ return schedule;
+ }
+ }
+ return null;
+ }
+
/**
* Get the cron format for a single channel
* @param chan the channel
@@ -159,4 +242,45 @@ public class TaskomaticApi {
}
}
+ /**
+ * Return list of available bunches
+ * @param user shall be sat admin
+ * @return list of bunches
+ */
+ public List listSatBunchSchedules(User user) {
+ List<Map> bunches = (List<Map>)
invoke("tasko.listSatBunches");
+ return bunches;
+ }
+
+ /**
+ * looks up schedule according to id
+ * @param user shall be sat admin
+ * @param scheduleId schedule id
+ * @return schedule
+ */
+ public Map lookupScheduleById(User user, Long scheduleId) {
+ return (Map) invoke("tasko.lookupScheduleById", scheduleId);
+ }
+
+ /**
+ * looks up schedule according to label
+ * @param user shall be sat admin
+ * @param bunchName bunch name
+ * @param scheduleLabel schedule label
+ * @return schedule
+ */
+ public Map lookupScheduleByBunchAndLabel(User user, String bunchName,
+ String scheduleLabel) {
+ return findSatScheduleByBunchAndLabel(bunchName, scheduleLabel, user);
+ }
+
+ /**
+ * looks up bunch according to name
+ * @param user shall be sat admin
+ * @param bunchName bunch name
+ * @return bunch
+ */
+ public Map lookupBunchByName(User user, String bunchName) {
+ return (Map) invoke("tasko.lookupBunchByName", bunchName);
+ }
}
diff --git a/java/code/webapp/WEB-INF/nav/sitenav-authenticated.xml
b/java/code/webapp/WEB-INF/nav/sitenav-authenticated.xml
index 91af90d..805b7a7 100644
--- a/java/code/webapp/WEB-INF/nav/sitenav-authenticated.xml
+++ b/java/code/webapp/WEB-INF/nav/sitenav-authenticated.xml
@@ -288,6 +288,13 @@
</rhn-tab>
</rhn-tab>
+ <rhn-tab name="Task Schedules"
acl="user_role(satellite_admin)">
+ <rhn-tab-url>/rhn/admin/SatSchedules.do</rhn-tab-url>
+ <rhn-tab-url>/rhn/admin/BunchDetail.do</rhn-tab-url>
+ <rhn-tab-url>/rhn/admin/ScheduleDetail.do</rhn-tab-url>
+ <rhn-tab-url>/rhn/admin/DeleteSchedule.do</rhn-tab-url>
+ </rhn-tab>
+
<rhn-tab name="Task Engine Status"
acl="user_role(satellite_admin)" url="/rhn/admin/TaskStatus.do">
</rhn-tab>
diff --git a/java/code/webapp/WEB-INF/pages/admin/bunchDetail.jsp
b/java/code/webapp/WEB-INF/pages/admin/bunchDetail.jsp
new file mode 100644
index 0000000..8ceb73c
--- /dev/null
+++ b/java/code/webapp/WEB-INF/pages/admin/bunchDetail.jsp
@@ -0,0 +1,74 @@
+<%@ taglib
uri="http://struts.apache.org/tags-html" prefix="html"
%>
+<%@ taglib
uri="http://java.sun.com/jsp/jstl/core" prefix="c"
%>
+<%@ taglib
uri="http://rhn.redhat.com/rhn" prefix="rhn" %>
+<%@ taglib
uri="http://struts.apache.org/tags-bean" prefix="bean"
%>
+<%@ taglib
uri="http://rhn.redhat.com/tags/list" prefix="rl"
%>
+
+<html:xhtml/>
+<html>
+<body>
+
+<rhn:toolbar base="h1" img="/img/rhn-icon-your_rhn.gif"
+ imgAlt="channels.overview.toolbar.imgAlt"
+ creationUrl="/rhn/admin/ScheduleDetail.do"
+ creationType="schedule"
+ creationAcl="user_role(satellite_admin)"
+ helpUrl="">
+ <bean:message key="bunch.edit.jsp.toolbar"
arg0="${label}"/>
+</rhn:toolbar>
+
+<rl:listset name="runList">
+
+ <div>
+ <h2><bean:message
key="bunch.edit.jsp.bunchdescription"/></h2>
+ <div class="page-summary">
+ <c:out value="${bunchdescription}"/>
+ </div>
+ <div align="right">
+ <input type="submit" name="dispatch"
+ value="<bean:message
key="bunch.edit.jsp.button-schedule"/>" />
+ <rhn:submitted/>
+ </div>
+ <hr />
+ <br/>
+ <div class="page-summary">
+ <bean:message key="bunch.jsp.generaldescription"/>
+ </div>
+ </div>
+ <br/>
+ <rl:list
+ emptykey="assignedgroups.jsp.nogroups"
+ dataset="dataset" >
+ <rl:decorator name="PageSizeDecorator"/>
+
+ <rl:column sortable="true"
+ bound="false"
+ styleclass="first-column last-column"
+ headerkey="task.edit.jsp.name"
+ sortattr="task" >
+ <c:out value="${current.task}" />
+ </rl:column>
+
+ <rl:column bound="false"
+ headerkey="task.edit.jsp.stattime"
+ sortattr="start_time" >
+ <a
href="/rhn/admin/ScheduleDetail.do?schid=${current.schedule_id}">${current.start_time}</a>
+ </rl:column>
+
+ <rl:column bound="false"
+ headerkey="task.edit.jsp.endtime"
+ sortattr="end_time" >
+ <c:out value="${current.end_time}" />
+ </rl:column>
+
+ <rl:column bound="false"
+ headerkey="kickstart.jsp.status"
+ sortattr="status" >
+ <c:out value="${current.status}" />
+ </rl:column>
+
+</rl:list>
+</rl:listset>
+
+</body>
+</html>
diff --git a/java/code/webapp/WEB-INF/pages/admin/deleteSchedule.jsp
b/java/code/webapp/WEB-INF/pages/admin/deleteSchedule.jsp
new file mode 100644
index 0000000..283647f
--- /dev/null
+++ b/java/code/webapp/WEB-INF/pages/admin/deleteSchedule.jsp
@@ -0,0 +1,66 @@
+<%@ taglib
uri="http://java.sun.com/jsp/jstl/core" prefix="c"
%>
+<%@ taglib
uri="http://rhn.redhat.com/rhn" prefix="rhn" %>
+<%@ taglib
uri="http://struts.apache.org/tags-bean" prefix="bean"
%>
+<%@ taglib
uri="http://struts.apache.org/tags-html" prefix="html"
%>
+
+<html>
+<body>
+<rhn:toolbar base="h1" img="/img/rhn-icon-channels.gif">
+ <bean:message key="schedule.edit.jsp.toolbar"
arg0="${schedulename}"/>
+</rhn:toolbar>
+
+<div>
+ <html:form action="/admin/DeleteSchedule">
+
+ <h2><bean:message
key="schedule.delete.jsp.deleteschedule"/></h2>
+
+ <div class="page-summary">
+ <p><bean:message
key="schedule.delete.jsp.introparagraph"/></p>
+ </div>
+
+ <table class="details">
+ <!-- Channel Name -->
+ <tr>
+ <th nowrap="nowrap">
+ <bean:message key="schedule.edit.jsp.name"/>:
+ </th>
+ <td class="small-form">
+ <strong><c:out
value="${schedulename}"/></strong>
+ </td>
+ </tr>
+
+ <tr>
+ <th nowrap="nowrap">
+ <bean:message key="schedule.edit.jsp.bunch"/>:
+ </th>
+ <td class="small-form">
+ <c:out value="${bunch}"/>
+ </td>
+ </tr>
+ <c:if test="${cronexpr}">
+ <tr>
+ <th nowrap="nowrap">
+ <bean:message
key="schedule.edit.jsp.frequency"/>
+ </th>
+ <td class="small-form">
+ <c:out value="${cronexpr}"/>
+ </td>
+ </tr>
+ </c:if>
+ </table>
+
+ <div align="right">
+ <hr/>
+ <html:submit property="edit_button">
+ <bean:message key="schedule.delete.jsp.deleteschedule"/>
+ </html:submit>
+ </div>
+ <html:hidden property="submitted" value="true"/>
+ <c:if test='${not empty param.schid}'>
+ <html:hidden property="schid"
value="${param.schid}"/>
+ </c:if>
+ </html:form>
+</div>
+
+</body>
+</html>
diff --git a/java/code/webapp/WEB-INF/pages/admin/scheduleDetail.jsp
b/java/code/webapp/WEB-INF/pages/admin/scheduleDetail.jsp
new file mode 100644
index 0000000..2aa6ffe
--- /dev/null
+++ b/java/code/webapp/WEB-INF/pages/admin/scheduleDetail.jsp
@@ -0,0 +1,128 @@
+<%@ taglib
uri="http://java.sun.com/jsp/jstl/core" prefix="c"
%>
+<%@ taglib
uri="http://rhn.redhat.com/rhn" prefix="rhn" %>
+<%@ taglib
uri="http://struts.apache.org/tags-bean" prefix="bean"
%>
+<%@ taglib
uri="http://struts.apache.org/tags-html" prefix="html"
%>
+
+<html>
+<body>
+<rhn:toolbar base="h1" img="/img/rhn-icon-channels.gif"
+ deletionUrl="/rhn/admin/DeleteSchedule.do?schid=${param.schid}"
+ deletionAcl="user_role(satellite_admin); formvar_exists(schid)"
+ deletionType="schedule">
+ <bean:message key="schedule.edit.jsp.toolbar"
arg0="${schedulename}"/>
+</rhn:toolbar>
+
+<div>
+ <html:form action="/admin/ScheduleDetail">
+
+ <h2><bean:message
key="schedule.edit.jsp.basicscheduledetails"/></h2>
+ <div class="page-summary">
+ <c:if test="${active}">
+ <bean:message key="schedule.edit.jsp.introparagraph"/>
+ </c:if>
+ <c:if test="${not active}">
+ <bean:message key="schedule.edit.jsp.notactive"/>
+ </c:if>
+ </div>
+
+ <br/>
+
+ <table class="details">
+ <tr>
+ <th nowrap="nowrap">
+ <label for="joblabel"><rhn:required-field
key="schedule.edit.jsp.name"/>:</label>
+ </th>
+ <td class="small-form">
+ <c:choose>
+ <c:when test='${empty param.schid}'>
+ <html:text property="schedulename" maxlength="256"
size="48" styleId="name"/>
+ </c:when>
+ <c:otherwise>
+ <c:out value="${schedulename}"/>
+ </c:otherwise>
+ </c:choose>
+ </td>
+ </tr>
+ <tr>
+ <th nowrap="nowrap">
+ <label for="bunch"><rhn:required-field
key="schedule.edit.jsp.bunch"/>:</label>
+ </th>
+ <td class="small-form">
+ <c:choose>
+ <c:when test='${empty param.schid}'>
+ <html:select property="bunch" >
+ <html:options collection="bunches"
+ property="value"
+ labelProperty="label" />
+ </html:select>
+ </c:when>
+ <c:otherwise>
+ <a
href="/rhn/admin/BunchDetail.do?label=${bunch}">${bunch}</a>
+ </c:otherwise>
+ </c:choose>
+ <html:hidden property="bunch" value="${bunch}" />
+ </td>
+ </tr>
+ <c:if test="${empty param.schid or active}">
+ <tr>
+ <th nowrap="nowrap">
+ <label for="parent"><bean:message
key="schedule.edit.jsp.frequency"/>:</label>
+ </th>
+ <td class="small-form">
+ <jsp:include
page="/WEB-INF/pages/common/fragments/repeat-task-picker.jspf">
+ <jsp:param name="widget" value="date"/>
+ </jsp:include>
+ </td>
+ </tr>
+ </c:if>
+ <c:if test="${not active}">
+ <c:if test="${cron}">
+ <tr>
+ <th nowrap="nowrap">
+ <bean:message key="schedule.edit.jsp.frequency"/>
+ </th>
+ <td class="small-form">
+ <c:out value="${cronexpr}"/>
+ </td>
+ </tr>
+ </c:if>
+ <c:if test='${not empty param.schid}'>
+ <tr>
+ <th nowrap="nowrap">
+ <bean:message key="schedule.edit.jsp.activetill"/>:
+ </th>
+ <td class="small-form">
+ <c:out value="${activetill}"/>
+ </td>
+ </tr>
+ </c:if>
+ </c:if>
+ </table>
+
+ <div align="right">
+ <hr />
+ <c:choose>
+ <c:when test='${empty param.schid}'>
+ <html:submit property="create_button">
+ <bean:message key="schedule.edit.jsp.createschedule"/>
+ </html:submit>
+ </c:when>
+ <c:otherwise>
+ <c:if test="${active}">
+ <html:submit property="edit_button">
+ <bean:message key="schedule.edit.jsp.editschedule"/>
+ </html:submit>
+ </c:if>
+ </c:otherwise>
+ </c:choose>
+ </div>
+
+ <html:hidden property="submitted" value="true" />
+ <c:if test='${not empty param.schid}'>
+ <html:hidden property="schid" value="${param.schid}" />
+ </c:if>
+</html:form>
+</div>
+
+</body>
+</html>
diff --git a/java/code/webapp/WEB-INF/pages/admin/schedules.jsp
b/java/code/webapp/WEB-INF/pages/admin/schedules.jsp
new file mode 100644
index 0000000..976a815
--- /dev/null
+++ b/java/code/webapp/WEB-INF/pages/admin/schedules.jsp
@@ -0,0 +1,57 @@
+<%@ taglib
uri="http://struts.apache.org/tags-html" prefix="html"
%>
+<%@ taglib
uri="http://java.sun.com/jsp/jstl/core" prefix="c"
%>
+<%@ taglib
uri="http://rhn.redhat.com/rhn" prefix="rhn" %>
+<%@ taglib
uri="http://struts.apache.org/tags-bean" prefix="bean"
%>
+<%@ taglib
uri="http://rhn.redhat.com/tags/list" prefix="rl"
%>
+
+<html:xhtml/>
+<html>
+<body>
+
+<rhn:toolbar base="h1" img="/img/rhn-icon-your_rhn.gif"
+ imgAlt="channels.overview.toolbar.imgAlt"
+ creationUrl="/rhn/admin/ScheduleDetail.do"
+ creationType="schedule"
+ creationAcl="user_role(satellite_admin)"
+ helpUrl="">
+ <bean:message key="task.status.title"/>
+</rhn:toolbar>
+
+<rl:listset name="scheduleList">
+
+ <rl:list
+ emptykey="schedule.jsp.noschedules">
+
+ <rl:decorator name="PageSizeDecorator"/>
+
+ <rl:column sortable="true"
+ bound="false"
+ styleclass="first-column last-column"
+ headerkey="schedule.edit.jsp.name"
+ sortattr="job_label"
+ defaultsort="asc" >
+ <a
href="/rhn/admin/ScheduleDetail.do?schid=${current.id}">${current.job_label}</a>
+ </rl:column>
+
+ <rl:column bound="false"
+ headerkey="schedule.edit.jsp.frequency" >
+ <c:out value="${current.cron_expr}" />
+ </rl:column>
+
+ <rl:column sortable="true"
+ bound="false"
+ headerkey="schedule.edit.jsp.activefrom"
+ sortattr="active_from" >
+ <c:out value="${current.active_from}" />
+ </rl:column>
+
+ <rl:column bound="false"
+ headerkey="schedule.edit.jsp.bunch" >
+ <a
href="/rhn/admin/BunchDetail.do?label=${current.bunch}">${current.bunch}</a>
+ </rl:column>
+
+</rl:list>
+</rl:listset>
+
+</body>
+</html>
diff --git a/java/code/webapp/WEB-INF/struts-config.xml
b/java/code/webapp/WEB-INF/struts-config.xml
index 7747926..7a841a7 100644
--- a/java/code/webapp/WEB-INF/struts-config.xml
+++ b/java/code/webapp/WEB-INF/struts-config.xml
@@ -1134,6 +1134,14 @@
<form-property name="submitted" type="java.lang.Boolean"
/>
</form-bean>
+ <form-bean name="updateTaskSchedule"
+ type="com.redhat.rhn.frontend.struts.ScrubbingDynaActionForm"
>
+ <form-property name="schedulename" type="java.lang.String"
/>
+ <form-property name="bunch" type="java.lang.String" />
+ <form-property name="cronexpr" type="java.lang.String"
/>
+ <form-property name="submitted" type="java.lang.Boolean"
/>
+ </form-bean>
+
</form-beans>
<global-exceptions>
@@ -7249,8 +7257,46 @@
type="com.redhat.rhn.frontend.action.satellite.TaskStatusAction">
<forward name="default"
path="/WEB-INF/pages/admin/taskStatus.jsp" />
- <forward name="confirm"
- path="/ssm/Packages.do"/>
+ </action>
+
+ <action path="/admin/SatSchedules"
+ scope="request"
+ input="/WEB-INF/pages/admin/schedules.jsp"
+ type="com.redhat.rhn.frontend.action.tasko.SatSchedulesAction">
+ <forward name="default"
+ path="/WEB-INF/pages/admin/schedules.jsp" />
+ </action>
+
+ <action path="/admin/ScheduleDetail"
+ scope="request"
+ name="updateTaskSchedule"
+ input="/WEB-INF/pages/admin/scheduleDetail.jsp"
+ type="com.redhat.rhn.frontend.action.tasko.ScheduleDetailAction">
+ <forward name="default"
+ path="/WEB-INF/pages/admin/scheduleDetail.jsp" />
+ <forward name="disable"
+ path="/admin/DeleteSchedule.do" redirect="true"
/>
+ <forward name="success"
+ path="/admin/ScheduleDetail.do" redirect="true"
/>
+ </action>
+
+ <action path="/admin/DeleteSchedule"
+ scope="request"
+ name="updateTaskSchedule"
+ input="/WEB-INF/pages/admin/deleteSchedule.jsp"
+ type="com.redhat.rhn.frontend.action.tasko.DeleteScheduleAction">
+ <forward name="default"
+ path="/WEB-INF/pages/admin/deleteSchedule.jsp" />
+ <forward name="success"
+ path="/admin/SatSchedules.do" redirect="true" />
+ </action>
+
+ <action path="/admin/BunchDetail"
+ scope="request"
+ input="/WEB-INF/pages/admin/bunchDetail.jsp"
+ type="com.redhat.rhn.frontend.action.tasko.BunchDetailAction">
+ <forward name="default"
+ path="/WEB-INF/pages/admin/bunchDetail.jsp" />
</action>
</action-mappings>