mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Add "Installed" icon to Dashboard list view.
Summary: Fixes T5478. For "personal" installs use the person icon; for global use the global icon. For both providing explanatory tooltip text about what's going on. This will need to be updated if / when we start installing dashboards to other applications. Also, this query isn't 100% optimized but the major part *is* so I think its okay. Test Plan: Installed a dashboard for personal use and verified correct icon / text showed up. Did the same for global installed dashboard...! Reviewers: epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T5478 Differential Revision: https://secure.phabricator.com/D10181
This commit is contained in:
parent
6a69b4699e
commit
7388351aab
1 changed files with 27 additions and 1 deletions
|
@ -53,11 +53,22 @@ final class PhabricatorDashboardSearchEngine
|
|||
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())
|
||||
|
@ -66,6 +77,21 @@ final class PhabricatorDashboardSearchEngine
|
|||
->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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue