From c6a68aadc08f4a4a672a7768ab8897da7b4590b4 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 8 May 2014 09:31:33 -0700 Subject: [PATCH] Move dashboard list rendering to ApplicationSearch Summary: Ref T4986. This is "good" and "desirable". Test Plan: Saw dashboard list, panel. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T4986 Differential Revision: https://secure.phabricator.com/D9015 --- .../PhabricatorDashboardListController.php | 26 ++--------------- .../PhabricatorDashboardSearchEngine.php | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/src/applications/dashboard/controller/PhabricatorDashboardListController.php b/src/applications/dashboard/controller/PhabricatorDashboardListController.php index 0f9b7ba7d6..8a01722bbb 100644 --- a/src/applications/dashboard/controller/PhabricatorDashboardListController.php +++ b/src/applications/dashboard/controller/PhabricatorDashboardListController.php @@ -1,10 +1,10 @@ queryKey = idx($data, 'queryKey'); } @@ -48,26 +48,4 @@ final class PhabricatorDashboardListController return $crumbs; } - public function renderResultsList( - array $dashboards, - PhabricatorSavedQuery $query) { - $viewer = $this->getRequest()->getUser(); - - $list = new PHUIObjectItemListView(); - $list->setUser($viewer); - foreach ($dashboards as $dashboard) { - $id = $dashboard->getID(); - - $item = id(new PHUIObjectItemView()) - ->setObjectName(pht('Dashboard %d', $id)) - ->setHeader($dashboard->getName()) - ->setHref($this->getApplicationURI("view/{$id}/")) - ->setObject($dashboard); - - $list->addItem($item); - } - - return $list; - } - } diff --git a/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php b/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php index 961a7e5f57..730425d9ed 100644 --- a/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php +++ b/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorDashboardSearchEngine extends PhabricatorApplicationSearchEngine { + public function getApplicationClassName() { + return 'PhabricatorApplicationDashboard'; + } + public function buildSavedQueryFromRequest(AphrontRequest $request) { $saved = new PhabricatorSavedQuery(); @@ -46,4 +50,29 @@ final class PhabricatorDashboardSearchEngine return parent::buildSavedQueryFromBuiltin($query_key); } + + protected function renderResultList( + array $dashboards, + PhabricatorSavedQuery $query, + array $handles) { + + $viewer = $this->requireViewer(); + + $list = new PHUIObjectItemListView(); + $list->setUser($viewer); + foreach ($dashboards as $dashboard) { + $id = $dashboard->getID(); + + $item = id(new PHUIObjectItemView()) + ->setObjectName(pht('Dashboard %d', $id)) + ->setHeader($dashboard->getName()) + ->setHref($this->getApplicationURI("view/{$id}/")) + ->setObject($dashboard); + + $list->addItem($item); + } + + return $list; + } + }