mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-18 17:58:37 +01:00
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
This commit is contained in:
parent
c72e2f35f3
commit
b8bc0aa2b0
45 changed files with 221 additions and 3 deletions
|
@ -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',
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorCommitSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Commits');
|
||||
}
|
||||
|
||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||
$saved = new PhabricatorSavedQuery();
|
||||
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorCalendarEventSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Calendar Events');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationCalendar';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorConduitSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Conduit Methods');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationConduit';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorCountdownSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Countdowns');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationCountdown';
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorDashboardPanelSearchApplicationCustomField
|
||||
extends PhabricatorStandardCustomField {
|
||||
|
||||
public function getFieldType() {
|
||||
return 'search.application';
|
||||
}
|
||||
|
||||
public function shouldAppearInApplicationSearch() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function renderEditControl(array $handles) {
|
||||
|
||||
$engines = id(new PhutilSymbolLoader())
|
||||
->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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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(
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorDashboardPanelSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Dashboard Panels');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationDashboard';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorDashboardSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Dashboards');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationDashboard';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class DifferentialRevisionSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Differential Revisions');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationDifferential';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class DivinerAtomSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Documentation Atoms');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationDiviner';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class DrydockBlueprintSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Drydock Blueprints');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationDrydock';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class DrydockLeaseSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Drydock Leases');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationDrydock';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class DrydockLogSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Drydock Logs');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationDrydock';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class DrydockResourceSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Drydock Resources');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationDrydock';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorFeedSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Feed Stories');
|
||||
}
|
||||
|
||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||
$saved = new PhabricatorSavedQuery();
|
||||
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorFileSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Files');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationFiles';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorFlagSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Flags');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationFlags';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class HarbormasterBuildPlanSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Harbormaster Build Plans');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationHarbormaster';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class HarbormasterBuildableSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Harbormaster Buildables');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationHarbormaster';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class HeraldRuleSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Herald Rules');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationHerald';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class HeraldTranscriptSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Herald Transcripts');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationHerald';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class LegalpadDocumentSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Legalpad Documents');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationLegalpad';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorMacroSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Macros');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationMacro';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorMailingListSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Mailing Lists');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationMailingLists';
|
||||
}
|
||||
|
|
|
@ -30,6 +30,10 @@ final class ManiphestTaskSearchEngine
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Tasks');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationManiphest';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorAppSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Applications');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationApplications';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorOAuthServerClientSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('OAuth Clients');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationOAuthServer';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PassphraseCredentialSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Passphrase Credentials');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationPassphrase';
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorPeopleLogSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Account Activity');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationPeople';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorPeopleSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Users');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationPeople';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PholioMockSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Pholio Mocks');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationPholio';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhrequentSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Phrequent Time');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationPhrequent';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhrictionSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Wiki Documents');
|
||||
}
|
||||
|
||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||
$saved = new PhabricatorSavedQuery();
|
||||
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PonderQuestionSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Ponder Questions');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationPonder';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorProjectSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Projects');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationProject';
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class ReleephProductSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Releeph Products');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationReleeph';
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorRepositoryPushLogSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Push Logs');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationDiffusion';
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorRepositorySearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Repositories');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationDiffusion';
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
final class PhabricatorSearchApplicationSearchEngine
|
||||
extends PhabricatorApplicationSearchEngine {
|
||||
|
||||
public function getResultTypeDescription() {
|
||||
return pht('Fulltext Results');
|
||||
}
|
||||
|
||||
public function getApplicationClassName() {
|
||||
return 'PhabricatorApplicationSearch';
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
|
|
Loading…
Add table
Reference in a new issue