-
-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
253 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
use Yii; | ||
use yii\base\NotSupportedException; | ||
use yii\base\ViewContextInterface; | ||
use yii\debug\Panel as BasePanel; | ||
use yii\helpers\VarDumper; | ||
use yii\queue\JobInterface; | ||
use yii\queue\PushEvent; | ||
|
@@ -23,10 +24,11 @@ | |
* Debug Panel. | ||
* | ||
* @author Roman Zhuravlev <[email protected]> | ||
* @psalm-suppress PropertyNotSetInConstructor | ||
*/ | ||
class Panel extends \yii\debug\Panel implements ViewContextInterface | ||
class Panel extends BasePanel implements ViewContextInterface | ||
{ | ||
private array $_jobs = []; | ||
private array $jobs = []; | ||
|
||
/** | ||
* @inheritdoc | ||
|
@@ -43,7 +45,7 @@ public function init(): void | |
{ | ||
parent::init(); | ||
PushEvent::on(Queue::class, Queue::EVENT_AFTER_PUSH, function (PushEvent $event) { | ||
$this->_jobs[] = $this->getPushData($event); | ||
$this->jobs[] = $this->getPushData($event); | ||
}); | ||
} | ||
|
||
|
@@ -82,7 +84,7 @@ protected function getPushData(PushEvent $event): array | |
*/ | ||
public function save() | ||
{ | ||
return ['jobs' => $this->_jobs]; | ||
return ['jobs' => $this->jobs]; | ||
} | ||
|
||
/** | ||
|
@@ -98,6 +100,7 @@ public function getViewPath(): string | |
*/ | ||
public function getSummary(): string | ||
{ | ||
/** @psalm-var array{jobs: array} $this->data */ | ||
return Yii::$app->view->render('summary', [ | ||
'url' => $this->getUrl(), | ||
'count' => isset($this->data['jobs']) ? count($this->data['jobs']) : 0, | ||
|
@@ -109,12 +112,15 @@ public function getSummary(): string | |
*/ | ||
public function getDetail(): string | ||
{ | ||
/** @psalm-var array{jobs: array} $this->data */ | ||
$jobs = $this->data['jobs'] ?? []; | ||
foreach ($jobs as &$job) { | ||
/** @psalm-var array{sender: string, id: string|int} $job */ | ||
$job['status'] = 'unknown'; | ||
/** @var Queue $queue */ | ||
if ($queue = Yii::$app->get($job['sender'], false)) { | ||
try { | ||
/** @psalm-var Queue $queue */ | ||
if ($queue->isWaiting($job['id'])) { | ||
$job['status'] = 'waiting'; | ||
} elseif ($queue->isReserved($job['id'])) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.