mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-16 20:02:40 +01:00
38f5894b58
Summary: Ref T4986. Allows the Drydock search engines to render as panels. Test Plan: Viewed affected interfaces in Drydock. Created panels from each engine. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T4986 Differential Revision: https://secure.phabricator.com/D9103
49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
<?php
|
|
|
|
final class DrydockResourceListView extends AphrontView {
|
|
|
|
private $resources;
|
|
|
|
public function setResources(array $resources) {
|
|
assert_instances_of($resources, 'DrydockResource');
|
|
$this->resources = $resources;
|
|
return $this;
|
|
}
|
|
|
|
public function render() {
|
|
$resources = $this->resources;
|
|
$viewer = $this->getUser();
|
|
|
|
$view = new PHUIObjectItemListView();
|
|
foreach ($resources as $resource) {
|
|
$name = pht('Resource %d', $resource->getID()).': '.$resource->getName();
|
|
|
|
$item = id(new PHUIObjectItemView())
|
|
->setHref('/drydock/resource/'.$resource->getID().'/')
|
|
->setHeader($name);
|
|
|
|
$status = DrydockResourceStatus::getNameForStatus($resource->getStatus());
|
|
$item->addAttribute($status);
|
|
|
|
switch ($resource->getStatus()) {
|
|
case DrydockResourceStatus::STATUS_PENDING:
|
|
$item->setBarColor('yellow');
|
|
break;
|
|
case DrydockResourceStatus::STATUS_OPEN:
|
|
$item->setBarColor('green');
|
|
break;
|
|
case DrydockResourceStatus::STATUS_DESTROYED:
|
|
$item->setBarColor('black');
|
|
break;
|
|
default:
|
|
$item->setBarColor('red');
|
|
break;
|
|
}
|
|
|
|
$view->addItem($item);
|
|
}
|
|
|
|
return $view;
|
|
}
|
|
|
|
}
|