diff --git a/app/Livewire/Project/Database/FlushCache.php b/app/Livewire/Project/Database/FlushCache.php
new file mode 100644
index 0000000000..96bbe0b9c4
--- /dev/null
+++ b/app/Livewire/Project/Database/FlushCache.php
@@ -0,0 +1,61 @@
+authorize('view', $this->database);
+ }
+
+ public function flush(): void
+ {
+ try {
+ $this->authorize('manage', $this->database);
+
+ if (! $this->isCacheDatabase()) {
+ throw new \RuntimeException('This database type does not support cache flushing.');
+ }
+
+ FlushCacheDatabase::run($this->database);
+ $this->auditFlush();
+ $this->dispatch('success', 'Cache flushed successfully.');
+ } catch (\Throwable $e) {
+ handleError($e, $this);
+ }
+ }
+
+ public function isCacheDatabase(): bool
+ {
+ return $this->database instanceof StandaloneRedis
+ || $this->database instanceof StandaloneKeydb
+ || $this->database instanceof StandaloneDragonfly;
+ }
+
+ private function auditFlush(): void
+ {
+ auditLog('ui.database.flushed', [
+ 'team_id' => $this->database->team()?->id,
+ 'database_uuid' => $this->database->uuid,
+ 'database_name' => $this->database->name,
+ ]);
+ }
+
+ public function render(): View
+ {
+ return view('livewire.project.database.flush-cache');
+ }
+}
diff --git a/app/Livewire/Project/Database/Heading.php b/app/Livewire/Project/Database/Heading.php
index 354d9ed8d2..a7e8cfedd8 100644
--- a/app/Livewire/Project/Database/Heading.php
+++ b/app/Livewire/Project/Database/Heading.php
@@ -2,15 +2,11 @@
namespace App\Livewire\Project\Database;
-use App\Actions\Database\FlushCacheDatabase;
use App\Actions\Database\RestartDatabase;
use App\Actions\Database\StartDatabase;
use App\Actions\Database\StopDatabase;
use App\Actions\Docker\GetContainersStatus;
use App\Events\ServiceStatusChanged;
-use App\Models\StandaloneDragonfly;
-use App\Models\StandaloneKeydb;
-use App\Models\StandaloneRedis;
use App\Support\ResourceStartActivity;
use App\Traits\ListensToTeamChannel;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
@@ -150,23 +146,6 @@ class Heading extends Component
}
}
- public function flush()
- {
- try {
- $this->authorize('manage', $this->database);
-
- if (! $this->isCacheDatabase()) {
- throw new \RuntimeException('This database type does not support cache flushing.');
- }
-
- FlushCacheDatabase::run($this->database);
- $this->auditDatabaseAction('ui.database.flushed');
- $this->dispatch('success', 'Cache flushed successfully.');
- } catch (\Throwable $e) {
- return handleError($e, $this);
- }
- }
-
public function restart()
{
try {
@@ -213,17 +192,9 @@ class Heading extends Component
'checkboxes' => [
['id' => 'docker_cleanup', 'label' => __('resource.docker_cleanup')],
],
- 'isCacheDatabase' => $this->isCacheDatabase(),
]);
}
- private function isCacheDatabase(): bool
- {
- return $this->database instanceof StandaloneRedis
- || $this->database instanceof StandaloneKeydb
- || $this->database instanceof StandaloneDragonfly;
- }
-
private function auditDatabaseAction(string $event): void
{
auditLog($event, [
diff --git a/resources/views/livewire/project/database/configuration.blade.php b/resources/views/livewire/project/database/configuration.blade.php
index 23778effa3..f7c290bd5d 100644
--- a/resources/views/livewire/project/database/configuration.blade.php
+++ b/resources/views/livewire/project/database/configuration.blade.php
@@ -53,6 +53,9 @@
@elseif ($currentRoute === 'project.database.tags')
@elseif ($currentRoute === 'project.database.danger')
+ @if (in_array($database->type(), ['standalone-redis', 'standalone-keydb', 'standalone-dragonfly']))
+
+ @endif
@endif
diff --git a/resources/views/livewire/project/database/flush-cache.blade.php b/resources/views/livewire/project/database/flush-cache.blade.php
new file mode 100644
index 0000000000..9de2ee5666
--- /dev/null
+++ b/resources/views/livewire/project/database/flush-cache.blade.php
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
Flush cache
+
+
+
+ Permanently erase every key in
+ {{ $database->name }}
+ by running FLUSHALL ASYNC inside the running container.
+
+
+ - • All cached data is removed and cannot be recovered.
+ - • The database container keeps running; only its data is cleared.
+ - • The database must be running for this action to work.
+
+
+
+
+ @can('manage', $database)
+
+ @else
+
+ Flush cache
+
+ @endcan
+
+
+
+
+
diff --git a/resources/views/livewire/project/database/heading.blade.php b/resources/views/livewire/project/database/heading.blade.php
index 43e6b5af4b..abf58177c7 100644
--- a/resources/views/livewire/project/database/heading.blade.php
+++ b/resources/views/livewire/project/database/heading.blade.php
@@ -88,13 +88,6 @@
Restart
- @if ($isCacheDatabase)
-
- @endif