Page MenuHomePhorge

No OneTemporary

diff --git a/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php b/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php
index f592c15f37..8d76cadcec 100644
--- a/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php
+++ b/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php
@@ -1,75 +1,101 @@
<?php
final class PhabricatorDashboardSearchEngine
extends PhabricatorApplicationSearchEngine {
public function getResultTypeDescription() {
return pht('Dashboards');
}
public function getApplicationClassName() {
return 'PhabricatorDashboardApplication';
}
public function buildSavedQueryFromRequest(AphrontRequest $request) {
return new PhabricatorSavedQuery();
}
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
return new PhabricatorDashboardQuery();
}
public function buildSearchForm(
AphrontFormView $form,
PhabricatorSavedQuery $saved_query) {
return;
}
protected function getURI($path) {
return '/dashboard/'.$path;
}
public function getBuiltinQueryNames() {
return array(
'all' => pht('All Dashboards'),
);
}
public function buildSavedQueryFromBuiltin($query_key) {
$query = $this->newSavedQuery();
$query->setQueryKey($query_key);
switch ($query_key) {
case 'all':
return $query;
}
return parent::buildSavedQueryFromBuiltin($query_key);
}
protected function renderResultList(
array $dashboards,
PhabricatorSavedQuery $query,
array $handles) {
+ $dashboards = mpull($dashboards, null, 'getPHID');
$viewer = $this->requireViewer();
+ $installs = id(new PhabricatorDashboardInstall())
+ ->loadAllWhere(
+ 'objectPHID IN (%Ls) AND dashboardPHID IN (%Ls)',
+ array(PhabricatorHomeApplication::DASHBOARD_DEFAULT,
+ $viewer->getPHID()),
+ array_keys($dashboards));
+ $installs = mpull($installs, null, 'getDashboardPHID');
$list = new PHUIObjectItemListView();
$list->setUser($viewer);
- foreach ($dashboards as $dashboard) {
+ $list->initBehavior('phabricator-tooltips', array());
+ $list->requireResource('aphront-tooltip-css');
+
+ foreach ($dashboards as $dashboard_phid => $dashboard) {
$id = $dashboard->getID();
$item = id(new PHUIObjectItemView())
->setObjectName(pht('Dashboard %d', $id))
->setHeader($dashboard->getName())
->setHref($this->getApplicationURI("view/{$id}/"))
->setObject($dashboard);
+ if (isset($installs[$dashboard_phid])) {
+ $install = $installs[$dashboard_phid];
+ if ($install->getObjectPHID() == $viewer->getPHID()) {
+ $attrs = array(
+ 'tip' => pht(
+ 'This dashboard is installed to your personal homepage.'));
+ $item->addIcon('fa-user', pht('Installed'), $attrs);
+ } else {
+ $attrs = array(
+ 'tip' => pht(
+ 'This dashboard is the default homepage for all users.'));
+ $item->addIcon('fa-globe', pht('Installed'), $attrs);
+ }
+ }
+
$list->addItem($item);
}
return $list;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Jan 19, 12:25 (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1124539
Default Alt Text
(3 KB)

Event Timeline