fix: show defined resources in server tab, so you will know what you need to delete before you can delete the server.

This commit is contained in:
Andras Bacsai committed 2023-11-27 09:39:43 +01:00
1 parent ec21155c9e
commit d396f649df
16 files changed
+85 -14

No files matched your search

+8 -1
View File
@@ -47,7 +47,14 @@ class Application extends BaseModel
$application->environment_variables_preview()->delete();
});
}
public function link()
{
return route('project.application.configuration', [
'project_uuid' => $this->environment->project->uuid,
'environment_name' => $this->environment->name,
'application_uuid' => $this->uuid
]);
}
public function settings()
{
return $this->hasOne(ApplicationSetting::class);
+6
View File
@@ -194,6 +194,12 @@ class Server extends BaseModel
{
return instant_remote_process(["df /| tail -1 | awk '{ print $5}' | sed 's/%//g'"], $this, false);
}
public function definedResources() {
$applications = $this->applications();
$databases = $this->databases();
$services = $this->services();
return $applications->concat($databases)->concat($services->get());
}
public function hasDefinedResources()
{
$applications = $this->applications()->count() > 0;
+8
View File
@@ -361,6 +361,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
]);
}
public function documentation()
{
$services = getServiceTemplates();
+8
View File
@@ -41,6 +41,14 @@ class StandaloneMariadb extends BaseModel
$database->environment_variables()->delete();
});
}
public function link()
{
return route('project.database.configuration', [
'project_uuid' => $this->environment->project->uuid,
'environment_name' => $this->environment->name,
'database_uuid' => $this->uuid
]);
}
public function isLogDrainEnabled()
{
return data_get($this, 'is_log_drain_enabled', false);
+8
View File
@@ -48,6 +48,14 @@ class StandaloneMongodb extends BaseModel
{
return data_get($this, 'is_log_drain_enabled', false);
}
public function link()
{
return route('project.database.configuration', [
'project_uuid' => $this->environment->project->uuid,
'environment_name' => $this->environment->name,
'database_uuid' => $this->uuid
]);
}
public function mongoInitdbRootPassword(): Attribute
{
return Attribute::make(
+8
View File
@@ -41,6 +41,14 @@ class StandaloneMysql extends BaseModel
$database->environment_variables()->delete();
});
}
public function link()
{
return route('project.database.configuration', [
'project_uuid' => $this->environment->project->uuid,
'environment_name' => $this->environment->name,
'database_uuid' => $this->uuid
]);
}
public function type(): string
{
return 'standalone-mysql';
+8 -1
View File
@@ -41,7 +41,14 @@ class StandalonePostgresql extends BaseModel
$database->environment_variables()->delete();
});
}
public function link()
{
return route('project.database.configuration', [
'project_uuid' => $this->environment->project->uuid,
'environment_name' => $this->environment->name,
'database_uuid' => $this->uuid
]);
}
public function isLogDrainEnabled()
{
return data_get($this, 'is_log_drain_enabled', false);
+8 -1
View File
@@ -36,7 +36,14 @@ class StandaloneRedis extends BaseModel
$database->environment_variables()->delete();
});
}
public function link()
{
return route('project.database.configuration', [
'project_uuid' => $this->environment->project->uuid,
'environment_name' => $this->environment->name,
'database_uuid' => $this->uuid
]);
}
public function isLogDrainEnabled()
{
return data_get($this, 'is_log_drain_enabled', false);