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: resolve uncloseable database restore modal on MariaDB import (#7335)

Andras Bacsaiaa18c4882350
diff --git a/app/Livewire/ActivityMonitor.php b/app/Livewire/ActivityMonitor.php
index d01b55afb7..bc310e7157 100644
--- a/app/Livewire/ActivityMonitor.php
+++ b/app/Livewire/ActivityMonitor.php
@@ -10,7 +10,7 @@ class ActivityMonitor extends Component
{
public ?string $header = null;
- public $activityId;
+ public $activityId = null;
public $eventToDispatch = 'activityFinished';
@@ -49,9 +49,24 @@ class ActivityMonitor extends Component
public function hydrateActivity()
{
+ if ($this->activityId === null) {
+ $this->activity = null;
+
+ return;
+ }
+
$this->activity = Activity::find($this->activityId);
}
+ public function updatedActivityId($value)
+ {
+ if ($value) {
+ $this->hydrateActivity();
+ $this->isPollingActive = true;
+ self::$eventDispatched = false;
+ }
+ }
+
public function polling()
{
$this->hydrateActivity();
diff --git a/app/Livewire/Project/Database/Import.php b/app/Livewire/Project/Database/Import.php
index fd191e587a..26feb1a5e4 100644
--- a/app/Livewire/Project/Database/Import.php
+++ b/app/Livewire/Project/Database/Import.php
@@ -133,6 +133,8 @@ class Import extends Component
public string $customLocation = '';
+ public ?int $activityId = null;
+
public string $postgresqlRestoreCommand = 'pg_restore -U $POSTGRES_USER -d $POSTGRES_DB';
public string $mysqlRestoreCommand = 'mysql -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE';
@@ -156,9 +158,15 @@ class Import extends Component
return [
"echo-private:user.{$userId},DatabaseStatusChanged" => '$refresh',
+ 'slideOverClosed' => 'resetActivityId',
];
}
+ public function resetActivityId()
+ {
+ $this->activityId = null;
+ }
+
public function mount()
{
$this->parameters = get_route_parameters();
@@ -327,6 +335,9 @@ EOD;
'serverId' => $this->server->id,
]);
+ // Track the activity ID
+ $this->activityId = $activity->id;
+
// Dispatch activity to the monitor and open slide-over
$this->dispatch('activityMonitor', $activity->id);
$this->dispatch('databaserestore');
@@ -548,6 +559,9 @@ EOD;
'serverId' => $this->server->id,
]);
+ // Track the activity ID
+ $this->activityId = $activity->id;
+
// Dispatch activity to the monitor and open slide-over
$this->dispatch('activityMonitor', $activity->id);
$this->dispatch('databaserestore');
diff --git a/resources/views/components/slide-over.blade.php b/resources/views/components/slide-over.blade.php
index 3cb8ec3ab1..13769c7b67 100644
--- a/resources/views/components/slide-over.blade.php
+++ b/resources/views/components/slide-over.blade.php
@@ -1,7 +1,13 @@
@props(['closeWithX' => false, 'fullScreen' => false])
<div x-data="{
slideOverOpen: false
-}" {{ $attributes->merge(['class' => 'relative w-auto h-auto']) }}>
+}"
+x-init="$watch('slideOverOpen', value => {
+ if (!value) {
+ $dispatch('slideOverClosed')
+ }
+})"
+{{ $attributes->merge(['class' => 'relative w-auto h-auto']) }}>
{{ $slot }}
<template x-teleport="body">
<div x-show="slideOverOpen" @if (!$closeWithX) @keydown.window.escape="slideOverOpen=false" @endif