Fix styling

This commit is contained in:
Thijmen
2024-06-10 20:43:34 +00:00
committed by github-actions[bot]
parent 41fb6a1fc9
commit d86274cc37
429 changed files with 5307 additions and 2831 deletions

View File

@@ -15,15 +15,21 @@ class DeploymentFailed extends Notification implements ShouldQueue
use Queueable;
public $tries = 1;
public Application $application;
public ?ApplicationPreview $preview = null;
public string $deployment_uuid;
public string $application_name;
public string $project_uuid;
public string $environment_name;
public ?string $deployment_url = null;
public ?string $fqdn = null;
public function __construct(Application $application, string $deployment_uuid, ?ApplicationPreview $preview = null)
@@ -38,7 +44,7 @@ class DeploymentFailed extends Notification implements ShouldQueue
if (Str::of($this->fqdn)->explode(',')->count() > 1) {
$this->fqdn = Str::of($this->fqdn)->explode(',')->first();
}
$this->deployment_url = base_url() . "/project/{$this->project_uuid}/" . urlencode($this->environment_name) . "/application/{$this->application->uuid}/deployment/{$this->deployment_uuid}";
$this->deployment_url = base_url()."/project/{$this->project_uuid}/".urlencode($this->environment_name)."/application/{$this->application->uuid}/deployment/{$this->deployment_uuid}";
}
public function via(object $notifiable): array
@@ -52,10 +58,10 @@ class DeploymentFailed extends Notification implements ShouldQueue
$pull_request_id = data_get($this->preview, 'pull_request_id', 0);
$fqdn = $this->fqdn;
if ($pull_request_id === 0) {
$mail->subject('Coolify: Deployment failed of ' . $this->application_name . '.');
$mail->subject('Coolify: Deployment failed of '.$this->application_name.'.');
} else {
$fqdn = $this->preview->fqdn;
$mail->subject('Coolify: Deployment failed of pull request #' . $this->preview->pull_request_id . ' of ' . $this->application_name . '.');
$mail->subject('Coolify: Deployment failed of pull request #'.$this->preview->pull_request_id.' of '.$this->application_name.'.');
}
$mail->view('emails.application-deployment-failed', [
'name' => $this->application_name,
@@ -63,35 +69,39 @@ class DeploymentFailed extends Notification implements ShouldQueue
'deployment_url' => $this->deployment_url,
'pull_request_id' => data_get($this->preview, 'pull_request_id', 0),
]);
return $mail;
}
public function toDiscord(): string
{
if ($this->preview) {
$message = 'Coolify: Pull request #' . $this->preview->pull_request_id . ' of ' . $this->application_name . ' (' . $this->preview->fqdn . ') deployment failed: ';
$message .= '[View Deployment Logs](' . $this->deployment_url . ')';
$message = 'Coolify: Pull request #'.$this->preview->pull_request_id.' of '.$this->application_name.' ('.$this->preview->fqdn.') deployment failed: ';
$message .= '[View Deployment Logs]('.$this->deployment_url.')';
} else {
$message = 'Coolify: Deployment failed of ' . $this->application_name . ' (' . $this->fqdn . '): ';
$message .= '[View Deployment Logs](' . $this->deployment_url . ')';
$message = 'Coolify: Deployment failed of '.$this->application_name.' ('.$this->fqdn.'): ';
$message .= '[View Deployment Logs]('.$this->deployment_url.')';
}
return $message;
}
public function toTelegram(): array
{
if ($this->preview) {
$message = 'Coolify: Pull request #' . $this->preview->pull_request_id . ' of ' . $this->application_name . ' (' . $this->preview->fqdn . ') deployment failed: ';
$message = 'Coolify: Pull request #'.$this->preview->pull_request_id.' of '.$this->application_name.' ('.$this->preview->fqdn.') deployment failed: ';
} else {
$message = 'Coolify: Deployment failed of ' . $this->application_name . ' (' . $this->fqdn . '): ';
$message = 'Coolify: Deployment failed of '.$this->application_name.' ('.$this->fqdn.'): ';
}
$buttons[] = [
"text" => "Deployment logs",
"url" => $this->deployment_url
'text' => 'Deployment logs',
'url' => $this->deployment_url,
];
return [
"message" => $message,
"buttons" => [
...$buttons
'message' => $message,
'buttons' => [
...$buttons,
],
];
}

View File

@@ -15,18 +15,24 @@ class DeploymentSuccess extends Notification implements ShouldQueue
use Queueable;
public $tries = 1;
public Application $application;
public ApplicationPreview|null $preview = null;
public ?ApplicationPreview $preview = null;
public string $deployment_uuid;
public string $application_name;
public string $project_uuid;
public string $environment_name;
public ?string $deployment_url = null;
public ?string $fqdn;
public function __construct(Application $application, string $deployment_uuid, ApplicationPreview|null $preview = null)
public function __construct(Application $application, string $deployment_uuid, ?ApplicationPreview $preview = null)
{
$this->application = $application;
$this->deployment_uuid = $deployment_uuid;
@@ -38,7 +44,7 @@ class DeploymentSuccess extends Notification implements ShouldQueue
if (Str::of($this->fqdn)->explode(',')->count() > 1) {
$this->fqdn = Str::of($this->fqdn)->explode(',')->first();
}
$this->deployment_url = base_url() . "/project/{$this->project_uuid}/" . urlencode($this->environment_name) . "/application/{$this->application->uuid}/deployment/{$this->deployment_uuid}";
$this->deployment_url = base_url()."/project/{$this->project_uuid}/".urlencode($this->environment_name)."/application/{$this->application->uuid}/deployment/{$this->deployment_uuid}";
}
public function via(object $notifiable): array
@@ -48,8 +54,10 @@ class DeploymentSuccess extends Notification implements ShouldQueue
// TODO: Make batch notifications work with email
$channels = array_diff($channels, ['App\Notifications\Channels\EmailChannel']);
}
return $channels;
}
public function toMail(): MailMessage
{
$mail = new MailMessage();
@@ -67,57 +75,61 @@ class DeploymentSuccess extends Notification implements ShouldQueue
'deployment_url' => $this->deployment_url,
'pull_request_id' => $pull_request_id,
]);
return $mail;
}
public function toDiscord(): string
{
if ($this->preview) {
$message = 'Coolify: New PR' . $this->preview->pull_request_id . ' version successfully deployed of ' . $this->application_name . '
$message = 'Coolify: New PR'.$this->preview->pull_request_id.' version successfully deployed of '.$this->application_name.'
';
if ($this->preview->fqdn) {
$message .= '[Open Application](' . $this->preview->fqdn . ') | ';
$message .= '[Open Application]('.$this->preview->fqdn.') | ';
}
$message .= '[Deployment logs](' . $this->deployment_url . ')';
$message .= '[Deployment logs]('.$this->deployment_url.')';
} else {
$message = 'Coolify: New version successfully deployed of ' . $this->application_name . '
$message = 'Coolify: New version successfully deployed of '.$this->application_name.'
';
if ($this->fqdn) {
$message .= '[Open Application](' . $this->fqdn . ') | ';
$message .= '[Open Application]('.$this->fqdn.') | ';
}
$message .= '[Deployment logs](' . $this->deployment_url . ')';
$message .= '[Deployment logs]('.$this->deployment_url.')';
}
return $message;
}
public function toTelegram(): array
{
if ($this->preview) {
$message = 'Coolify: New PR' . $this->preview->pull_request_id . ' version successfully deployed of ' . $this->application_name . '';
$message = 'Coolify: New PR'.$this->preview->pull_request_id.' version successfully deployed of '.$this->application_name.'';
if ($this->preview->fqdn) {
$buttons[] = [
"text" => "Open Application",
"url" => $this->preview->fqdn
'text' => 'Open Application',
'url' => $this->preview->fqdn,
];
}
} else {
$message = '✅ New version successfully deployed of ' . $this->application_name . '';
$message = '✅ New version successfully deployed of '.$this->application_name.'';
if ($this->fqdn) {
$buttons[] = [
"text" => "Open Application",
"url" => $this->fqdn
'text' => 'Open Application',
'url' => $this->fqdn,
];
}
}
$buttons[] = [
"text" => "Deployment logs",
"url" => $this->deployment_url
'text' => 'Deployment logs',
'url' => $this->deployment_url,
];
return [
"message" => $message,
"buttons" => [
...$buttons
'message' => $message,
'buttons' => [
...$buttons,
],
];
}

View File

@@ -16,10 +16,13 @@ class StatusChanged extends Notification implements ShouldQueue
public $tries = 1;
public string $resource_name;
public string $project_uuid;
public string $environment_name;
public ?string $resource_url = null;
public ?string $fqdn;
public function __construct(public Application $resource)
@@ -31,7 +34,7 @@ class StatusChanged extends Notification implements ShouldQueue
if (Str::of($this->fqdn)->explode(',')->count() > 1) {
$this->fqdn = Str::of($this->fqdn)->explode(',')->first();
}
$this->resource_url = base_url() . "/project/{$this->project_uuid}/" . urlencode($this->environment_name) . "/application/{$this->resource->uuid}";
$this->resource_url = base_url()."/project/{$this->project_uuid}/".urlencode($this->environment_name)."/application/{$this->resource->uuid}";
}
public function via(object $notifiable): array
@@ -49,27 +52,31 @@ class StatusChanged extends Notification implements ShouldQueue
'fqdn' => $fqdn,
'resource_url' => $this->resource_url,
]);
return $mail;
}
public function toDiscord(): string
{
$message = 'Coolify: ' . $this->resource_name . ' has been stopped.
$message = 'Coolify: '.$this->resource_name.' has been stopped.
';
$message .= '[Open Application in Coolify](' . $this->resource_url . ')';
$message .= '[Open Application in Coolify]('.$this->resource_url.')';
return $message;
}
public function toTelegram(): array
{
$message = 'Coolify: ' . $this->resource_name . ' has been stopped.';
$message = 'Coolify: '.$this->resource_name.' has been stopped.';
return [
"message" => $message,
"buttons" => [
'message' => $message,
'buttons' => [
[
"text" => "Open Application in Coolify",
"url" => $this->resource_url
]
'text' => 'Open Application in Coolify',
'url' => $this->resource_url,
],
],
];
}