Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Version 6.2.0
* add stream exceptions management

# Version 6.1.2
* Fix BillingAddressComparator

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
}
},
"require": {
"php": "^8.3",
"php": "^8.4",
"ext-json": "*",
"code-rhapsodie/dataflow-bundle": "^5.6.0",
"code-rhapsodie/dataflow-bundle": "^6.0",
"guzzlehttp/promises": "^2.2",
"http-interop/http-factory-guzzle": "^1.2",
"ibexa/admin-ui": "^5.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private function getPager(QueryBuilder $query, Request $request, string $class =

if ($class === Job::class && !$this->exceptionHandler instanceof NullExceptionHandler) {
$adapter = new TransformingAdapter($adapter, function (array $value) {
$value['exceptions'] = $this->exceptionHandler->find((int) $value['id']) ?? [];
$value['exceptions'] = $this->exceptionHandler->find((int) $value['id']);

return $value;
});
Expand Down
10 changes: 10 additions & 0 deletions src/Controller/JobController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
Expand Down Expand Up @@ -43,6 +44,15 @@ public function displayLog(int $id): Response
$item = $this->jobGateway->find($id);
$log = array_map(fn($line) => preg_replace('~#\d+~', "\n$0", (string) $line), $item->getExceptions() ?? []);

if (empty($log) && $item->getStreamExceptions()) {
return new StreamedResponse(function () use ($item) {
while (($line = fgets($item->getStreamExceptions())) !== false) {
echo "<p>",preg_replace('~#\d+~', "<br>$0", (string) $line),"</p>";
flush();
}
});
}

return $this->render('@ibexadesign/ibexa_dataflow/Item/log.html.twig', [
'log' => $log,
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
{content: job.label},
{content: date(job.requested_date)|ibexa_short_datetime},
{content: job.count is not null ? job.count|format_number(locale: app.request.locale) : '—'},
{content: job.exceptions|length|format_number(locale: app.request.locale)},
{content: (job.exception_count is not null ? job.exception_count : job.exceptions|length)|format_number(locale: app.request.locale)},
{content: job.start_time ? date(job.start_time)|ibexa_short_datetime : '—'},
{content: job.end_time ? date(job.end_time)|ibexa_short_datetime : '—'},
{content: macros.translateStatus(job.status)},
Expand Down