Skip to content

Commit 00fe129

Browse files
author
ole.wellnitz@iteratec.de
committed
[IT-2637] Add hidden input with active status again after setting new next execution time
1 parent 69b654c commit 00fe129

File tree

2 files changed

+51
-49
lines changed

2 files changed

+51
-49
lines changed

grails-app/assets/javascripts/job/jobListFilter.js

Lines changed: 1 addition & 1 deletion
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -197,7 +197,7 @@ OpenSpeedMonitor.jobListFilter = (function () {
197
};
197
};
198

198

199
var showOnlyFiltersMatchRow = function (row) {
199
var showOnlyFiltersMatchRow = function (row) {
200-
var isMatch = !showOnlyCheckboxes.showOnlyActive.isChecked || !(row.find(".job_active").val() === "false");
200+
var isMatch = !showOnlyCheckboxes.showOnlyActive.isChecked || row.find(".job_active").val() === "true";
201
isMatch = isMatch && (!showOnlyCheckboxes.showOnlyHighlighted.isChecked || row.hasClass("highlight"));
201
isMatch = isMatch && (!showOnlyCheckboxes.showOnlyHighlighted.isChecked || row.hasClass("highlight"));
202
isMatch = isMatch && (!showOnlyCheckboxes.showOnlyChecked.isChecked || row.find(".jobCheckbox").prop("checked"));
202
isMatch = isMatch && (!showOnlyCheckboxes.showOnlyChecked.isChecked || row.find(".jobCheckbox").prop("checked"));
203
isMatch = isMatch && (!showOnlyCheckboxes.showOnlyRunning.isChecked || row.find(".running").length > 0);
203
isMatch = isMatch && (!showOnlyCheckboxes.showOnlyRunning.isChecked || row.find(".running").length > 0);
Lines changed: 50 additions & 48 deletions
Original file line numberOriginal file lineDiff line numberDiff line change
@@ -1,50 +1,52 @@
1-
FutureOnlyTimeago = function() {
1+
FutureOnlyTimeago = function () {
2-
var nextExecutionServerUrl = '';
2+
var nextExecutionServerUrl = '';
3-
var timeouts = [];
3+
var timeouts = [];
4-
5-
jQuery.timeago.settings.allowFuture = true;
6-
7-
function futureHandler(cronExpression, elem, parentElem) {
8-
delete FutureOnlyTimeago.timeouts[elem];
9-
jQuery.ajax({
10-
type: 'POST',
11-
url: FutureOnlyTimeago.nextExecutionServerUrl,
12-
data: { value: cronExpression, noprepend: true },
13-
success : function(newNextExecutionHtml) {
14-
// replace past date with new template
15-
$(parentElem).html(newNextExecutionHtml);
16-
var newElem = $('abbr.timeago', parentElem);
17-
makeFutureOnlyTimeago(newElem);
18-
}
19-
});
20-
};
21

4

22-
function makeFutureOnlyTimeago(elem) {
5+
jQuery.timeago.settings.allowFuture = true;
23-
var fromNowInMs = $(elem).attr('data-date-diff-ms');
6+
24-
var cronExpression = $(elem).attr('data-cronstring');
7+
function futureHandler(cronExpression, elem, parentElem) {
25-
var parentElem = $(elem).parent();
8+
delete FutureOnlyTimeago.timeouts[elem];
26-
9+
jQuery.ajax({
27-
if (cronExpression && fromNowInMs < 1000 * 60 * 60 * 24 * 7) {
10+
type: 'POST',
28-
var updateTimeout = setTimeout(futureHandler.bind(this, cronExpression, elem, parentElem), fromNowInMs);
11+
url: FutureOnlyTimeago.nextExecutionServerUrl,
29-
FutureOnlyTimeago.timeouts[elem] = updateTimeout;
12+
data: {value: cronExpression, noprepend: true},
30-
13+
success: function (newNextExecutionHtml) {
31-
// cut off second as PrettyCron can only handle Cron expressions where minutes are the smallest unit
14+
// replace past date with new template
32-
//var prettyCronString = prettyCron.toString(cronExpression.substr(cronExpression.indexOf(' ') + 1));
15+
var active = $('input.job_active', parentElem);
33-
//$(parentElem).append('(<abbr class="cronExpression">' + prettyCronString + '</abbr>)');
16+
$(parentElem).html(newNextExecutionHtml);
34-
}
17+
$(parentElem).append(active);
35-
$(elem).timeago();
18+
var newElem = $('abbr.timeago', parentElem);
36-
}
19+
makeFutureOnlyTimeago(newElem);
37-
20+
}
38-
// ${createLink(action: 'nextExecution')}
21+
});
39-
function initializeTimeagos(timeagos, nextExecutionServerUrl) {
22+
};
40-
this.nextExecutionServerUrl = nextExecutionServerUrl;
23+
41-
this.timeouts = [];
24+
function makeFutureOnlyTimeago(elem) {
42-
$.each(timeagos, function (index, elem) {
25+
var fromNowInMs = $(elem).attr('data-date-diff-ms');
43-
makeFutureOnlyTimeago(elem);
26+
var cronExpression = $(elem).attr('data-cronstring');
44-
});
27+
var parentElem = $(elem).parent();
45-
}
28+
46-
29+
if (cronExpression && fromNowInMs < 1000 * 60 * 60 * 24 * 7) {
47-
return {
30+
var updateTimeout = setTimeout(futureHandler.bind(this, cronExpression, elem, parentElem), fromNowInMs);
48-
init: initializeTimeagos
31+
FutureOnlyTimeago.timeouts[elem] = updateTimeout;
49-
}
32+
33+
// cut off second as PrettyCron can only handle Cron expressions where minutes are the smallest unit
34+
//var prettyCronString = prettyCron.toString(cronExpression.substr(cronExpression.indexOf(' ') + 1));
35+
//$(parentElem).append('(<abbr class="cronExpression">' + prettyCronString + '</abbr>)');
36+
}
37+
$(elem).timeago();
38+
}
39+
40+
// ${createLink(action: 'nextExecution')}
41+
function initializeTimeagos(timeagos, nextExecutionServerUrl) {
42+
this.nextExecutionServerUrl = nextExecutionServerUrl;
43+
this.timeouts = [];
44+
$.each(timeagos, function (index, elem) {
45+
makeFutureOnlyTimeago(elem);
46+
});
47+
}
48+
49+
return {
50+
init: initializeTimeagos
51+
}
50
}();
52
}();

0 commit comments

Comments
 (0)