Add one-shot jobsets

There are jobsets that are evaluated only once, that is, after they've
been evaluated, they're disabled automatically.  This is primarily
useful for doing releases: for instance, doing an evaluation with
"officialRelease" set to "true" should be done only once.
This commit is contained in:
Eelco Dolstra
2013-10-11 12:01:52 +02:00
parent 0babdf3532
commit c4e39d4769
9 changed files with 36 additions and 19 deletions

View File

@ -49,11 +49,18 @@
<fieldset>
<div class="control-group">
<label class="control-label">State</label>
<div class="controls">
<label class="checkbox">
<input type="checkbox" name="enabled" [% IF jobset.enabled; 'checked="checked"'; END %]/>Enabled
</label>
<div class="btn-group" data-toggle="buttons-radio">
<input type="hidden" name="enabled" value="[% jobset.enabled %]" />
<button type="button" class="btn" value="1">Enabled</button>
<button type="button" class="btn" value="2">One-shot</button>
<button type="button" class="btn" value="0">Disabled</button>
</div>
</div>
</div>
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" name="visible" [% IF !jobset.hidden; 'checked="checked"'; END %]/>Visible

View File

@ -116,6 +116,10 @@
<div id="tabs-configuration" class="tab-pane">
<table class="info-table">
<tr>
<th>State:</th>
<td>[% IF jobset.enabled == 0; "Disabled"; ELSIF jobset.enabled == 1; "Enabled"; ELSIF jobset.enabled == 2; "One-shot"; END %]</td>
</tr>
<tr>
<th>Description:</th>
<td>[% HTML.escape(jobset.description) %]</td>
@ -127,10 +131,6 @@
<tt>[% HTML.escape(jobset.nixexprinput) %]</tt>
</td>
</tr>
<tr>
<th>Enabled:</th>
<td>[% jobset.enabled ? "Yes" : "No" %]</td>
</tr>
<tr>
<th>Check interval:</th>
<td>[% jobset.checkinterval || "<em>disabled</em>" %]</td>

View File

@ -69,7 +69,17 @@ $(document).ready(function() {
var id = e.target.toString().match(pattern)[0];
history.replaceState(null, "", id);
});
})
});
/* Automatically set Bootstrap radio buttons from hidden form controls. */
$('div[data-toggle="buttons-radio"] input[type="hidden"]').map(function(){
$('button[value="' + $(this).val() + '"]', $(this).parent()).addClass('active');
});
/* Automatically update hidden form controls from Bootstrap radio buttons. */
$('div[data-toggle="buttons-radio"] .btn').click(function(){
$('input', $(this).parent()).val($(this).val());
});
});
var tabsLoaded = {};