Add a hydra.conf option to enable email notification

Note that it's disabled by default.
This commit is contained in:
Eelco Dolstra 2018-03-12 13:52:36 +01:00
parent c0fac52872
commit 02888105a8
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
4 changed files with 9 additions and 2 deletions

View file

@ -47,6 +47,8 @@ sub jobset_GET {
$c->stash->{totalShares} = getTotalShares($c->model('DB')->schema);
$c->stash->{emailNotification} = $c->config->{email_notification} // 0;
$self->status_ok($c, entity => $c->stash->{jobset});
}
@ -173,6 +175,7 @@ sub edit : Chained('jobsetChain') PathPart Args(0) {
$c->stash->{edit} = !defined $c->stash->{params}->{cloneJobset};
$c->stash->{cloneJobset} = defined $c->stash->{params}->{cloneJobset};
$c->stash->{totalShares} = getTotalShares($c->model('DB')->schema);
$c->stash->{emailNotification} = $c->config->{email_notification} // 0;
}

View file

@ -44,6 +44,8 @@ EOF
sub buildFinished {
my ($self, $build, $dependents) = @_;
return unless $self->{config}->{email_notification} // 0;
die unless $build->finished;
# Figure out to whom to send notification for each build. For

View file

@ -130,7 +130,7 @@
<div class="control-group">
<div class="controls">
<label class="checkbox">
<input type="checkbox" name="enableemail" [% IF jobset.enableemail; 'checked="checked"'; END %]/>Email notification
<input type="checkbox" name="enableemail" [% IF jobset.enableemail; 'checked="checked"'; END %] [%IF !emailNotification%]disabled=1[%END%] />Email notification
</label>
</div>
</div>
@ -138,7 +138,7 @@
<div class="control-group">
<label class="control-label">Email override</label>
<div class="controls">
<input type="text" class="span3" name="emailoverride" [% HTML.attributes(value => jobset.emailoverride) %]/>
<input type="text" class="span3" name="emailoverride" [% HTML.attributes(value => jobset.emailoverride) %] [%IF !emailNotification%]disabled=1[%END%] />
</div>
</div>

View file

@ -148,6 +148,7 @@
<th>Scheduling shares:</th>
<td>[% jobset.schedulingshares %] [% IF totalShares %] ([% f = format("%.2f"); f(jobset.schedulingshares / totalShares * 100) %]% out of [% totalShares %] shares)[% END %]</td>
</tr>
[% IF emailNotification %]
<tr>
<th>Enable email notification:</th>
<td>[% jobset.enableemail ? "Yes" : "No" %]</td>
@ -156,6 +157,7 @@
<th>Email override:</th>
<td>[% HTML.escape(jobset.emailoverride) %]</td>
</tr>
[% END %]
<tr>
<th>Number of evaluations to keep:</th>
<td>[% jobset.keepnr %]</td>