diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index fde4f5fca3..d78746df3a 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2448,6 +2448,7 @@ phutil_register_library_map(array( 'PhabricatorDashboardDAO' => 'applications/dashboard/storage/PhabricatorDashboardDAO.php', 'PhabricatorDashboardDashboardHasPanelEdgeType' => 'applications/dashboard/edge/PhabricatorDashboardDashboardHasPanelEdgeType.php', 'PhabricatorDashboardDashboardPHIDType' => 'applications/dashboard/phid/PhabricatorDashboardDashboardPHIDType.php', + 'PhabricatorDashboardDatasource' => 'applications/dashboard/typeahead/PhabricatorDashboardDatasource.php', 'PhabricatorDashboardEditController' => 'applications/dashboard/controller/PhabricatorDashboardEditController.php', 'PhabricatorDashboardIconSet' => 'applications/dashboard/icon/PhabricatorDashboardIconSet.php', 'PhabricatorDashboardInstall' => 'applications/dashboard/storage/PhabricatorDashboardInstall.php', @@ -2460,6 +2461,7 @@ phutil_register_library_map(array( 'PhabricatorDashboardPanelArchiveController' => 'applications/dashboard/controller/PhabricatorDashboardPanelArchiveController.php', 'PhabricatorDashboardPanelCoreCustomField' => 'applications/dashboard/customfield/PhabricatorDashboardPanelCoreCustomField.php', 'PhabricatorDashboardPanelCustomField' => 'applications/dashboard/customfield/PhabricatorDashboardPanelCustomField.php', + 'PhabricatorDashboardPanelDatasource' => 'applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php', 'PhabricatorDashboardPanelEditConduitAPIMethod' => 'applications/dashboard/conduit/PhabricatorDashboardPanelEditConduitAPIMethod.php', 'PhabricatorDashboardPanelEditController' => 'applications/dashboard/controller/PhabricatorDashboardPanelEditController.php', 'PhabricatorDashboardPanelEditEngine' => 'applications/dashboard/editor/PhabricatorDashboardPanelEditEngine.php', @@ -7412,6 +7414,7 @@ phutil_register_library_map(array( 'PhabricatorDashboardDAO' => 'PhabricatorLiskDAO', 'PhabricatorDashboardDashboardHasPanelEdgeType' => 'PhabricatorEdgeType', 'PhabricatorDashboardDashboardPHIDType' => 'PhabricatorPHIDType', + 'PhabricatorDashboardDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorDashboardEditController' => 'PhabricatorDashboardController', 'PhabricatorDashboardIconSet' => 'PhabricatorIconSet', 'PhabricatorDashboardInstall' => 'PhabricatorDashboardDAO', @@ -7434,6 +7437,7 @@ phutil_register_library_map(array( 'PhabricatorStandardCustomFieldInterface', ), 'PhabricatorDashboardPanelCustomField' => 'PhabricatorCustomField', + 'PhabricatorDashboardPanelDatasource' => 'PhabricatorTypeaheadDatasource', 'PhabricatorDashboardPanelEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', 'PhabricatorDashboardPanelEditController' => 'PhabricatorDashboardController', 'PhabricatorDashboardPanelEditEngine' => 'PhabricatorEditEngine', diff --git a/src/applications/dashboard/typeahead/PhabricatorDashboardDatasource.php b/src/applications/dashboard/typeahead/PhabricatorDashboardDatasource.php new file mode 100644 index 0000000000..a1c0399624 --- /dev/null +++ b/src/applications/dashboard/typeahead/PhabricatorDashboardDatasource.php @@ -0,0 +1,39 @@ +executeQuery($query); + $results = array(); + foreach ($dashboards as $dashboard) { + $result = id(new PhabricatorTypeaheadResult()) + ->setName($dashboard->getName()) + ->setPHID($dashboard->getPHID()) + ->addAttribute(pht('Dashboard')); + + if ($dashboard->isArchived()) { + $result->setClosed(pht('Archived')); + } + + $results[] = $result; + } + + return $this->filterResultsAgainstTokens($results); + } + +} diff --git a/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php b/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php new file mode 100644 index 0000000000..35c8c5c212 --- /dev/null +++ b/src/applications/dashboard/typeahead/PhabricatorDashboardPanelDatasource.php @@ -0,0 +1,46 @@ +executeQuery($query); + $results = array(); + foreach ($panels as $panel) { + $impl = $panel->getImplementation(); + if ($impl) { + $type_text = $impl->getPanelTypeName(); + } else { + $type_text = nonempty($panel->getPanelType(), pht('Unknown Type')); + } + + $result = id(new PhabricatorTypeaheadResult()) + ->setName($panel->getName()) + ->setPHID($panel->getPHID()) + ->addAttribute($type_text); + + if ($panel->getIsArchived()) { + $result->setClosed(pht('Archived')); + } + + $results[] = $result; + } + + return $this->filterResultsAgainstTokens($results); + } + +}