NEW FEATURE: added host label

This commit is contained in:
Jeroen De Meerleer 2022-08-18 14:02:31 +02:00
parent ff2797820c
commit 35aed5a469
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
7 changed files with 26 additions and 1 deletions

View File

@ -617,6 +617,7 @@ class JobRepository extends EntityRepository
$job->setData('containertype', $values['containertype']);
$job->setData('fail-pct', !empty($values['fail-pct']) ? (int)$values['fail-pct'] : 50);
$job->setData('fail-days', !empty($values['fail-days']) ? (int)$values['fail-days'] : 7);
$job->setData('hostlabel', !empty($values['hostlabel']) ? $values['hostlabel'] : '');
if(!$job->hasData('crontype')) {
throw new \InvalidArgumentException("Crontype cannot be empty");

View File

@ -61,6 +61,12 @@
</div>
</div>
<div class="mb-3">
<label for="retention">{{ "job.addedit.generalinfo.hostlabel.label" | trans }}</label>
<input type="text" name="hostlabel" class="form-control" id="hostlabel" placeholder="{{ "job.addedit.generalinfo.hostlabel.placeholder" | trans }}">
<small id="hostlabel-help" class="form-text text-muted">{{ "job.addedit.generalinfo.hostlabel.helptext" | trans }}</small>
</div>
<div class="mb-3">
<label for="fail-days">{{ "job.addedit.generalinfo.faildays.label" | trans }}</label>
<input type="number" name="fail-days" class="form-control" id="fail-days" placeholder="{{ "job.addedit.generalinfo.faildays.placeholder" | trans }}">

View File

@ -62,6 +62,12 @@
<input type="number" name="fail-days" class="form-control" id="fail-days" placeholder="{{ 'job.addedit.generalinfo.faildays.placeholder' | trans }}" value="{% if attribute(job.data, 'fail-days') is defined %}{{ attribute(job.data, 'fail-days') }}{% endif %}">
</div>
<div class="mb-3">
<label for="hostlabel">{{ 'job.addedit.generalinfo.hostlabel.label' | trans }}</label>
<input type="text" name="hostlabel" class="form-control" id="hostlabel" placeholder="{{ 'job.addedit.generalinfo.hostlabel.placeholder' | trans }}" value="{% if attribute(job.data, 'hostlabel') is defined %}{{ attribute(job.data, 'hostlabel') }}{% endif %}">
<small id="hostlabel-help" class="form-text text-muted">{{ 'job.addedit.generalinfo.hostlabel.helptext' | trans }}</small>
</div>
<h3>Job details</h3>
<div class="mb-3 btn-group croncategory-selector">
<div class="dropdown croncategory-group crontype-group{% if job.data.crontype != 'http' %} btn-group{% endif %}">

View File

@ -21,7 +21,7 @@
<td class="d-block d-md-table-cell align-middle job-name">
<span class="d-inline d-md-none">{% if job.data.needschecking %}<i class="icon icon-warning text-warning"></i>{% endif %}</span>
{{ job.name | parsetags | raw }}</td>
<td class="d-block d-md-table-cell align-middle">{{ attribute(job.data, 'host-displayname') }}</td>
<td class="d-block d-md-table-cell align-middle">{% if job.data.hostlabel is defined and job.data.hostlabel is not empty %}{{ job.data.hostlabel }}{% else %}{{ attribute(job.data, 'host-displayname') }}{% endif %}</td>
<td class="d-block d-md-table-cell align-middle">{{ job.interval | interval }}</td>
<td class="d-block d-md-table-cell align-middle">{{ job.nextrun | date("d/m/Y H:i:s") }}</td>
<td class="text-md-end d-block d-md-table-cell align-middle">

View File

@ -93,6 +93,10 @@ job:
faildays:
label: "Numb3r 0f d4yz c4LcuL4t3d 4 f41L p3rc3nt4g3"
placeholder: "7"
hostlabel:
label: "H0st l4b3L"
placeholder: "N3wb13 s3rv3r"
helptext: "Wh1ch l4b3L 4 t3h h0stn4m3 sh0uLd b d1spL4y3d? 1f 3mpty t3h d1z w1LL b t3h h0stn4m3 pr0v1d3d b3L0w"
crontype:
label: "J0b typ3"
command:

View File

@ -93,6 +93,10 @@ job:
faildays:
label: "Number of days calculated for fail percentage"
placeholder: "7"
hostlabel:
label: "Host label"
placeholder: "petrosian.jeroened.be"
helptext: "Which label for the hostname should be displayed? If empty the this will be the hostname provided below"
crontype:
label: "Job type"
command:

View File

@ -94,6 +94,10 @@ job:
faildays:
label: "Aantal dagen berekend voor faalpercentage"
placeholder: "7"
hostlabel:
label: "Host label"
placeholder: "petrosian.jeroened.be"
helptext: "Geef hier een eenvoudig te herkennen hostnaam. Indien leeg zal hostnaam uit de job details gebruikt worden"
crontype:
label: "Taak type"
command: