ENHANCEMENT: changing status, if status changes
This commit is contained in:
parent
13608ce06b
commit
c1782c26e2
|
@ -35,6 +35,20 @@ function initRunNowButtons() {
|
|||
modal.find('.modal-title').html(data.title);
|
||||
if (data.status == 'deferred') {
|
||||
modal.find('.modal-body').html(data.message);
|
||||
me.addClass('disabled');
|
||||
|
||||
let td = me.parents('td');
|
||||
td.find('.btn').each(function() {
|
||||
let btn = $(this);
|
||||
btn.addClass('btn-outline-success');
|
||||
btn.removeClass('btn-outline-primary');
|
||||
btn.removeClass('btn-outline-danger');
|
||||
})
|
||||
|
||||
|
||||
let tr = me.parents('tr');
|
||||
tr.addClass('running');
|
||||
tr.removeClass('norun');
|
||||
} else if (data.status == 'ran') {
|
||||
let content = '<p>Cronjob ran in ' + data.runtime.toFixed(3) + ' seconds with exit code ' + data.exitcode +'</p>'
|
||||
content += '<pre>' + data.output + '</pre>'
|
||||
|
|
|
@ -145,11 +145,11 @@ class Job extends Repository
|
|||
|
||||
private function runLocalCommand(string $command): array
|
||||
{
|
||||
pcntl_signal(SIGCHLD, SIG_DFL);
|
||||
if(function_exists('pcntl_signal')) pcntl_signal(SIGCHLD, SIG_DFL);
|
||||
$return['exitcode'] = NULL;
|
||||
$return['output'] = NULL;
|
||||
exec($command . ' 2>&1', $return['output'], $return['exitcode']);
|
||||
pcntl_signal(SIGCHLD, SIG_IGN);
|
||||
if(function_exists('pcntl_signal'))pcntl_signal(SIGCHLD, SIG_IGN);
|
||||
$return['output'] = implode("\n", $return['output']);
|
||||
return $return;
|
||||
}
|
||||
|
|
|
@ -15,16 +15,16 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
{% for job in jobs %}
|
||||
<tr{% if job.norun == true %} class="norun"{% elseif job.running == true %} class="running"{% endif %}>
|
||||
<tr{% if job.running == true %} class="running"{% elseif job.norun == true %} class="norun"{% endif %}>
|
||||
<td class="d-block d-md-table-cell">{{ job.name }}</td>
|
||||
<td class="d-block d-md-table-cell">{{ attribute(job, 'host-displayname') }}</td>
|
||||
<td class="d-block d-md-table-cell">{{ job.interval | interval }}</td>
|
||||
<td class="d-block d-md-table-cell">{{ job.nextrun | date("d/m/Y H:i:s") }}</td>
|
||||
<td class="text-md-right d-block d-md-table-cell">
|
||||
<a href="#" data-href="{{ path('job_runnow', {'id': job.id}) }}" class="runnow btn btn-outline-{% if job.norun == true %}danger{% elseif job.running == true %}success{% else %}primary{% endif %}{% if job.running == true %} disabled{% endif %}"><i class="fa fa-play" aria-hidden="true"></i></a>
|
||||
<a href="{{ path('job_view', {'id': job.id}) }}" class="btn btn-outline-{% if job.norun == true %}danger{% elseif job.running == true %}success{% else %}primary{% endif %}"><i class="fa fa-search" aria-hidden="true"></i></a>
|
||||
<a href="{{ path('job_edit', {'id': job.id}) }}" class="btn btn-outline-{% if job.norun == true %}danger{% elseif job.running == true %}success{% else %}primary{% endif %}"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>
|
||||
<a href="#" data-confirmation="Are you sure you want to delete this job?" data-href="{{ path('job_delete', {'id': job.id}) }}" class="delete-btn btn btn-outline-{% if job.norun == true %}danger{% elseif job.running == true %}success{% else %}primary{% endif %}"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
|
||||
<a href="#" data-href="{{ path('job_runnow', {'id': job.id}) }}" class="runnow btn btn-outline-{% if job.running == true %}success{% elseif job.norun == true %}danger{% else %}primary{% endif %}{% if job.running == true %} disabled{% endif %}"><i class="fa fa-play" aria-hidden="true"></i></a>
|
||||
<a href="{{ path('job_view', {'id': job.id}) }}" class="btn btn-outline-{% if job.running == true %}success{% elseif job.norun == true %}danger{% else %}primary{% endif %}"><i class="fa fa-search" aria-hidden="true"></i></a>
|
||||
<a href="{{ path('job_edit', {'id': job.id}) }}" class="btn btn-outline-{% if job.running == true %}success{% elseif job.norun == true %}danger{% else %}primary{% endif %}"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></a>
|
||||
<a href="#" data-confirmation="Are you sure you want to delete this job?" data-href="{{ path('job_delete', {'id': job.id}) }}" class="delete-btn btn btn-outline-{% if job.running == true %}success{% elseif job.norun == true %}danger{% else %}primary{% endif %}"><i class="fa fa-trash-o" aria-hidden="true"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
Loading…
Reference in New Issue