Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / console / plugin / DarkConsoleEventPlugin.php
blob070227c12d91f5830ad5ed667c1f1bc9fcd0563a
1 <?php
3 final class DarkConsoleEventPlugin extends DarkConsolePlugin {
5 public function getName() {
6 return pht('Events');
9 public function getDescription() {
10 return pht('Information about Phabricator events and event listeners.');
13 public function generateData() {
14 $listeners = PhutilEventEngine::getInstance()->getAllListeners();
15 foreach ($listeners as $key => $listener) {
16 $listeners[$key] = array(
17 'id' => $listener->getListenerID(),
18 'class' => get_class($listener),
22 $events = DarkConsoleEventPluginAPI::getEvents();
23 foreach ($events as $key => $event) {
24 $events[$key] = array(
25 'type' => $event->getType(),
26 'stopped' => $event->isStopped(),
30 return array(
31 'listeners' => $listeners,
32 'events' => $events,
36 public function renderPanel() {
37 $data = $this->getData();
39 $out = array();
41 $out[] = phutil_tag(
42 'div',
43 array('class' => 'dark-console-panel-header'),
44 phutil_tag('h1', array(), pht('Registered Event Listeners')));
46 $rows = array();
47 foreach ($data['listeners'] as $listener) {
48 $rows[] = array($listener['id'], $listener['class']);
51 $table = new AphrontTableView($rows);
52 $table->setHeaders(
53 array(
54 pht('Internal ID'),
55 pht('Listener Class'),
56 ));
57 $table->setColumnClasses(
58 array(
59 '',
60 'wide',
61 ));
63 $out[] = $table->render();
65 $out[] = phutil_tag(
66 'div',
67 array('class' => 'dark-console-panel-header'),
68 phutil_tag('h1', array(), pht('Event Log')));
70 $rows = array();
71 foreach ($data['events'] as $event) {
72 $rows[] = array(
73 $event['type'],
74 $event['stopped'] ? pht('STOPPED') : null,
78 $table = new AphrontTableView($rows);
79 $table->setColumnClasses(
80 array(
81 'wide',
82 ));
83 $table->setHeaders(
84 array(
85 pht('Event Type'),
86 pht('Stopped'),
87 ));
89 $out[] = $table->render();
92 return phutil_implode_html("\n", $out);