fix: stopping a resource is now job based
ui: show status on project
This commit is contained in:
@@ -15,25 +15,23 @@ class StatusChanged extends Notification implements ShouldQueue
|
||||
|
||||
public $tries = 1;
|
||||
|
||||
public Application $application;
|
||||
public string $application_name;
|
||||
public string $resource_name;
|
||||
public string $project_uuid;
|
||||
public string $environment_name;
|
||||
|
||||
public ?string $application_url = null;
|
||||
public ?string $resource_url = null;
|
||||
public ?string $fqdn;
|
||||
|
||||
public function __construct($application)
|
||||
public function __construct(public Application $resource)
|
||||
{
|
||||
$this->application = $application;
|
||||
$this->application_name = data_get($application, 'name');
|
||||
$this->project_uuid = data_get($application, 'environment.project.uuid');
|
||||
$this->environment_name = data_get($application, 'environment.name');
|
||||
$this->fqdn = data_get($application, 'fqdn', null);
|
||||
$this->resource_name = data_get($resource, 'name');
|
||||
$this->project_uuid = data_get($resource, 'environment.project.uuid');
|
||||
$this->environment_name = data_get($resource, 'environment.name');
|
||||
$this->fqdn = data_get($resource, 'fqdn', null);
|
||||
if (Str::of($this->fqdn)->explode(',')->count() > 1) {
|
||||
$this->fqdn = Str::of($this->fqdn)->explode(',')->first();
|
||||
}
|
||||
$this->application_url = base_url() . "/project/{$this->project_uuid}/{$this->environment_name}/application/{$this->application->uuid}";
|
||||
$this->resource_url = base_url() . "/project/{$this->project_uuid}/{$this->environment_name}/application/{$this->resource->uuid}";
|
||||
}
|
||||
|
||||
public function via(object $notifiable): array
|
||||
@@ -45,32 +43,32 @@ class StatusChanged extends Notification implements ShouldQueue
|
||||
{
|
||||
$mail = new MailMessage();
|
||||
$fqdn = $this->fqdn;
|
||||
$mail->subject("Coolify: {$this->application_name} has been stopped");
|
||||
$mail->subject("Coolify: {$this->resource_name} has been stopped");
|
||||
$mail->view('emails.application-status-changes', [
|
||||
'name' => $this->application_name,
|
||||
'name' => $this->resource_name,
|
||||
'fqdn' => $fqdn,
|
||||
'application_url' => $this->application_url,
|
||||
'resource_url' => $this->resource_url,
|
||||
]);
|
||||
return $mail;
|
||||
}
|
||||
|
||||
public function toDiscord(): string
|
||||
{
|
||||
$message = 'Coolify: ' . $this->application_name . ' has been stopped.
|
||||
$message = 'Coolify: ' . $this->resource_name . ' has been stopped.
|
||||
|
||||
';
|
||||
$message .= '[Open Application in Coolify](' . $this->application_url . ')';
|
||||
$message .= '[Open Application in Coolify](' . $this->resource_url . ')';
|
||||
return $message;
|
||||
}
|
||||
public function toTelegram(): array
|
||||
{
|
||||
$message = 'Coolify: ' . $this->application_name . ' has been stopped.';
|
||||
$message = 'Coolify: ' . $this->resource_name . ' has been stopped.';
|
||||
return [
|
||||
"message" => $message,
|
||||
"buttons" => [
|
||||
[
|
||||
"text" => "Open Application in Coolify",
|
||||
"url" => $this->application_url
|
||||
"url" => $this->resource_url
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user