Skip to content

Commit bb6cb8e

Browse files
committed
improvement: show backup button on supported db service stacks
1 parent a6ec2b9 commit bb6cb8e

11 files changed

+72
-17
lines changed

app/Models/ServiceDatabase.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,12 @@ public function scheduledBackups()
115115
{
116116
return $this->morphMany(ScheduledDatabaseBackup::class, 'database');
117117
}
118+
119+
public function isBackupSolutionAvailable()
120+
{
121+
return str($this->databaseType())->contains('mysql') ||
122+
str($this->databaseType())->contains('postgres') ||
123+
str($this->databaseType())->contains('mariadb') ||
124+
str($this->databaseType())->contains('mongodb');
125+
}
118126
}

app/Models/StandaloneClickhouse.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,4 +294,9 @@ public function getMetrics(int $mins = 5)
294294
return $parsedCollection->toArray();
295295
}
296296
}
297+
298+
public function isBackupSolutionAvailable()
299+
{
300+
return false;
301+
}
297302
}

app/Models/StandaloneDragonfly.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,4 +294,9 @@ public function getMetrics(int $mins = 5)
294294
return $parsedCollection->toArray();
295295
}
296296
}
297+
298+
public function isBackupSolutionAvailable()
299+
{
300+
return false;
301+
}
297302
}

app/Models/StandaloneKeydb.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,4 +294,9 @@ public function getMetrics(int $mins = 5)
294294
return $parsedCollection->toArray();
295295
}
296296
}
297+
298+
public function isBackupSolutionAvailable()
299+
{
300+
return false;
301+
}
297302
}

app/Models/StandaloneMariadb.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,4 +294,9 @@ public function getMetrics(int $mins = 5)
294294
return $parsedCollection->toArray();
295295
}
296296
}
297+
298+
public function isBackupSolutionAvailable()
299+
{
300+
return true;
301+
}
297302
}

app/Models/StandaloneMongodb.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,4 +314,9 @@ public function getMetrics(int $mins = 5)
314314
return $parsedCollection->toArray();
315315
}
316316
}
317+
318+
public function isBackupSolutionAvailable()
319+
{
320+
return true;
321+
}
317322
}

app/Models/StandaloneMysql.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,4 +295,9 @@ public function getMetrics(int $mins = 5)
295295
return $parsedCollection->toArray();
296296
}
297297
}
298+
299+
public function isBackupSolutionAvailable()
300+
{
301+
return true;
302+
}
298303
}

app/Models/StandalonePostgresql.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,4 +296,9 @@ public function getMetrics(int $mins = 5)
296296
return $parsedCollection->toArray();
297297
}
298298
}
299+
300+
public function isBackupSolutionAvailable()
301+
{
302+
return true;
303+
}
299304
}

app/Models/StandaloneRedis.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,4 +290,9 @@ public function getMetrics(int $mins = 5)
290290
return $parsedCollection->toArray();
291291
}
292292
}
293+
294+
public function isBackupSolutionAvailable()
295+
{
296+
return false;
297+
}
293298
}

resources/views/livewire/project/service/configuration.blade.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,12 @@ class="w-4 h-4 dark:text-warning text-coollabs"
149149
<div class="text-xs">{{ $database->status }}</div>
150150
</div>
151151
<div class="flex items-center px-4">
152+
@if ($database->isBackupSolutionAvailable())
153+
<a class="mx-4 text-xs font-bold hover:underline"
154+
href="{{ route('project.service.index', [...$parameters, 'stack_service_uuid' => $database->uuid]) }}#backups">
155+
Backups
156+
</a>
157+
@endif
152158
<a class="mx-4 text-xs font-bold hover:underline"
153159
href="{{ route('project.service.index', [...$parameters, 'stack_service_uuid' => $database->uuid]) }}">
154160
Settings

0 commit comments

Comments
 (0)