1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 08:12:40 +01:00
phorge-phorge/src/applications/daemon/controller/PhabricatorDaemonLogEventViewController.php
epriestley a5dc9067af Provide convenience method addTextCrumb() to PhabricatorCrumbsView
Summary: We currently have a lot of calls to `addCrumb(id(new PhabricatorCrumbView())->...)` which can be expressed much more simply with a convenience method. Nearly all crumbs are only textual.

Test Plan:
  - This was mostly automated, then I cleaned up a few unusual sites manually.
  - Bunch of grep / randomly clicking around.

Reviewers: btrahan, chad

Reviewed By: btrahan

CC: hach-que, aran

Differential Revision: https://secure.phabricator.com/D7787
2013-12-18 17:47:34 -08:00

49 lines
1.1 KiB
PHP

<?php
final class PhabricatorDaemonLogEventViewController
extends PhabricatorDaemonController {
private $id;
public function willProcessRequest(array $data) {
$this->id = $data['id'];
}
public function processRequest() {
$request = $this->getRequest();
$event = id(new PhabricatorDaemonLogEvent())->load($this->id);
if (!$event) {
return new Aphront404Response();
}
$event_view = id(new PhabricatorDaemonLogEventsView())
->setEvents(array($event))
->setUser($request->getUser())
->setCombinedLog(true)
->setShowFullMessage(true);
$log_panel = new AphrontPanelView();
$log_panel->appendChild($event_view);
$log_panel->setNoBackground();
$daemon_id = $event->getLogID();
$crumbs = $this->buildApplicationCrumbs()
->addTextCrumb(
pht('Daemon %s', $daemon_id),
$this->getApplicationURI("log/{$daemon_id}/"))
->addTextCrumb(pht('Event %s', $event->getID()));
return $this->buildApplicationPage(
array(
$crumbs,
$log_panel,
),
array(
'title' => pht('Combined Daemon Log'),
));
}
}