Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: server view for link()

Andras Bacsai0670e6c1d632
diff --git a/app/Models/Application.php b/app/Models/Application.php
index e2d93c7a13..0a9c8fac80 100644
--- a/app/Models/Application.php
+++ b/app/Models/Application.php
@@ -50,11 +50,14 @@ class Application extends BaseModel
}
public function link()
{
- return route('project.application.configuration', [
- 'project_uuid' => $this->environment->project->uuid,
- 'environment_name' => $this->environment->name,
- 'application_uuid' => $this->uuid
- ]);
+ if (data_get($this, 'environment.project.uuid')) {
+ return route('project.application.configuration', [
+ 'project_uuid' => data_get($this, 'environment.project.uuid'),
+ 'environment_name' => data_get($this, 'environment.name'),
+ 'application_uuid' => data_get($this, 'uuid')
+ ]);
+ }
+ return null;
}
public function settings()
{
diff --git a/app/Models/Service.php b/app/Models/Service.php
index 3a02ed560e..b5842bb882 100644
--- a/app/Models/Service.php
+++ b/app/Models/Service.php
@@ -363,11 +363,14 @@ class Service extends BaseModel
}
public function link()
{
- return route('project.service.configuration', [
- 'project_uuid' => $this->environment->project->uuid,
- 'environment_name' => $this->environment->name,
- 'service_uuid' => $this->uuid
- ]);
+ if (data_get($this, 'environment.project.uuid')) {
+ return route('project.service.configuration', [
+ 'project_uuid' => data_get($this, 'environment.project.uuid'),
+ 'environment_name' => data_get($this, 'environment.name'),
+ 'service_uuid' => data_get($this, 'uuid')
+ ]);
+ }
+ return null;
}
public function documentation()
{
diff --git a/app/Models/StandaloneMariadb.php b/app/Models/StandaloneMariadb.php
index ca7221d7cf..8893632d3a 100644
--- a/app/Models/StandaloneMariadb.php
+++ b/app/Models/StandaloneMariadb.php
@@ -43,11 +43,14 @@ class StandaloneMariadb extends BaseModel
}
public function link()
{
- return route('project.database.configuration', [
- 'project_uuid' => $this->environment->project->uuid,
- 'environment_name' => $this->environment->name,
- 'database_uuid' => $this->uuid
- ]);
+ if (data_get($this, 'environment.project.uuid')) {
+ return route('project.database.configuration', [
+ 'project_uuid' => data_get($this, 'environment.project.uuid'),
+ 'environment_name' => data_get($this, 'environment.name'),
+ 'database_uuid' => data_get($this, 'uuid')
+ ]);
+ }
+ return null;
}
public function isLogDrainEnabled()
{
diff --git a/app/Models/StandaloneMongodb.php b/app/Models/StandaloneMongodb.php
index 598719acf1..c041c9407d 100644
--- a/app/Models/StandaloneMongodb.php
+++ b/app/Models/StandaloneMongodb.php
@@ -50,11 +50,14 @@ class StandaloneMongodb extends BaseModel
}
public function link()
{
- return route('project.database.configuration', [
- 'project_uuid' => $this->environment->project->uuid,
- 'environment_name' => $this->environment->name,
- 'database_uuid' => $this->uuid
- ]);
+ if (data_get($this, 'environment.project.uuid')) {
+ return route('project.database.configuration', [
+ 'project_uuid' => data_get($this, 'environment.project.uuid'),
+ 'environment_name' => data_get($this, 'environment.name'),
+ 'database_uuid' => data_get($this, 'uuid')
+ ]);
+ }
+ return null;
}
public function mongoInitdbRootPassword(): Attribute
{
diff --git a/app/Models/StandaloneMysql.php b/app/Models/StandaloneMysql.php
index 4cbee006e3..a4691b9b25 100644
--- a/app/Models/StandaloneMysql.php
+++ b/app/Models/StandaloneMysql.php
@@ -43,11 +43,14 @@ class StandaloneMysql extends BaseModel
}
public function link()
{
- return route('project.database.configuration', [
- 'project_uuid' => $this->environment->project->uuid,
- 'environment_name' => $this->environment->name,
- 'database_uuid' => $this->uuid
- ]);
+ if (data_get($this, 'environment.project.uuid')) {
+ return route('project.database.configuration', [
+ 'project_uuid' => data_get($this, 'environment.project.uuid'),
+ 'environment_name' => data_get($this, 'environment.name'),
+ 'database_uuid' => data_get($this, 'uuid')
+ ]);
+ }
+ return null;
}
public function type(): string
{
diff --git a/app/Models/StandalonePostgresql.php b/app/Models/StandalonePostgresql.php
index 0056f9b511..e0db00d764 100644
--- a/app/Models/StandalonePostgresql.php
+++ b/app/Models/StandalonePostgresql.php
@@ -43,11 +43,14 @@ class StandalonePostgresql extends BaseModel
}
public function link()
{
- return route('project.database.configuration', [
- 'project_uuid' => $this->environment->project->uuid,
- 'environment_name' => $this->environment->name,
- 'database_uuid' => $this->uuid
- ]);
+ if (data_get($this, 'environment.project.uuid')) {
+ return route('project.database.configuration', [
+ 'project_uuid' => data_get($this, 'environment.project.uuid'),
+ 'environment_name' => data_get($this, 'environment.name'),
+ 'database_uuid' => data_get($this, 'uuid')
+ ]);
+ }
+ return null;
}
public function isLogDrainEnabled()
{
diff --git a/app/Models/StandaloneRedis.php b/app/Models/StandaloneRedis.php
index b2038d8af1..95add8315b 100644
--- a/app/Models/StandaloneRedis.php
+++ b/app/Models/StandaloneRedis.php
@@ -38,11 +38,14 @@ class StandaloneRedis extends BaseModel
}
public function link()
{
- return route('project.database.configuration', [
- 'project_uuid' => $this->environment->project->uuid,
- 'environment_name' => $this->environment->name,
- 'database_uuid' => $this->uuid
- ]);
+ if (data_get($this, 'environment.project.uuid')) {
+ return route('project.database.configuration', [
+ 'project_uuid' => data_get($this, 'environment.project.uuid'),
+ 'environment_name' => data_get($this, 'environment.name'),
+ 'database_uuid' => data_get($this, 'uuid')
+ ]);
+ }
+ return null;
}
public function isLogDrainEnabled()
{
diff --git a/resources/views/livewire/server/delete.blade.php b/resources/views/livewire/server/delete.blade.php
index b1855ea151..e85fe37e50 100644
--- a/resources/views/livewire/server/delete.blade.php
+++ b/resources/views/livewire/server/delete.blade.php
@@ -25,10 +25,17 @@
@if ($loop->first)
<h3 class="pt-4">Defined resources</h3>
@endif
- <a class="flex gap-2 p-1 hover:bg-coolgray-100 hover:no-underline" href="{{ $resource->link() }}">
- <div class="w-64">{{ str($resource->type())->headline() }}</div>
- <div>{{ $resource->name }}</div>
- </a>
+ @if ($resource->link())
+ <a class="flex gap-2 p-1 hover:bg-coolgray-100 hover:no-underline" href="{{ $resource->link() }}">
+ <div class="w-64">{{ str($resource->type())->headline() }}</div>
+ <div>{{ $resource->name }}</div>
+ </a>
+ @else
+ <div class="flex gap-2 p-1 hover:bg-coolgray-100 hover:no-underline">
+ <div class="w-64">{{ str($resource->type())->headline() }}</div>
+ <div>{{ $resource->name }}</div>
+ </div>
+ @endif
@empty
@endforelse
</div>
@@ -38,10 +45,17 @@
@if ($loop->first)
<h3 class="pt-4">Defined resources</h3>
@endif
- <a class="flex gap-2 p-1 hover:bg-coolgray-100 hover:no-underline" href="{{ $resource->link() }}">
- <div class="w-64">{{ str($resource->type())->headline() }}</div>
- <div>{{ $resource->name }}</div>
- </a>
+ @if ($resource->link())
+ <a class="flex gap-2 p-1 hover:bg-coolgray-100 hover:no-underline" href="{{ $resource->link() }}">
+ <div class="w-64">{{ str($resource->type())->headline() }}</div>
+ <div>{{ $resource->name }}</div>
+ </a>
+ @else
+ <div class="flex gap-2 p-1 hover:bg-coolgray-100 hover:no-underline">
+ <div class="w-64">{{ str($resource->type())->headline() }}</div>
+ <div>{{ $resource->name }}</div>
+ </div>
+ @endif
@empty
@endforelse
</div>