add ability to configure scheduled task time limit

This commit is contained in:
Luke Pulverenti 2015-03-05 13:54:04 -05:00
parent 2fd4d6247f
commit ecd1311a59
2 changed files with 27 additions and 1 deletions

View File

@ -62,7 +62,7 @@
</li>
<li id="fldSelectInterval">
<label for="selectInterval">${LabelEveryXMinutes}</label>
<select id="selectInterval" name="selectInterval">
<select id="selectInterval">
<option value="9000000000">15 minutes</option>
<option value="18000000000">30 minutes</option>
<option value="27000000000">45 minutes</option>
@ -75,6 +75,10 @@
<option value="432000000000">12 hours</option>
</select>
</li>
<li>
<label for="txtTimeLimit">${LabelTimeLimitHours}</label>
<input id="txtTimeLimit" type="number" pattern="[0-9]*" min="1" step=".5" />
</li>
<li>
<button type="submit" data-theme="b" data-icon="check">
${ButtonAdd}

View File

@ -40,7 +40,24 @@
html += '<li>';
html += '<a href="#">';
html += '<h3>';
html += ScheduledTaskPage.getTriggerFriendlyName(trigger);
html += '</h3>';
if (trigger.MaxRuntimeMs) {
html += '<p>';
var hours = trigger.MaxRuntimeMs / 3600000;
if (hours == 1) {
html += Globalize.translate('ValueTimeLimitSingleHour');
} else {
html += Globalize.translate('ValueTimeLimitMultiHour', hours);
}
html += '</p>';
}
html += '</a>';
html += '<a href="#" onclick="ScheduledTaskPage.confirmDeleteTrigger(' + i + ');">';
@ -278,6 +295,11 @@
trigger.IntervalTicks = $('#selectInterval', page).val();
}
var timeLimit = $('#txtTimeLimit', page).val() || '0';
timeLimit = parseFloat(timeLimit) * 3600000;
trigger.MaxRuntimeMs = timeLimit || null;
return trigger;
},