refactor(activity-monitor): consolidate activity monitoring logic and remove deprecated NewActivityMonitor component

This commit is contained in:
Andras Bacsai
2025-06-02 15:36:37 +02:00
parent 32a14b0050
commit a3dc3c861b
5 changed files with 17 additions and 97 deletions

View File

@@ -14,6 +14,8 @@ class ActivityMonitor extends Component
public $eventToDispatch = 'activityFinished';
public $eventData = null;
public $isPollingActive = false;
public bool $fullHeight = false;
@@ -26,10 +28,11 @@ class ActivityMonitor extends Component
protected $listeners = ['activityMonitor' => 'newMonitorActivity'];
public function newMonitorActivity($activityId, $eventToDispatch = 'activityFinished')
public function newMonitorActivity($activityId, $eventToDispatch = 'activityFinished', $eventData = null)
{
$this->activityId = $activityId;
$this->eventToDispatch = $eventToDispatch;
$this->eventData = $eventData;
$this->hydrateActivity();
@@ -55,7 +58,11 @@ class ActivityMonitor extends Component
if ($user) {
$teamId = $user->currentTeam()->id;
if (! self::$eventDispatched) {
$this->eventToDispatch::dispatch($teamId);
if (filled($this->eventData)) {
$this->eventToDispatch::dispatch($teamId, $this->eventData);
} else {
$this->eventToDispatch::dispatch($teamId);
}
self::$eventDispatched = true;
}
}
@@ -63,7 +70,11 @@ class ActivityMonitor extends Component
return;
}
if (! self::$eventDispatched) {
$this->dispatch($this->eventToDispatch);
if (filled($this->eventData)) {
$this->dispatch($this->eventToDispatch, $this->eventData);
} else {
$this->dispatch($this->eventToDispatch);
}
self::$eventDispatched = true;
}
}