mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-19 03:01:11 +01:00
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
This commit is contained in:
parent
46405064e9
commit
c6a68aadc0
2 changed files with 31 additions and 24 deletions
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorDashboardListController
|
||||
extends PhabricatorDashboardController
|
||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
||||
extends PhabricatorDashboardController {
|
||||
|
||||
private $queryKey;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue