Added notification on job fail
All checks were successful
Push image to registry / build-image (push) Successful in 5m20s
All checks were successful
Push image to registry / build-image (push) Successful in 5m20s
This commit is contained in:
37
app/Notification/Notifications/JobErrorNotification.php
Normal file
37
app/Notification/Notifications/JobErrorNotification.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Notification\Notifications;
|
||||
|
||||
use App\Browser\JobErrorScreenshot;
|
||||
use App\Models\Job;
|
||||
use App\Notification\Notification;
|
||||
use App\Notification\NotificationBody\JobErrorNotificationBody;
|
||||
use App\Notification\Stringifiable;
|
||||
use App\Notification\Stringifiable\StringifiableSimpleText;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class JobErrorNotification extends Notification {
|
||||
|
||||
public function __construct(int $jobId, string $error) {
|
||||
parent::__construct($jobId, isError:true);
|
||||
$this->setBody(new JobErrorNotificationBody($this->job, $error));
|
||||
}
|
||||
|
||||
public function getTitle(): Stringifiable {
|
||||
return new StringifiableSimpleText("Le job {$this->job->name} a échoué");
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getImageProjectPath(): string|null {
|
||||
return JobErrorScreenshot::getImgFileProjectPath($this->job->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getLinkURL(): string|null {
|
||||
return route('jobs.show', ['job' => $this->job->id]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user