refresh working info

This commit is contained in:
aynsix
2020-05-18 17:38:04 +03:00
parent 11b8ca7953
commit bfb2b7723a
2 changed files with 29 additions and 4 deletions

View File

@@ -69,8 +69,11 @@ class AdminConfigurationController extends Controller
/** @var WorkerRunningJobRepository $repoWorker */
$repoWorker = $app['repo.worker-running-job'];
$reload = ($request->query->get('reload')) == 1 ? true : false ;
return $this->render('admin/worker-manager/worker_info.html.twig', [
'workerRunningJob' => $repoWorker->findAll()
'workerRunningJob' => $repoWorker->findAll(),
'reload' => $reload
]);
}

View File

@@ -1,3 +1,5 @@
{% if not reload %}
<h1> worker information</h1>
<form action="{{ path("worker_admin_truncate") }}" method="POST">
@@ -32,7 +34,9 @@
<th class="sortable">status</th>
</tr>
</thead>
<tbody>
<tbody class="work-list">
{% endif %}
{% for workerRow in workerRunningJob %}
<tr>
<td>{{ workerRow.databoxId }}</td>
@@ -45,5 +49,23 @@
</tr>
{% endfor %}
{% if not reload %}
</tbody>
</table>
<script>
setInterval(function () {
if ($('.worker-info').hasClass('active')) {
$.ajax({
type: "GET",
url: "/admin/worker-manager/info?reload=1",
success: function (data) {
$(".work-list").empty().html(data);
}
});
}
}, 5000
);
</script>
{% endif %}