Differential D15574 Diff 37547 src/applications/daemon/controller/PhabricatorDaemonLogViewController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/daemon/controller/PhabricatorDaemonLogViewController.php
Show All 16 Lines | public function handleRequest(AphrontRequest $request) { | ||||
} | } | ||||
$events = id(new PhabricatorDaemonLogEvent())->loadAllWhere( | $events = id(new PhabricatorDaemonLogEvent())->loadAllWhere( | ||||
'logID = %d ORDER BY id DESC LIMIT 1000', | 'logID = %d ORDER BY id DESC LIMIT 1000', | ||||
$log->getID()); | $log->getID()); | ||||
$crumbs = $this->buildApplicationCrumbs(); | $crumbs = $this->buildApplicationCrumbs(); | ||||
$crumbs->addTextCrumb(pht('Daemon %s', $log->getID())); | $crumbs->addTextCrumb(pht('Daemon %s', $log->getID())); | ||||
$crumbs->setBorder(true); | |||||
$header = id(new PHUIHeaderView()) | $header = id(new PHUIHeaderView()) | ||||
->setHeader($log->getDaemon()); | ->setHeader($log->getDaemon()) | ||||
->setHeaderIcon('fa-pied-piper-alt'); | |||||
$tag = id(new PHUITagView()) | $tag = id(new PHUITagView()) | ||||
->setType(PHUITagView::TYPE_STATE); | ->setType(PHUITagView::TYPE_STATE); | ||||
$status = $log->getStatus(); | $status = $log->getStatus(); | ||||
switch ($status) { | switch ($status) { | ||||
case PhabricatorDaemonLog::STATUS_UNKNOWN: | case PhabricatorDaemonLog::STATUS_UNKNOWN: | ||||
$tag->setBackgroundColor(PHUITagView::COLOR_ORANGE); | $color = 'orange'; | ||||
$tag->setName(pht('Unknown')); | $name = pht('Unknown'); | ||||
$icon = 'fa-warning'; | |||||
break; | break; | ||||
case PhabricatorDaemonLog::STATUS_RUNNING: | case PhabricatorDaemonLog::STATUS_RUNNING: | ||||
$tag->setBackgroundColor(PHUITagView::COLOR_GREEN); | $color = 'green'; | ||||
$tag->setName(pht('Running')); | $name = pht('Running'); | ||||
$icon = 'fa-rocket'; | |||||
break; | break; | ||||
case PhabricatorDaemonLog::STATUS_DEAD: | case PhabricatorDaemonLog::STATUS_DEAD: | ||||
$tag->setBackgroundColor(PHUITagView::COLOR_RED); | $color = 'red'; | ||||
$tag->setName(pht('Dead')); | $name = pht('Dead'); | ||||
$icon = 'fa-times'; | |||||
break; | break; | ||||
case PhabricatorDaemonLog::STATUS_WAIT: | case PhabricatorDaemonLog::STATUS_WAIT: | ||||
$tag->setBackgroundColor(PHUITagView::COLOR_BLUE); | $color = 'blue'; | ||||
$tag->setName(pht('Waiting')); | $name = pht('Waiting'); | ||||
$icon = 'fa-clock-o'; | |||||
break; | break; | ||||
case PhabricatorDaemonLog::STATUS_EXITING: | case PhabricatorDaemonLog::STATUS_EXITING: | ||||
$tag->setBackgroundColor(PHUITagView::COLOR_YELLOW); | $color = 'yellow'; | ||||
$tag->setName(pht('Exiting')); | $name = pht('Exiting'); | ||||
$icon = 'fa-check'; | |||||
break; | break; | ||||
case PhabricatorDaemonLog::STATUS_EXITED: | case PhabricatorDaemonLog::STATUS_EXITED: | ||||
$tag->setBackgroundColor(PHUITagView::COLOR_GREY); | $color = 'bluegrey'; | ||||
$tag->setName(pht('Exited')); | $name = pht('Exited'); | ||||
$icon = 'fa-check'; | |||||
break; | break; | ||||
} | } | ||||
$header->addTag($tag); | $header->setStatus($icon, $color, $name); | ||||
$properties = $this->buildPropertyListView($log); | $properties = $this->buildPropertyListView($log); | ||||
$event_view = id(new PhabricatorDaemonLogEventsView()) | $event_view = id(new PhabricatorDaemonLogEventsView()) | ||||
->setUser($viewer) | ->setUser($viewer) | ||||
->setEvents($events); | ->setEvents($events); | ||||
$event_panel = new PHUIObjectBoxView(); | $event_panel = id(new PHUIObjectBoxView()) | ||||
$event_panel->setHeaderText(pht('Events')); | ->setHeaderText(pht('Events')) | ||||
$event_panel->appendChild($event_view); | ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) | ||||
->appendChild($event_view); | |||||
$object_box = id(new PHUIObjectBoxView()) | $object_box = id(new PHUIObjectBoxView()) | ||||
->setHeader($header) | |||||
->addPropertyList($properties); | ->addPropertyList($properties); | ||||
return $this->buildApplicationPage( | $view = id(new PHUITwoColumnView()) | ||||
array( | ->setHeader($header) | ||||
$crumbs, | ->setFooter(array( | ||||
$object_box, | $object_box, | ||||
$event_panel, | $event_panel, | ||||
), | |||||
array( | |||||
'title' => pht('Daemon Log'), | |||||
)); | )); | ||||
return $this->newPage() | |||||
->setTitle(pht('Daemon Log')) | |||||
->setCrumbs($crumbs) | |||||
->appendChild($view); | |||||
} | } | ||||
private function buildPropertyListView(PhabricatorDaemonLog $daemon) { | private function buildPropertyListView(PhabricatorDaemonLog $daemon) { | ||||
$request = $this->getRequest(); | $request = $this->getRequest(); | ||||
$viewer = $request->getUser(); | $viewer = $request->getUser(); | ||||
$view = id(new PHUIPropertyListView()) | $view = id(new PHUIPropertyListView()) | ||||
->setUser($viewer); | ->setUser($viewer); | ||||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |