private function buildServicesTable(AlmanacDevice $device) { $viewer = $this->getViewer(); // NOTE: We're loading all services so we can show hidden, locked services. // In general, we let you know about all the things the device is bound to, // even if you don't have permission to see their details. This is similar // to exposing the existence of edges in other applications, with the // addition of always letting you see that locks exist. $services = id(new AlmanacServiceQuery())->setViewer(PhabricatorUser::getOmnipotentUser())->withDevicePHIDs(array($device->getPHID()))->execute(); $handles = $viewer->loadHandles(mpull($services, 'getPHID')); $icon_cluster = id(new PHUIIconView())->setIcon('fa-sitemap'); $rows = array(); foreach ($services as $service) { $rows[] = array($service->isClusterService() ? $icon_cluster : null, $handles->renderHandle($service->getPHID())); } $table = id(new AphrontTableView($rows))->setNoDataString(pht('No services are bound to this device.'))->setHeaders(array(null, pht('Service')))->setColumnClasses(array(null, 'wide pri')); return id(new PHUIObjectBoxView())->setHeaderText(pht('BOUND SERVICES'))->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->setTable($table); }
protected function getDeviceDictionary(AlmanacDevice $device) { return array('id' => (int) $device->getID(), 'phid' => $device->getPHID(), 'name' => $device->getName(), 'properties' => $this->getPropertiesDictionary($device)); }