From b8bc0aa2b058fd142bde13395efb6541c67dfb50 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 12 Jun 2014 13:22:20 -0700 Subject: [PATCH] Allow users to select QueryPanel search engines from a list Summary: Ref T4986. Instead of requiring users to know the name of an application search engine class, let them select from a list. Test Plan: Created a new panel. {F165468} Reviewers: chad Reviewed By: chad Subscribers: epriestley Maniphest Tasks: T4986 Differential Revision: https://secure.phabricator.com/D9500 --- src/__phutil_library_map__.php | 2 + .../query/PhabricatorCommitSearchEngine.php | 4 ++ .../PhabricatorCalendarEventSearchEngine.php | 4 ++ .../query/PhabricatorConduitSearchEngine.php | 4 ++ .../PhabricatorCountdownSearchEngine.php | 4 ++ ...boardPanelSearchApplicationCustomField.php | 40 +++++++++++++++++++ .../PhabricatorDashboardPanelTypeQuery.php | 6 +-- .../PhabricatorDashboardPanelSearchEngine.php | 4 ++ .../PhabricatorDashboardSearchEngine.php | 4 ++ .../DifferentialRevisionSearchEngine.php | 4 ++ .../diviner/query/DivinerAtomSearchEngine.php | 4 ++ .../query/DrydockBlueprintSearchEngine.php | 4 ++ .../query/DrydockLeaseSearchEngine.php | 4 ++ .../drydock/query/DrydockLogSearchEngine.php | 4 ++ .../query/DrydockResourceSearchEngine.php | 4 ++ .../query/PhabricatorFeedSearchEngine.php | 4 ++ .../query/PhabricatorFileSearchEngine.php | 4 ++ .../query/PhabricatorFlagSearchEngine.php | 4 ++ .../HarbormasterBuildPlanSearchEngine.php | 4 ++ .../HarbormasterBuildableSearchEngine.php | 4 ++ .../herald/query/HeraldRuleSearchEngine.php | 4 ++ .../query/HeraldTranscriptSearchEngine.php | 4 ++ .../query/LegalpadDocumentSearchEngine.php | 4 ++ .../query/PhabricatorMacroSearchEngine.php | 4 ++ .../PhabricatorMailingListSearchEngine.php | 4 ++ .../query/ManiphestTaskSearchEngine.php | 4 ++ .../meta/query/PhabricatorAppSearchEngine.php | 4 ++ ...abricatorOAuthServerClientSearchEngine.php | 4 ++ .../PassphraseCredentialSearchEngine.php | 4 ++ .../query/PhabricatorPasteSearchEngine.php | 4 ++ .../PhabricatorPeopleLogSearchEngine.php | 4 ++ .../query/PhabricatorPeopleSearchEngine.php | 4 ++ .../pholio/query/PholioMockSearchEngine.php | 4 ++ .../phrequent/query/PhrequentSearchEngine.php | 4 ++ .../phriction/query/PhrictionSearchEngine.php | 4 ++ .../query/PonderQuestionSearchEngine.php | 4 ++ .../query/PhabricatorProjectSearchEngine.php | 4 ++ .../query/ReleephBranchSearchEngine.php | 4 ++ .../query/ReleephProductSearchEngine.php | 4 ++ .../query/ReleephRequestSearchEngine.php | 4 ++ ...abricatorRepositoryPushLogSearchEngine.php | 4 ++ .../PhabricatorRepositorySearchEngine.php | 4 ++ .../PhabricatorApplicationSearchEngine.php | 12 ++++++ ...abricatorSearchApplicationSearchEngine.php | 4 ++ .../query/PhabricatorSlowvoteSearchEngine.php | 4 ++ 45 files changed, 221 insertions(+), 3 deletions(-) create mode 100644 src/applications/dashboard/customfield/PhabricatorDashboardPanelSearchApplicationCustomField.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index d4e2b88822..b8135b06ab 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1495,6 +1495,7 @@ phutil_register_library_map(array( 'PhabricatorDashboardPanelQuery' => 'applications/dashboard/query/PhabricatorDashboardPanelQuery.php', 'PhabricatorDashboardPanelRenderController' => 'applications/dashboard/controller/PhabricatorDashboardPanelRenderController.php', 'PhabricatorDashboardPanelRenderingEngine' => 'applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php', + 'PhabricatorDashboardPanelSearchApplicationCustomField' => 'applications/dashboard/customfield/PhabricatorDashboardPanelSearchApplicationCustomField.php', 'PhabricatorDashboardPanelSearchEngine' => 'applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php', 'PhabricatorDashboardPanelTransaction' => 'applications/dashboard/storage/PhabricatorDashboardPanelTransaction.php', 'PhabricatorDashboardPanelTransactionEditor' => 'applications/dashboard/editor/PhabricatorDashboardPanelTransactionEditor.php', @@ -4319,6 +4320,7 @@ phutil_register_library_map(array( 'PhabricatorDashboardPanelQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorDashboardPanelRenderController' => 'PhabricatorDashboardController', 'PhabricatorDashboardPanelRenderingEngine' => 'Phobject', + 'PhabricatorDashboardPanelSearchApplicationCustomField' => 'PhabricatorStandardCustomField', 'PhabricatorDashboardPanelSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhabricatorDashboardPanelTransaction' => 'PhabricatorApplicationTransaction', 'PhabricatorDashboardPanelTransactionEditor' => 'PhabricatorApplicationTransactionEditor', diff --git a/src/applications/audit/query/PhabricatorCommitSearchEngine.php b/src/applications/audit/query/PhabricatorCommitSearchEngine.php index 837e665824..0a76163264 100644 --- a/src/applications/audit/query/PhabricatorCommitSearchEngine.php +++ b/src/applications/audit/query/PhabricatorCommitSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorCommitSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Commits'); + } + public function buildSavedQueryFromRequest(AphrontRequest $request) { $saved = new PhabricatorSavedQuery(); diff --git a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php index bb8f1d8628..c2f5674af5 100644 --- a/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php +++ b/src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorCalendarEventSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Calendar Events'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationCalendar'; } diff --git a/src/applications/conduit/query/PhabricatorConduitSearchEngine.php b/src/applications/conduit/query/PhabricatorConduitSearchEngine.php index 9e84de3078..6a62e1e56f 100644 --- a/src/applications/conduit/query/PhabricatorConduitSearchEngine.php +++ b/src/applications/conduit/query/PhabricatorConduitSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorConduitSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Conduit Methods'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationConduit'; } diff --git a/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php b/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php index 427485401f..d0fc715683 100644 --- a/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php +++ b/src/applications/countdown/query/PhabricatorCountdownSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorCountdownSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Countdowns'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationCountdown'; } diff --git a/src/applications/dashboard/customfield/PhabricatorDashboardPanelSearchApplicationCustomField.php b/src/applications/dashboard/customfield/PhabricatorDashboardPanelSearchApplicationCustomField.php new file mode 100644 index 0000000000..97899359d1 --- /dev/null +++ b/src/applications/dashboard/customfield/PhabricatorDashboardPanelSearchApplicationCustomField.php @@ -0,0 +1,40 @@ +setAncestorClass('PhabricatorApplicationSearchEngine') + ->loadObjects(); + + $options = array(); + + $value = $this->getFieldValue(); + if (strlen($value) && empty($engines[$value])) { + $options[$value] = $value; + } + + $engines = msort($engines, 'getResultTypeDescription'); + foreach ($engines as $class_name => $engine) { + $options[$class_name] = $engine->getResultTypeDescription(); + } + + return id(new AphrontFormSelectControl()) + ->setLabel($this->getFieldName()) + ->setCaption($this->getCaption()) + ->setName($this->getFieldKey()) + ->setValue($this->getFieldValue()) + ->setOptions($options); + } + +} diff --git a/src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeQuery.php b/src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeQuery.php index b7eb8b283a..040a3ade1f 100644 --- a/src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeQuery.php +++ b/src/applications/dashboard/paneltype/PhabricatorDashboardPanelTypeQuery.php @@ -20,11 +20,11 @@ final class PhabricatorDashboardPanelTypeQuery public function getFieldSpecifications() { return array( 'class' => array( - 'name' => pht('ApplicationSearch Class'), - 'type' => 'text', + 'name' => pht('Search For'), + 'type' => 'search.application', ), 'key' => array( - 'name' => pht('ApplicationSearch Key'), + 'name' => pht('Query'), 'type' => 'text', ), 'limit' => array( diff --git a/src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php b/src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php index fc766fa2a1..261a2b3d45 100644 --- a/src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php +++ b/src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorDashboardPanelSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Dashboard Panels'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationDashboard'; } diff --git a/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php b/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php index 730425d9ed..0aa6246902 100644 --- a/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php +++ b/src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorDashboardSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Dashboards'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationDashboard'; } diff --git a/src/applications/differential/query/DifferentialRevisionSearchEngine.php b/src/applications/differential/query/DifferentialRevisionSearchEngine.php index 27869d3dfd..1b1338aeac 100644 --- a/src/applications/differential/query/DifferentialRevisionSearchEngine.php +++ b/src/applications/differential/query/DifferentialRevisionSearchEngine.php @@ -3,6 +3,10 @@ final class DifferentialRevisionSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Differential Revisions'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationDifferential'; } diff --git a/src/applications/diviner/query/DivinerAtomSearchEngine.php b/src/applications/diviner/query/DivinerAtomSearchEngine.php index 2ae82ae06c..4d22b32dc5 100644 --- a/src/applications/diviner/query/DivinerAtomSearchEngine.php +++ b/src/applications/diviner/query/DivinerAtomSearchEngine.php @@ -3,6 +3,10 @@ final class DivinerAtomSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Documentation Atoms'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationDiviner'; } diff --git a/src/applications/drydock/query/DrydockBlueprintSearchEngine.php b/src/applications/drydock/query/DrydockBlueprintSearchEngine.php index 962cf38efb..a40bc3f47d 100644 --- a/src/applications/drydock/query/DrydockBlueprintSearchEngine.php +++ b/src/applications/drydock/query/DrydockBlueprintSearchEngine.php @@ -3,6 +3,10 @@ final class DrydockBlueprintSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Drydock Blueprints'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationDrydock'; } diff --git a/src/applications/drydock/query/DrydockLeaseSearchEngine.php b/src/applications/drydock/query/DrydockLeaseSearchEngine.php index 3b0e744873..8339669a6a 100644 --- a/src/applications/drydock/query/DrydockLeaseSearchEngine.php +++ b/src/applications/drydock/query/DrydockLeaseSearchEngine.php @@ -3,6 +3,10 @@ final class DrydockLeaseSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Drydock Leases'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationDrydock'; } diff --git a/src/applications/drydock/query/DrydockLogSearchEngine.php b/src/applications/drydock/query/DrydockLogSearchEngine.php index 69cd2a5c55..e3f83731f3 100644 --- a/src/applications/drydock/query/DrydockLogSearchEngine.php +++ b/src/applications/drydock/query/DrydockLogSearchEngine.php @@ -3,6 +3,10 @@ final class DrydockLogSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Drydock Logs'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationDrydock'; } diff --git a/src/applications/drydock/query/DrydockResourceSearchEngine.php b/src/applications/drydock/query/DrydockResourceSearchEngine.php index 3489bfa547..82d5dc8e5f 100644 --- a/src/applications/drydock/query/DrydockResourceSearchEngine.php +++ b/src/applications/drydock/query/DrydockResourceSearchEngine.php @@ -3,6 +3,10 @@ final class DrydockResourceSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Drydock Resources'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationDrydock'; } diff --git a/src/applications/feed/query/PhabricatorFeedSearchEngine.php b/src/applications/feed/query/PhabricatorFeedSearchEngine.php index 3c8ce59a76..9633013008 100644 --- a/src/applications/feed/query/PhabricatorFeedSearchEngine.php +++ b/src/applications/feed/query/PhabricatorFeedSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorFeedSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Feed Stories'); + } + public function buildSavedQueryFromRequest(AphrontRequest $request) { $saved = new PhabricatorSavedQuery(); diff --git a/src/applications/files/query/PhabricatorFileSearchEngine.php b/src/applications/files/query/PhabricatorFileSearchEngine.php index 2b638c5493..51d2188a21 100644 --- a/src/applications/files/query/PhabricatorFileSearchEngine.php +++ b/src/applications/files/query/PhabricatorFileSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorFileSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Files'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationFiles'; } diff --git a/src/applications/flag/query/PhabricatorFlagSearchEngine.php b/src/applications/flag/query/PhabricatorFlagSearchEngine.php index 9e1883b0d3..d5b14fa05b 100644 --- a/src/applications/flag/query/PhabricatorFlagSearchEngine.php +++ b/src/applications/flag/query/PhabricatorFlagSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorFlagSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Flags'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationFlags'; } diff --git a/src/applications/harbormaster/query/HarbormasterBuildPlanSearchEngine.php b/src/applications/harbormaster/query/HarbormasterBuildPlanSearchEngine.php index 7a086bc675..130d5a45b8 100644 --- a/src/applications/harbormaster/query/HarbormasterBuildPlanSearchEngine.php +++ b/src/applications/harbormaster/query/HarbormasterBuildPlanSearchEngine.php @@ -3,6 +3,10 @@ final class HarbormasterBuildPlanSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Harbormaster Build Plans'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationHarbormaster'; } diff --git a/src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php b/src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php index e162bc0768..77be18046e 100644 --- a/src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php +++ b/src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php @@ -3,6 +3,10 @@ final class HarbormasterBuildableSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Harbormaster Buildables'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationHarbormaster'; } diff --git a/src/applications/herald/query/HeraldRuleSearchEngine.php b/src/applications/herald/query/HeraldRuleSearchEngine.php index 025536c5b5..4b009a113f 100644 --- a/src/applications/herald/query/HeraldRuleSearchEngine.php +++ b/src/applications/herald/query/HeraldRuleSearchEngine.php @@ -3,6 +3,10 @@ final class HeraldRuleSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Herald Rules'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationHerald'; } diff --git a/src/applications/herald/query/HeraldTranscriptSearchEngine.php b/src/applications/herald/query/HeraldTranscriptSearchEngine.php index 46f97d99cc..ade6fc959c 100644 --- a/src/applications/herald/query/HeraldTranscriptSearchEngine.php +++ b/src/applications/herald/query/HeraldTranscriptSearchEngine.php @@ -3,6 +3,10 @@ final class HeraldTranscriptSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Herald Transcripts'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationHerald'; } diff --git a/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php b/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php index cafe4cf67d..72270e6ac3 100644 --- a/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php +++ b/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php @@ -3,6 +3,10 @@ final class LegalpadDocumentSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Legalpad Documents'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationLegalpad'; } diff --git a/src/applications/macro/query/PhabricatorMacroSearchEngine.php b/src/applications/macro/query/PhabricatorMacroSearchEngine.php index 0480db4927..472c2c07e3 100644 --- a/src/applications/macro/query/PhabricatorMacroSearchEngine.php +++ b/src/applications/macro/query/PhabricatorMacroSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorMacroSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Macros'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationMacro'; } diff --git a/src/applications/mailinglists/query/PhabricatorMailingListSearchEngine.php b/src/applications/mailinglists/query/PhabricatorMailingListSearchEngine.php index f57fe59128..78df9dd367 100644 --- a/src/applications/mailinglists/query/PhabricatorMailingListSearchEngine.php +++ b/src/applications/mailinglists/query/PhabricatorMailingListSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorMailingListSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Mailing Lists'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationMailingLists'; } diff --git a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php index 241bd2ae45..4372996aa8 100644 --- a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php +++ b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php @@ -30,6 +30,10 @@ final class ManiphestTaskSearchEngine return $this; } + public function getResultTypeDescription() { + return pht('Tasks'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationManiphest'; } diff --git a/src/applications/meta/query/PhabricatorAppSearchEngine.php b/src/applications/meta/query/PhabricatorAppSearchEngine.php index 77df88ecb0..c456c535ca 100644 --- a/src/applications/meta/query/PhabricatorAppSearchEngine.php +++ b/src/applications/meta/query/PhabricatorAppSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorAppSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Applications'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationApplications'; } diff --git a/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php b/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php index 1c722f99f6..25323f5129 100644 --- a/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php +++ b/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorOAuthServerClientSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('OAuth Clients'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationOAuthServer'; } diff --git a/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php b/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php index 6028547b50..03198e2f22 100644 --- a/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php +++ b/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php @@ -3,6 +3,10 @@ final class PassphraseCredentialSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Passphrase Credentials'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationPassphrase'; } diff --git a/src/applications/paste/query/PhabricatorPasteSearchEngine.php b/src/applications/paste/query/PhabricatorPasteSearchEngine.php index 18e63e3b2e..b589b25907 100644 --- a/src/applications/paste/query/PhabricatorPasteSearchEngine.php +++ b/src/applications/paste/query/PhabricatorPasteSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorPasteSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Pastes'); + } + public function buildSavedQueryFromRequest(AphrontRequest $request) { $saved = new PhabricatorSavedQuery(); $saved->setParameter( diff --git a/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php b/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php index 37ef51947e..8af0e65838 100644 --- a/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php +++ b/src/applications/people/query/PhabricatorPeopleLogSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorPeopleLogSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Account Activity'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationPeople'; } diff --git a/src/applications/people/query/PhabricatorPeopleSearchEngine.php b/src/applications/people/query/PhabricatorPeopleSearchEngine.php index 7d16b4fb73..6021815a11 100644 --- a/src/applications/people/query/PhabricatorPeopleSearchEngine.php +++ b/src/applications/people/query/PhabricatorPeopleSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorPeopleSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Users'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationPeople'; } diff --git a/src/applications/pholio/query/PholioMockSearchEngine.php b/src/applications/pholio/query/PholioMockSearchEngine.php index 822d318f99..7ac2363eea 100644 --- a/src/applications/pholio/query/PholioMockSearchEngine.php +++ b/src/applications/pholio/query/PholioMockSearchEngine.php @@ -3,6 +3,10 @@ final class PholioMockSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Pholio Mocks'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationPholio'; } diff --git a/src/applications/phrequent/query/PhrequentSearchEngine.php b/src/applications/phrequent/query/PhrequentSearchEngine.php index 79002b70a3..6092659309 100644 --- a/src/applications/phrequent/query/PhrequentSearchEngine.php +++ b/src/applications/phrequent/query/PhrequentSearchEngine.php @@ -3,6 +3,10 @@ final class PhrequentSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Phrequent Time'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationPhrequent'; } diff --git a/src/applications/phriction/query/PhrictionSearchEngine.php b/src/applications/phriction/query/PhrictionSearchEngine.php index 2cdee9f742..9e9a64d2d4 100644 --- a/src/applications/phriction/query/PhrictionSearchEngine.php +++ b/src/applications/phriction/query/PhrictionSearchEngine.php @@ -3,6 +3,10 @@ final class PhrictionSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Wiki Documents'); + } + public function buildSavedQueryFromRequest(AphrontRequest $request) { $saved = new PhabricatorSavedQuery(); diff --git a/src/applications/ponder/query/PonderQuestionSearchEngine.php b/src/applications/ponder/query/PonderQuestionSearchEngine.php index 6dcba96cf0..9592341530 100644 --- a/src/applications/ponder/query/PonderQuestionSearchEngine.php +++ b/src/applications/ponder/query/PonderQuestionSearchEngine.php @@ -3,6 +3,10 @@ final class PonderQuestionSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Ponder Questions'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationPonder'; } diff --git a/src/applications/project/query/PhabricatorProjectSearchEngine.php b/src/applications/project/query/PhabricatorProjectSearchEngine.php index 3f705c7a63..55fc6caa3e 100644 --- a/src/applications/project/query/PhabricatorProjectSearchEngine.php +++ b/src/applications/project/query/PhabricatorProjectSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorProjectSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Projects'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationProject'; } diff --git a/src/applications/releeph/query/ReleephBranchSearchEngine.php b/src/applications/releeph/query/ReleephBranchSearchEngine.php index 0476a8d2c9..46e3219890 100644 --- a/src/applications/releeph/query/ReleephBranchSearchEngine.php +++ b/src/applications/releeph/query/ReleephBranchSearchEngine.php @@ -5,6 +5,10 @@ final class ReleephBranchSearchEngine private $product; + public function getResultTypeDescription() { + return pht('Releeph Branches'); + } + public function setProduct(ReleephProject $product) { $this->product = $product; return $this; diff --git a/src/applications/releeph/query/ReleephProductSearchEngine.php b/src/applications/releeph/query/ReleephProductSearchEngine.php index 23f198139b..9db638edc6 100644 --- a/src/applications/releeph/query/ReleephProductSearchEngine.php +++ b/src/applications/releeph/query/ReleephProductSearchEngine.php @@ -3,6 +3,10 @@ final class ReleephProductSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Releeph Products'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationReleeph'; } diff --git a/src/applications/releeph/query/ReleephRequestSearchEngine.php b/src/applications/releeph/query/ReleephRequestSearchEngine.php index 53db39f630..cbae3ab65a 100644 --- a/src/applications/releeph/query/ReleephRequestSearchEngine.php +++ b/src/applications/releeph/query/ReleephRequestSearchEngine.php @@ -6,6 +6,10 @@ final class ReleephRequestSearchEngine private $branch; private $baseURI; + public function getResultTypeDescription() { + return pht('Releeph Pull Requests'); + } + public function setBranch(ReleephBranch $branch) { $this->branch = $branch; return $this; diff --git a/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php b/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php index 5388e3149f..6757e9715f 100644 --- a/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php +++ b/src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorRepositoryPushLogSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Push Logs'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationDiffusion'; } diff --git a/src/applications/repository/query/PhabricatorRepositorySearchEngine.php b/src/applications/repository/query/PhabricatorRepositorySearchEngine.php index bb3aee78d4..594a6509ec 100644 --- a/src/applications/repository/query/PhabricatorRepositorySearchEngine.php +++ b/src/applications/repository/query/PhabricatorRepositorySearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorRepositorySearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Repositories'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationDiffusion'; } diff --git a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php index 1626a1d91f..0869739d6d 100644 --- a/src/applications/search/engine/PhabricatorApplicationSearchEngine.php +++ b/src/applications/search/engine/PhabricatorApplicationSearchEngine.php @@ -120,6 +120,18 @@ abstract class PhabricatorApplicationSearchEngine { abstract protected function getURI($path); + /** + * Return a human readable description of the type of objects this query + * searches for. + * + * For example, "Tasks" or "Commits". + * + * @return string Human-readable description of what this engine is used to + * find. + */ + abstract public function getResultTypeDescription(); + + public function newSavedQuery() { return id(new PhabricatorSavedQuery()) ->setEngineClassName(get_class($this)); diff --git a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php index 2263b0290d..477aba5290 100644 --- a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php +++ b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorSearchApplicationSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Fulltext Results'); + } + public function getApplicationClassName() { return 'PhabricatorApplicationSearch'; } diff --git a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php index 708af75e5c..d822e740be 100644 --- a/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php +++ b/src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php @@ -3,6 +3,10 @@ final class PhabricatorSlowvoteSearchEngine extends PhabricatorApplicationSearchEngine { + public function getResultTypeDescription() { + return pht('Slowvotes'); + } + public function buildSavedQueryFromRequest(AphrontRequest $request) { $saved = new PhabricatorSavedQuery(); $saved->setParameter(