private function buildPropertyListView(DrydockBlueprint $blueprint, PhabricatorActionListView $actions)
 {
     $view = new PHUIPropertyListView();
     $view->setActionList($actions);
     $view->addProperty(pht('Type'), $blueprint->getImplementation()->getBlueprintName());
     return $view;
 }
 private function buildPropertyListView(DrydockLease $lease, PhabricatorActionListView $actions)
 {
     $viewer = $this->getViewer();
     $view = new PHUIPropertyListView();
     $view->setActionList($actions);
     $view->addProperty(pht('Status'), DrydockLeaseStatus::getNameForStatus($lease->getStatus()));
     $view->addProperty(pht('Resource Type'), $lease->getResourceType());
     $resource_phid = $lease->getResourcePHID();
     if ($resource_phid) {
         $resource_display = $viewer->renderHandle($resource_phid);
     } else {
         $resource_display = phutil_tag('em', array(), pht('No Resource'));
     }
     $view->addProperty(pht('Resource'), $resource_display);
     $until = $lease->getUntil();
     if ($until) {
         $until_display = phabricator_datetime($until, $viewer);
     } else {
         $until_display = phutil_tag('em', array(), pht('Never'));
     }
     $view->addProperty(pht('Expires'), $until_display);
     $attributes = $lease->getAttributes();
     if ($attributes) {
         $view->addSectionHeader(pht('Attributes'), 'fa-list-ul');
         foreach ($attributes as $key => $value) {
             $view->addProperty($key, $value);
         }
     }
     return $view;
 }
 private function buildPropertyListView(PhabricatorWorkerTask $task, PhabricatorActionListView $actions)
 {
     $viewer = $this->getRequest()->getUser();
     $view = new PHUIPropertyListView();
     $view->setActionList($actions);
     if ($task->isArchived()) {
         switch ($task->getResult()) {
             case PhabricatorWorkerArchiveTask::RESULT_SUCCESS:
                 $status = pht('Complete');
                 break;
             case PhabricatorWorkerArchiveTask::RESULT_FAILURE:
                 $status = pht('Failed');
                 break;
             case PhabricatorWorkerArchiveTask::RESULT_CANCELLED:
                 $status = pht('Cancelled');
                 break;
             default:
                 throw new Exception('Unknown task status!');
         }
     } else {
         $status = pht('Queued');
     }
     $view->addProperty(pht('Task Status'), $status);
     $view->addProperty(pht('Task Class'), $task->getTaskClass());
     if ($task->getLeaseExpires()) {
         if ($task->getLeaseExpires() > time()) {
             $lease_status = pht('Leased');
         } else {
             $lease_status = pht('Lease Expired');
         }
     } else {
         $lease_status = phutil_tag('em', array(), pht('Not Leased'));
     }
     $view->addProperty(pht('Lease Status'), $lease_status);
     $view->addProperty(pht('Lease Owner'), $task->getLeaseOwner() ? $task->getLeaseOwner() : phutil_tag('em', array(), pht('None')));
     if ($task->getLeaseExpires() && $task->getLeaseOwner()) {
         $expires = $task->getLeaseExpires() - time();
         $expires = phutil_format_relative_time_detailed($expires);
     } else {
         $expires = phutil_tag('em', array(), pht('None'));
     }
     $view->addProperty(pht('Lease Expires'), $expires);
     if ($task->isArchived()) {
         $duration = number_format($task->getDuration()) . ' us';
     } else {
         $duration = phutil_tag('em', array(), pht('Not Completed'));
     }
     $view->addProperty(pht('Duration'), $duration);
     $data = id(new PhabricatorWorkerTaskData())->load($task->getDataID());
     $task->setData($data->getData());
     $worker = $task->getWorkerInstance();
     $data = $worker->renderForDisplay($viewer);
     $view->addProperty(pht('Data'), $data);
     return $view;
 }
 private function renderProperties(PhameBlog $blog, PhabricatorUser $user, PhabricatorActionListView $actions)
 {
     require_celerity_resource('aphront-tooltip-css');
     Javelin::initBehavior('phabricator-tooltips');
     $properties = new PHUIPropertyListView();
     $properties->setActionList($actions);
     $properties->addProperty(pht('Skin'), $blog->getSkin());
     $properties->addProperty(pht('Domain'), $blog->getDomain());
     $feed_uri = PhabricatorEnv::getProductionURI($this->getApplicationURI('blog/feed/' . $blog->getID() . '/'));
     $properties->addProperty(pht('Atom URI'), javelin_tag('a', array('href' => $feed_uri, 'sigil' => 'has-tooltip', 'meta' => array('tip' => pht('Atom URI does not support custom domains.'), 'size' => 320)), $feed_uri));
     $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($user, $blog);
     $properties->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
     $properties->addProperty(pht('Joinable By'), $descriptions[PhabricatorPolicyCapability::CAN_JOIN]);
     $engine = id(new PhabricatorMarkupEngine())->setViewer($user)->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION)->process();
     $properties->addTextContent(phutil_tag('div', array('class' => 'phabricator-remarkup'), $engine->getOutput($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION)));
     return $properties;
 }
 private function buildPropertyListView(DrydockResource $resource, PhabricatorActionListView $actions)
 {
     $view = new PHUIPropertyListView();
     $view->setActionList($actions);
     $status = $resource->getStatus();
     $status = DrydockResourceStatus::getNameForStatus($status);
     $view->addProperty(pht('Status'), $status);
     $view->addProperty(pht('Resource Type'), $resource->getType());
     // TODO: Load handle.
     $view->addProperty(pht('Blueprint'), $resource->getBlueprintPHID());
     $attributes = $resource->getAttributes();
     if ($attributes) {
         $view->addSectionHeader(pht('Attributes'));
         foreach ($attributes as $key => $value) {
             $view->addProperty($key, $value);
         }
     }
     return $view;
 }
 private function buildPropertyListView(DrydockLease $lease, PhabricatorActionListView $actions)
 {
     $view = new PHUIPropertyListView();
     $view->setActionList($actions);
     switch ($lease->getStatus()) {
         case DrydockLeaseStatus::STATUS_ACTIVE:
             $status = pht('Active');
             break;
         case DrydockLeaseStatus::STATUS_RELEASED:
             $status = pht('Released');
             break;
         case DrydockLeaseStatus::STATUS_EXPIRED:
             $status = pht('Expired');
             break;
         case DrydockLeaseStatus::STATUS_PENDING:
             $status = pht('Pending');
             break;
         case DrydockLeaseStatus::STATUS_BROKEN:
             $status = pht('Broken');
             break;
         default:
             $status = pht('Unknown');
             break;
     }
     $view->addProperty(pht('Status'), $status);
     $view->addProperty(pht('Resource Type'), $lease->getResourceType());
     $view->addProperty(pht('Resource'), $lease->getResourceID());
     $attributes = $lease->getAttributes();
     if ($attributes) {
         $view->addSectionHeader(pht('Attributes'));
         foreach ($attributes as $key => $value) {
             $view->addProperty($key, $value);
         }
     }
     return $view;
 }