Files
DatBrowser/app/Notification/Notifications/JobDebugNotification.php
Matthias Guillitte fec63ff249
Some checks failed
Push image to registry / build-image (push) Failing after 3m41s
Added Debug notifications
2025-03-02 10:03:27 +01:00

41 lines
1.3 KiB
PHP

<?php
namespace App\Notification\Notifications;
use App\Browser\JobDebugScreenshot;
use App\Notification\Notification;
use App\Notification\NotificationBody\JobDebugNotificationBody;
use App\Notification\Stringifiable;
use App\Notification\Stringifiable\StringifiableSimpleText;
class JobDebugNotification extends Notification {
private string|null $title;
private string|null $screenShotProjectPath;
public function __construct(int $jobId, string $body, string $title = null, string $error = null, string $screenshotProjectPath = JobDebugScreenshot::getImgFileProjectPath($jobId), bool $isError = false) {
parent::__construct($jobId, isError:$isError);
$this->title = $title;
$this->screenShotProjectPath = $screenshotProjectPath;
$this->setBody(new JobDebugNotificationBody($this->job, $this->title, $body, $error, $this->screenShotProjectPath != null));
}
public function getTitle(): Stringifiable {
return new StringifiableSimpleText($this->title ?? "DEBUG Job {$this->job->name}");
}
/**
* @inheritDoc
*/
public function getImageProjectPath(): string|null {
return $this->screenShotProjectPath;
}
/**
* @inheritDoc
*/
public function getLinkURL(): string|null {
return route('jobs.show', ['job' => $this->job->id]);
}
}