azkaban-aplcache
Changes
src/web/js/azkaban.flow.view.js 25(+21 -4)
Details
diff --git a/src/java/azkaban/scheduler/LocalFileScheduleLoader.java b/src/java/azkaban/scheduler/LocalFileScheduleLoader.java
index ffc6aad..a81f27f 100644
--- a/src/java/azkaban/scheduler/LocalFileScheduleLoader.java
+++ b/src/java/azkaban/scheduler/LocalFileScheduleLoader.java
@@ -47,7 +47,7 @@ import azkaban.utils.JSONUtils;
*
*/
public class LocalFileScheduleLoader implements ScheduleLoader {
- private static final String SCHEDULEID = "schedule";
+ private static final String SCHEDULEID = "scheduleId";
private static final String USER = "user";
private static final String USERSUBMIT = "userSubmit";
private static final String SUBMITTIME = "submitTime";
diff --git a/src/java/azkaban/scheduler/ScheduledFlow.java b/src/java/azkaban/scheduler/ScheduledFlow.java
index 38c94b3..25b80f4 100644
--- a/src/java/azkaban/scheduler/ScheduledFlow.java
+++ b/src/java/azkaban/scheduler/ScheduledFlow.java
@@ -111,7 +111,7 @@ public class ScheduledFlow {
this.submitTime = submitTime;
this.firstSchedTime = firstSchedTime;
this.period = period;
- this.nextExecTime = new DateTime();
+ this.nextExecTime = new DateTime(firstSchedTime);
// this.schedStatus = SchedStatus.LASTSUCCESS;
}
diff --git a/src/java/azkaban/webapp/servlet/ScheduleServlet.java b/src/java/azkaban/webapp/servlet/ScheduleServlet.java
index 376bb0d..b000573 100644
--- a/src/java/azkaban/webapp/servlet/ScheduleServlet.java
+++ b/src/java/azkaban/webapp/servlet/ScheduleServlet.java
@@ -88,7 +88,7 @@ public class ScheduleServlet extends LoginAbstractAzkabanServlet {
String flowId = getParam(req, "flowId");
Project project = projectManager.getProject(projectId);
-
+
if (project == null) {
ret.put("message", "Project " + projectId + " does not exist");
ret.put("status", "error");
@@ -108,19 +108,19 @@ public class ScheduleServlet extends LoginAbstractAzkabanServlet {
return;
}
-// int hour = getIntParam(req, "hour");
-// int minutes = getIntParam(req, "minutes");
-// boolean isPm = getParam(req, "am_pm").equalsIgnoreCase("pm");
- int hour = 0;
- int minutes = 0;
- boolean isPm = false;
+ int hour = getIntParam(req, "hour");
+ int minutes = getIntParam(req, "minutes");
+ boolean isPm = getParam(req, "am_pm").equalsIgnoreCase("pm");
+// int hour = 0;
+// int minutes = 0;
+// boolean isPm = false;
String scheduledDate = req.getParameter("date");
DateTime day = null;
if(scheduledDate == null || scheduledDate.trim().length() == 0) {
day = new LocalDateTime().toDateTime();
} else {
try {
- day = DateTimeFormat.forPattern("MM-dd-yyyy").parseDateTime(scheduledDate);
+ day = DateTimeFormat.forPattern("MM/dd/yyyy").parseDateTime(scheduledDate);
} catch(IllegalArgumentException e) {
ret.put("error", "Invalid date: '" + scheduledDate + "'");
return;
@@ -153,10 +153,8 @@ public class ScheduleServlet extends LoginAbstractAzkabanServlet {
private ReadablePeriod parsePeriod(HttpServletRequest req) throws ServletException {
-// int period = getIntParam(req, "period");
-// String periodUnits = getParam(req, "period_units");
- int period = 10;
- String periodUnits = "m";
+ int period = getIntParam(req, "period");
+ String periodUnits = getParam(req, "period_units");
if("d".equals(periodUnits))
return Days.days(period);
else if("h".equals(periodUnits))
diff --git a/src/java/azkaban/webapp/servlet/velocity/flowpage.vm b/src/java/azkaban/webapp/servlet/velocity/flowpage.vm
index a916d1c..aa5f899 100644
--- a/src/java/azkaban/webapp/servlet/velocity/flowpage.vm
+++ b/src/java/azkaban/webapp/servlet/velocity/flowpage.vm
@@ -4,6 +4,7 @@
#parse( "azkaban/webapp/servlet/velocity/style.vm" )
<script type="text/javascript" src="${context}/js/jquery/jquery.js"></script>
<script type="text/javascript" src="${context}/js/jqueryui/jquery-ui.custom.min.js"></script>
+ <script type="text/javascript" src="${context}/js/jqueryui/jquery.ui.datepicker.min.js"></script>
<script type="text/javascript" src="${context}/js/azkaban.date.utils.js"></script>
<script type="text/javascript" src="${context}/js/namespace.js"></script>
<script type="text/javascript" src="${context}/js/underscore-1.2.1-min.js"></script>
@@ -25,6 +26,11 @@
var projectName = "${project.name}";
var flowName = "${flowid}";
</script>
+ <script>
+ $(function() {
+ $( "#datepicker" ).datepicker();
+ });
+ </script>
<link rel="stylesheet" type="text/css" href="${context}/css/jquery.contextMenu.custom.css" />
</head>
<body>
@@ -109,7 +115,7 @@
</div>
<!-- modal content -->
<div id="schedule-flow" class="modal">
- <h3>Schedule A Flow</h3>
+ <h3>Schedulemm A Flow</h3>
<div id="errorMsg" class="box-error-message">$errorMsg</div>
<div class="message">
@@ -126,10 +132,47 @@
</fieldset>
</div>
+ <div class="box">
+ <form id="sched-form" method="post" action="${context}/">
+ <div class="sched-form">
+ <div>
+ <!input type="hidden" name="action" value="schedule"/-->
+ Schedule to run at
+ <input id="hour" type="text" size="2" value="12"/> :
+ <input id="minutes" type="text" size="2" value="00"/>
+ <select id="am_pm">
+ <option>pm</option>
+ <option>am</option>
+ </select>
+ $timezone
+ on
+ <br>
+ <p>Date: <input type="text" id="datepicker"></p>
+ <!--input class="scheduled_date" type="text" name="date" size="10" value="$currentDate.format("dd/M/yy h:mm tt")"/-->
+ and
+ <br>
+ <input id="is_recurring" type="checkbox" checked />
+ repeat every
+ <input id="period" type="text" size="2" value="1"/>
+ <select id="period_units">
+ <option value="d">Days</option>
+ <option value="h">Hours</option>
+ <option value="m">Minutes</option>
+ <option value="s">Seconds</option>
+ </select>
+ <!--input type="submit" name="schedule" value="Schedule"/-->
+ </div>
+ </div>
+
+ </form>
+ </div>
+
+
<div class="actions">
<a class="yes btn3" id="schedule-btn" href="#">Schedule The Flow</a>
<a class="no simplemodal-close btn4" href="#">Cancel</a>
</div>
+
<div id="invalid-session" class="modal">
<h3>Invalid Session</h3>
<p>Session has expired. Please re-login.</p>
src/web/js/azkaban.flow.view.js 25(+21 -4)
diff --git a/src/web/js/azkaban.flow.view.js b/src/web/js/azkaban.flow.view.js
index 7fe381a..85165de 100644
--- a/src/web/js/azkaban.flow.view.js
+++ b/src/web/js/azkaban.flow.view.js
@@ -865,8 +865,16 @@ azkaban.ScheduleFlowView = Backbone.View.extend({
},
handleScheduleFlow : function(evt) {
// First make sure we can upload
- //var projectName = $('#path').val();
- //var description = $('#description').val();
+// var projectName = $('#path').val();
+ var description = $('#description').val();
+
+ var hourVal = $('#hour').val();
+ var minutesVal = $('#minutes').val();
+ var ampmVal = $('#am_pm').val();
+ var dateVal = $('#datepicker').val();
+ var is_recurringVal = $('#is_recurring').val();
+ var periodVal = $('#period').val();
+ var periodUnits = $('#period_units').val();
console.log("Creating schedule");
$.ajax({
@@ -876,18 +884,27 @@ azkaban.ScheduleFlowView = Backbone.View.extend({
type: "POST",
data: {
action:"scheduleFlow",
+
projectId:projectName,
flowId:flowName,
+ hour:hourVal,
+ minutes:minutesVal,
+ am_pm:ampmVal,
+ date:dateVal,
userExec:"dummy",
- is_recurring:true
+ is_recurring:is_recurringVal,
+ period:periodVal,
+ period_units:periodUnits
},
success: function(data) {
if (data.status == "success") {
if (data.action == "redirect") {
- window.location = data.path;
+ //window.location = data.path;
+ window.loaction = contextURL + "/manager?project=" + projectName + "&flow=" + flowName ;
}
else{
$("#errorMsg").text("Flow " + projectName + "." + flowName + " scheduled!" );
+ window.location = contextURL + "/manager?project=" + projectName + "&flow=" + flowName ;
}
}
else {