Differential D20407 Diff 48714 src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php
| <?php | <?php | ||||
| final class PhabricatorDashboardSearchEngine | final class PhabricatorDashboardSearchEngine | ||||
| extends PhabricatorApplicationSearchEngine { | extends PhabricatorApplicationSearchEngine { | ||||
| public function getResultTypeDescription() { | public function getResultTypeDescription() { | ||||
| return pht('Dashboards'); | return pht('Dashboards'); | ||||
| } | } | ||||
| public function getApplicationClassName() { | public function getApplicationClassName() { | ||||
| return 'PhabricatorDashboardApplication'; | return 'PhabricatorDashboardApplication'; | ||||
| } | } | ||||
| public function newQuery() { | public function newQuery() { | ||||
| return id(new PhabricatorDashboardQuery()) | return id(new PhabricatorDashboardQuery()); | ||||
| ->needPanels(true); | |||||
| } | } | ||||
| public function canUseInPanelContext() { | public function canUseInPanelContext() { | ||||
| return false; | return false; | ||||
| } | } | ||||
| protected function buildCustomSearchFields() { | protected function buildCustomSearchFields() { | ||||
| return array( | return array( | ||||
| ▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | foreach ($dashboards as $dashboard) { | ||||
| ->setObject($dashboard); | ->setObject($dashboard); | ||||
| $bg_color = 'bg-dark'; | $bg_color = 'bg-dark'; | ||||
| if ($dashboard->isArchived()) { | if ($dashboard->isArchived()) { | ||||
| $item->setDisabled(true); | $item->setDisabled(true); | ||||
| $bg_color = 'bg-grey'; | $bg_color = 'bg-grey'; | ||||
| } | } | ||||
| $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_color); | ->setBackground($bg_color); | ||||
| $item->setImageIcon($icon); | $item->setImageIcon($icon); | ||||
| $item->setEpoch($dashboard->getDateModified()); | $item->setEpoch($dashboard->getDateModified()); | ||||
| $author_phid = $dashboard->getAuthorPHID(); | $author_phid = $dashboard->getAuthorPHID(); | ||||
| $author_name = $handles[$author_phid]->renderLink(); | $author_name = $handles[$author_phid]->renderLink(); | ||||
| Show All 33 Lines | |||||