mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-18 01:20:31 +00:00
fix: conditionally render activity monitors to prevent output conflicts
- Add currentActivityId property to track the active process - Replace event dispatching with property assignment for cleaner state management - S3 download monitor only renders during download and is removed when complete - Database restore monitor only renders during restore operation - Both monitors now share the same activity-monitor component instance with proper lifecycle management - When user starts restore after S3 download, S3 monitor is removed from DOM - Fixes issue where S3 download and database restore showed identical output 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -68,6 +68,8 @@ class Import extends Component
|
||||
|
||||
public bool $s3DownloadInProgress = false;
|
||||
|
||||
public ?int $currentActivityId = null;
|
||||
|
||||
public function getListeners()
|
||||
{
|
||||
$userId = Auth::id();
|
||||
@@ -263,7 +265,7 @@ EOD;
|
||||
'container' => $this->container,
|
||||
'serverId' => $this->server->id,
|
||||
]);
|
||||
$this->dispatch('activityMonitor', $activity->id);
|
||||
$this->currentActivityId = $activity->id;
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
@@ -403,8 +405,8 @@ EOD;
|
||||
|
||||
$this->s3DownloadedFile = $downloadPath;
|
||||
$this->filename = $downloadPath;
|
||||
$this->currentActivityId = $activity->id;
|
||||
|
||||
$this->dispatch('activityMonitor', $activity->id);
|
||||
$this->dispatch('info', 'Downloading file from S3. This may take a few minutes for large backups...');
|
||||
} catch (\Throwable $e) {
|
||||
$this->s3DownloadInProgress = false;
|
||||
@@ -486,7 +488,7 @@ EOD;
|
||||
's3DownloadedFile' => $this->s3DownloadedFile,
|
||||
'resourceUuid' => $this->resource->uuid,
|
||||
]);
|
||||
$this->dispatch('activityMonitor', $activity->id);
|
||||
$this->currentActivityId = $activity->id;
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
@@ -516,6 +518,7 @@ EOD;
|
||||
// Reset S3 download state
|
||||
$this->s3DownloadedFile = null;
|
||||
$this->s3DownloadInProgress = false;
|
||||
$this->currentActivityId = null;
|
||||
$this->filename = null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user