PHRAS-3738 Admin - worker - job tab - add filter on databox_id (name),record_id (#4132)

* add databox and record id filter

* add entry count

* generate translation

* fix retrieve count in DB

* change string position
This commit is contained in:
Aina Sitraka
2022-09-16 11:18:07 +03:00
committed by GitHub
parent 6fa89c5bf8
commit 2d71cffe46
11 changed files with 458 additions and 298 deletions

View File

@@ -106,6 +106,8 @@ class AdminConfigurationController extends Controller
$reload = ($request->query->get('reload') == 1);
$jobType = $request->query->get('jobType');
$databoxId = empty($request->query->get('databoxId')) ? null : $request->query->get('databoxId');
$recordId = empty($request->query->get('recordId')) ? null : $request->query->get('recordId');
$filterStatus = [];
@@ -122,7 +124,16 @@ class AdminConfigurationController extends Controller
$filterStatus[] = WorkerRunningJob::INTERRUPT;
}
$workerRunningJob = $repoWorker->findByStatusAndJob($filterStatus, $jobType);
$workerRunningJob = $repoWorker->findByFilter($filterStatus, $jobType, $databoxId, $recordId);
$workerRunningJobTotalCount = $repoWorker->getJobCount($filterStatus, $jobType, $databoxId, $recordId);
// get all row count in the table WorkerRunningJob
$totalCount = $repoWorker->getJobCount([], null, null , null);
$databoxIds = array_map(function (\databox $databox) {
return $databox->get_sbas_id();
},
$this->app->getApplicationBox()->get_databoxes()
);
$types = AMQPConnection::MESSAGES;
@@ -131,11 +142,28 @@ class AdminConfigurationController extends Controller
$jobTypes = array_keys($types);
return $this->render('admin/worker-manager/worker_info.html.twig', [
'workerRunningJob' => $workerRunningJob,
'reload' => $reload,
'jobTypes' => $jobTypes
]);
if ($reload) {
return $this->app->json(['content' => $this->render('admin/worker-manager/worker_info.html.twig', [
'workerRunningJob' => $workerRunningJob,
'reload' => $reload,
'jobTypes' => $jobTypes,
'databoxIds' => $databoxIds,
]),
'resultCount' => count($workerRunningJob),
'resultTotal' => $workerRunningJobTotalCount,
'totalCount' => $totalCount
]);
} else {
return $this->render('admin/worker-manager/worker_info.html.twig', [
'workerRunningJob' => $workerRunningJob,
'reload' => $reload,
'jobTypes' => $jobTypes,
'databoxIds' => $databoxIds,
'resultCount' => count($workerRunningJob),
'resultTotal' => $workerRunningJobTotalCount,
'totalCount' => $totalCount
]);
}
}
/**