diff --git a/src/query/SemiStructuredObjectTypeSearchEngine.php b/src/query/SemiStructuredObjectTypeSearchEngine.php index af9f8bf..edd51de 100644 --- a/src/query/SemiStructuredObjectTypeSearchEngine.php +++ b/src/query/SemiStructuredObjectTypeSearchEngine.php @@ -1,153 +1,150 @@ setKey('statuses') ->setLabel(pht('Status')) ->setOptions(SemiStructuredObjectType::getStatusNameMap()), id(new PhabricatorSearchCheckboxesField()) ->setKey('editable') ->setLabel(pht('Editable')) ->setOptions(array('editable' => null)), ); } protected function getURI($path) { return '/semistruct/'.$path; } protected function getBuiltinQueryNames() { $names = array(); $names['all'] = pht('All Types'); $names['open'] = pht('Active Types'); return $names; } public function buildSavedQueryFromBuiltin($query_key) { $query = $this->newSavedQuery(); $query->setQueryKey($query_key); $viewer = $this->requireViewer(); switch ($query_key) { case 'all': return $query; case 'open': return $query->setParameter( 'statuses', array( SemiStructuredObjectType::STATUS_ACTIVE, )); } return parent::buildSavedQueryFromBuiltin($query_key); } protected function buildQueryFromParameters(array $map) { $query = $this->newQuery(); if ($map['statuses']) { $query->withStatuses($map['statuses']); } if ($map['editable'] !== null) { $query->withCanEdit($map['editable']); } return $query; } + protected function getRequiredHandlePHIDsForResultList( + array $objects, + PhabricatorSavedQuery $query) { + + return array(); + } + protected function renderResultList( array $items, PhabricatorSavedQuery $query, array $handles) { $viewer = $this->requireViewer(); - $phids = array(); - foreach ($items as $item) { - // $author_phid = $dashboard->getAuthorPHID(); - // if ($author_phid) { - // $phids[] = $author_phid; - // } - } - - $handles = $viewer->loadHandles($phids); - if ($items) { $edge_query = id(new PhabricatorEdgeQuery()) ->withSourcePHIDs(mpull($items, 'getPHID')) ->withEdgeTypes( array( PhabricatorProjectObjectHasProjectEdgeType::EDGECONST, )); $edge_query->execute(); } $list = id(new PHUIObjectItemListView()) ->setViewer($viewer); foreach ($items as $class) { $item = id(new PHUIObjectItemView()) ->setViewer($viewer) - ->setObjectName($item->getObjectName()) - ->setHeader($item->getName()) - ->setHref($item->getURI()) - ->setObject($item); + ->setObjectName($class->getObjectName()) + ->setHeader($class->getName()) + ->setHref($class->getURI()) + ->setObject($class); if ($class->isArchived()) { $item->setDisabled(true); $bg_color = 'bg-grey'; } else { $bg_color = 'bg-dark'; } $icon = id(new PHUIIconView()) ->setIcon($class->getIcon()) ->setBackground($bg_color); $item->setImageIcon($icon); $item->setEpoch($class->getDateModified()); $phid = $class->getPHID(); $project_phids = $edge_query->getDestinationPHIDs(array($phid)); $project_handles = $viewer->loadHandles($project_phids); $item->addAttribute( id(new PHUIHandleTagListView()) ->setLimit(4) ->setNoDataString(pht('No Tags')) ->setSlim(true) ->setHandles($project_handles)); $list->addItem($item); } $result = new PhabricatorApplicationSearchResultView(); $result->setObjectList($list); $result->setNoDataString(pht('No object types found.')); return $result; } }