mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-30 02:32:42 +01:00
Add more information to Dashboard ApplicationSearch list
Summary: Fixes T4984. This is about as fancy as I want to get this pass. Adds in the list of panel titles and the author. This does give me a rough idea what's on each dashboard. Test Plan: Visit a list of dashboards and see various authors and panels. {F2810876} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T4984 Differential Revision: https://secure.phabricator.com/D17340
This commit is contained in:
parent
8dd7b544fe
commit
5a850ab235
1 changed files with 21 additions and 21 deletions
|
@ -13,7 +13,7 @@ final class PhabricatorDashboardSearchEngine
|
||||||
|
|
||||||
public function newQuery() {
|
public function newQuery() {
|
||||||
return id(new PhabricatorDashboardQuery())
|
return id(new PhabricatorDashboardQuery())
|
||||||
->needProjects(true);
|
->needPanels(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildCustomSearchFields() {
|
protected function buildCustomSearchFields() {
|
||||||
|
@ -98,25 +98,22 @@ final class PhabricatorDashboardSearchEngine
|
||||||
PhabricatorSavedQuery $query,
|
PhabricatorSavedQuery $query,
|
||||||
array $handles) {
|
array $handles) {
|
||||||
|
|
||||||
$dashboards = mpull($dashboards, null, 'getPHID');
|
|
||||||
$viewer = $this->requireViewer();
|
$viewer = $this->requireViewer();
|
||||||
|
|
||||||
$proj_phids = array();
|
$phids = array();
|
||||||
foreach ($dashboards as $dashboard) {
|
foreach ($dashboards as $dashboard) {
|
||||||
foreach ($dashboard->getProjectPHIDs() as $project_phid) {
|
$author_phid = $dashboard->getAuthorPHID();
|
||||||
$proj_phids[] = $project_phid;
|
if ($author_phid) {
|
||||||
|
$phids[] = $author_phid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$proj_handles = id(new PhabricatorHandleQuery())
|
$handles = $viewer->loadHandles($phids);
|
||||||
->setViewer($viewer)
|
|
||||||
->withPHIDs($proj_phids)
|
|
||||||
->execute();
|
|
||||||
|
|
||||||
$list = id(new PHUIObjectItemListView())
|
$list = id(new PHUIObjectItemListView())
|
||||||
->setUser($viewer);
|
->setUser($viewer);
|
||||||
|
|
||||||
foreach ($dashboards as $dashboard_phid => $dashboard) {
|
foreach ($dashboards as $dashboard) {
|
||||||
$id = $dashboard->getID();
|
$id = $dashboard->getID();
|
||||||
|
|
||||||
$item = id(new PHUIObjectItemView())
|
$item = id(new PHUIObjectItemView())
|
||||||
|
@ -125,27 +122,30 @@ final class PhabricatorDashboardSearchEngine
|
||||||
->setHref($this->getApplicationURI("view/{$id}/"))
|
->setHref($this->getApplicationURI("view/{$id}/"))
|
||||||
->setObject($dashboard);
|
->setObject($dashboard);
|
||||||
|
|
||||||
$project_handles = array_select_keys(
|
|
||||||
$proj_handles,
|
|
||||||
$dashboard->getProjectPHIDs());
|
|
||||||
|
|
||||||
$item->addAttribute(
|
|
||||||
id(new PHUIHandleTagListView())
|
|
||||||
->setLimit(4)
|
|
||||||
->setNoDataString(pht('No Projects'))
|
|
||||||
->setSlim(true)
|
|
||||||
->setHandles($project_handles));
|
|
||||||
|
|
||||||
if ($dashboard->isArchived()) {
|
if ($dashboard->isArchived()) {
|
||||||
$item->setDisabled(true);
|
$item->setDisabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$panels = $dashboard->getPanels();
|
||||||
|
foreach ($panels as $panel) {
|
||||||
|
$item->addAttribute($panel->getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($panels)) {
|
||||||
|
$empty = phutil_tag('em', array(), pht('No panels.'));
|
||||||
|
$item->addAttribute($empty);
|
||||||
|
}
|
||||||
|
|
||||||
$icon = id(new PHUIIconView())
|
$icon = id(new PHUIIconView())
|
||||||
->setIcon($dashboard->getIcon())
|
->setIcon($dashboard->getIcon())
|
||||||
->setBackground('bg-dark');
|
->setBackground('bg-dark');
|
||||||
$item->setImageIcon($icon);
|
$item->setImageIcon($icon);
|
||||||
$item->setEpoch($dashboard->getDateModified());
|
$item->setEpoch($dashboard->getDateModified());
|
||||||
|
|
||||||
|
$author_phid = $dashboard->getAuthorPHID();
|
||||||
|
$author_name = $handles[$author_phid]->renderLink();
|
||||||
|
$item->addByline(pht('Author: %s', $author_name));
|
||||||
|
|
||||||
$list->addItem($item);
|
$list->addItem($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue