mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 19:32:40 +01:00
aca621e21f
Summary: I just want to make sure that this is the style we want. It seems less readable to me in some cases. Test Plan: Looked at DarkConsole with errors. Reviewers: epriestley Reviewed By: epriestley CC: Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D7533
98 lines
2.1 KiB
PHP
98 lines
2.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @group console
|
|
*/
|
|
final class DarkConsoleEventPlugin extends DarkConsolePlugin {
|
|
|
|
public function getName() {
|
|
return 'Events';
|
|
}
|
|
|
|
public function getDescription() {
|
|
return 'Information about Phabricator events and event listeners.';
|
|
}
|
|
|
|
public function generateData() {
|
|
|
|
$listeners = PhutilEventEngine::getInstance()->getAllListeners();
|
|
foreach ($listeners as $key => $listener) {
|
|
$listeners[$key] = array(
|
|
'id' => $listener->getListenerID(),
|
|
'class' => get_class($listener),
|
|
);
|
|
}
|
|
|
|
$events = DarkConsoleEventPluginAPI::getEvents();
|
|
foreach ($events as $key => $event) {
|
|
$events[$key] = array(
|
|
'type' => $event->getType(),
|
|
'stopped' => $event->isStopped(),
|
|
);
|
|
}
|
|
|
|
return array(
|
|
'listeners' => $listeners,
|
|
'events' => $events,
|
|
);
|
|
}
|
|
|
|
public function renderPanel() {
|
|
$data = $this->getData();
|
|
|
|
$out = array();
|
|
|
|
$out[] = phutil_tag(
|
|
'div',
|
|
array('class' => 'dark-console-panel-header'),
|
|
phutil_tag('h1', array(), pht('Registered Event Listeners')));
|
|
|
|
$rows = array();
|
|
foreach ($data['listeners'] as $listener) {
|
|
$rows[] = array($listener['id'], $listener['class']);
|
|
}
|
|
|
|
$table = new AphrontTableView($rows);
|
|
$table->setHeaders(
|
|
array(
|
|
'Internal ID',
|
|
'Listener Class',
|
|
));
|
|
$table->setColumnClasses(
|
|
array(
|
|
'',
|
|
'wide',
|
|
));
|
|
|
|
$out[] = $table->render();
|
|
|
|
$out[] = phutil_tag(
|
|
'div',
|
|
array('class' => 'dark-console-panel-header'),
|
|
phutil_tag('h1', array(), pht('Event Log')));
|
|
|
|
$rows = array();
|
|
foreach ($data['events'] as $event) {
|
|
$rows[] = array(
|
|
$event['type'],
|
|
$event['stopped'] ? 'STOPPED' : null,
|
|
);
|
|
}
|
|
|
|
$table = new AphrontTableView($rows);
|
|
$table->setColumnClasses(
|
|
array(
|
|
'wide',
|
|
));
|
|
$table->setHeaders(
|
|
array(
|
|
'Event Type',
|
|
'Stopped',
|
|
));
|
|
|
|
$out[] = $table->render();
|
|
|
|
|
|
return phutil_implode_html("\n", $out);
|
|
}
|
|
}
|