Skip to content

Commit 00986d8

Browse files
committed
Universal Actions / Limits: Add some additional crash protection in case the configuration is invalid.
Future: Do a full validation pass on these on startup and when the configuration is reloaded.
1 parent bd89e20 commit 00986d8

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

htdocs/js/pages/Events.class.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ Page.Events = class Events extends Page.PageUtils {
10251025
// add universal actions (not hidden)
10261026
var temp_event_type = this.workflow ? 'workflow' : 'default';
10271027
config.job_universal_actions[temp_event_type].forEach( function(action) {
1028-
if (action.enabled && !action.hidden) rows.push({ ...action, source: 'universal' });
1028+
if (action.enabled && action.condition && !action.hidden) rows.push({ ...action, source: 'universal' });
10291029
} );
10301030

10311031
html += this.getCompactGrid(targs, function(item, idx) {
@@ -1076,7 +1076,7 @@ Page.Events = class Events extends Page.PageUtils {
10761076
// add universal limits (not hidden)
10771077
var temp_event_type = this.workflow ? 'workflow' : 'default';
10781078
config.job_universal_limits[temp_event_type].forEach( function(limit) {
1079-
if (limit.enabled && !limit.hidden) rows.push({ ...limit, source: 'universal' });
1079+
if (limit.enabled && limit.type && !limit.hidden) rows.push({ ...limit, source: 'universal' });
10801080
} );
10811081

10821082
html += this.getCompactGrid(targs, function(item, idx) {

lib/job.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ class Jobs {
101101

102102
if (!job.test || (job.test && job.test_actions)) {
103103
this.config.getPath('job_universal_actions.' + temp_job_type).forEach( function(action) {
104-
if (action.enabled) job.actions.push( Tools.mergeHashes( Tools.copyHash(action, true), { source: 'universal' } ) );
104+
if (action.enabled && action.condition) job.actions.push( Tools.mergeHashes( Tools.copyHash(action, true), { source: 'universal' } ) );
105105
} );
106106
}
107107
if (!job.test || (job.test && job.test_limits)) {
108108
this.config.getPath('job_universal_limits.' + temp_job_type).forEach( function(limit) {
109-
if (limit.enabled) job.limits.push( Tools.mergeHashes( Tools.copyHash(limit, true), { source: 'universal' } ) );
109+
if (limit.enabled && limit.type) job.limits.push( Tools.mergeHashes( Tools.copyHash(limit, true), { source: 'universal' } ) );
110110
} );
111111
}
112112

0 commit comments

Comments
 (0)