Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14080934
D12510.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
12 KB
Referenced Files
None
Subscribers
None
D12510.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -8,8 +8,8 @@
return array(
'names' => array(
'core.pkg.css' => 'f7d01efc',
- 'core.pkg.js' => 'a1f9db42',
- 'darkconsole.pkg.js' => '8ab24e01',
+ 'core.pkg.js' => 'd3f3a35c',
+ 'darkconsole.pkg.js' => 'b0a3ba93',
'differential.pkg.css' => '3500921f',
'differential.pkg.js' => 'c0506961',
'diffusion.pkg.css' => '591664fa',
@@ -350,7 +350,7 @@
'rsrc/image/texture/table_header_hover.png' => '038ec3b9',
'rsrc/image/texture/table_header_tall.png' => 'd56b434f',
'rsrc/js/application/aphlict/Aphlict.js' => '30a6303c',
- 'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => '572566ae',
+ 'rsrc/js/application/aphlict/behavior-aphlict-dropdown.js' => 'ee37f73a',
'rsrc/js/application/aphlict/behavior-aphlict-listen.js' => 'b1a59974',
'rsrc/js/application/aphlict/behavior-aphlict-status.js' => 'ea681761',
'rsrc/js/application/auth/behavior-persona-login.js' => '9414ff18',
@@ -460,7 +460,7 @@
'rsrc/js/core/behavior-autofocus.js' => '7319e029',
'rsrc/js/core/behavior-choose-control.js' => '6153c708',
'rsrc/js/core/behavior-crop.js' => 'fa0f4fc2',
- 'rsrc/js/core/behavior-dark-console.js' => '08883e8b',
+ 'rsrc/js/core/behavior-dark-console.js' => 'b8df5663',
'rsrc/js/core/behavior-device.js' => 'a205cf28',
'rsrc/js/core/behavior-drag-and-drop-textarea.js' => '6d49590e',
'rsrc/js/core/behavior-error-log.js' => '6882e80a',
@@ -550,7 +550,7 @@
'inline-comment-summary-css' => 'eb5f8e8c',
'javelin-aphlict' => '30a6303c',
'javelin-behavior' => '61cbc29a',
- 'javelin-behavior-aphlict-dropdown' => '572566ae',
+ 'javelin-behavior-aphlict-dropdown' => 'ee37f73a',
'javelin-behavior-aphlict-listen' => 'b1a59974',
'javelin-behavior-aphlict-status' => 'ea681761',
'javelin-behavior-aphront-basic-tokenizer' => 'b3a4b884',
@@ -567,7 +567,7 @@
'javelin-behavior-conpherence-pontificate' => '21ba5861',
'javelin-behavior-conpherence-widget-pane' => '93568464',
'javelin-behavior-countdown-timer' => 'e4cc26b3',
- 'javelin-behavior-dark-console' => '08883e8b',
+ 'javelin-behavior-dark-console' => 'b8df5663',
'javelin-behavior-dashboard-async-panel' => '469c0d9e',
'javelin-behavior-dashboard-move-panels' => '82439934',
'javelin-behavior-dashboard-query-panel-select' => '453c5375',
@@ -869,14 +869,6 @@
'phabricator-shaped-request',
'conpherence-thread-manager',
),
- '08883e8b' => array(
- 'javelin-behavior',
- 'javelin-stratcom',
- 'javelin-util',
- 'javelin-dom',
- 'javelin-request',
- 'phabricator-keyboard-shortcut',
- ),
'0a3f3021' => array(
'javelin-behavior',
'javelin-stratcom',
@@ -1198,16 +1190,6 @@
'javelin-vector',
'javelin-dom',
),
- '572566ae' => array(
- 'javelin-behavior',
- 'javelin-request',
- 'javelin-stratcom',
- 'javelin-vector',
- 'javelin-dom',
- 'javelin-uri',
- 'javelin-behavior-device',
- 'phabricator-title',
- ),
58562350 => array(
'javelin-dom',
'javelin-util',
@@ -1727,6 +1709,14 @@
'javelin-dom',
'javelin-util',
),
+ 'b8df5663' => array(
+ 'javelin-behavior',
+ 'javelin-stratcom',
+ 'javelin-util',
+ 'javelin-dom',
+ 'javelin-request',
+ 'phabricator-keyboard-shortcut',
+ ),
'bba9eedf' => array(
'javelin-behavior',
'javelin-stratcom',
@@ -1950,6 +1940,16 @@
'javelin-stratcom',
'javelin-vector',
),
+ 'ee37f73a' => array(
+ 'javelin-behavior',
+ 'javelin-request',
+ 'javelin-stratcom',
+ 'javelin-vector',
+ 'javelin-dom',
+ 'javelin-uri',
+ 'javelin-behavior-device',
+ 'phabricator-title',
+ ),
'efe49472' => array(
'javelin-install',
'javelin-util',
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2475,6 +2475,7 @@
'PhabricatorSearchDocumentIndexer' => 'applications/search/index/PhabricatorSearchDocumentIndexer.php',
'PhabricatorSearchDocumentQuery' => 'applications/search/query/PhabricatorSearchDocumentQuery.php',
'PhabricatorSearchDocumentRelationship' => 'applications/search/storage/document/PhabricatorSearchDocumentRelationship.php',
+ 'PhabricatorSearchDocumentTypeDatasource' => 'applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php',
'PhabricatorSearchEditController' => 'applications/search/controller/PhabricatorSearchEditController.php',
'PhabricatorSearchEngine' => 'applications/search/engine/PhabricatorSearchEngine.php',
'PhabricatorSearchEngineElastic' => 'applications/search/engine/PhabricatorSearchEngineElastic.php',
@@ -5897,6 +5898,7 @@
'PhabricatorSearchDocumentIndexer' => 'Phobject',
'PhabricatorSearchDocumentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorSearchDocumentRelationship' => 'PhabricatorSearchDAO',
+ 'PhabricatorSearchDocumentTypeDatasource' => 'PhabricatorTypeaheadDatasource',
'PhabricatorSearchEditController' => 'PhabricatorSearchBaseController',
'PhabricatorSearchEngineElastic' => 'PhabricatorSearchEngine',
'PhabricatorSearchEngineMySQL' => 'PhabricatorSearchEngine',
diff --git a/src/applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php b/src/applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php
--- a/src/applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php
+++ b/src/applications/conpherence/phid/PhabricatorConpherenceThreadPHIDType.php
@@ -12,6 +12,10 @@
return new ConpherenceThread();
}
+ public function getPHIDTypeApplicationClass() {
+ return 'PhabricatorConpherenceApplication';
+ }
+
protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
diff --git a/src/applications/fund/phid/FundInitiativePHIDType.php b/src/applications/fund/phid/FundInitiativePHIDType.php
--- a/src/applications/fund/phid/FundInitiativePHIDType.php
+++ b/src/applications/fund/phid/FundInitiativePHIDType.php
@@ -12,6 +12,10 @@
return new FundInitiative();
}
+ public function getPHIDTypeApplicationClass() {
+ return 'PhabricatorFundApplication';
+ }
+
protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
diff --git a/src/applications/herald/adapter/HeraldCommitAdapter.php b/src/applications/herald/adapter/HeraldCommitAdapter.php
--- a/src/applications/herald/adapter/HeraldCommitAdapter.php
+++ b/src/applications/herald/adapter/HeraldCommitAdapter.php
@@ -26,7 +26,7 @@
return 'PhabricatorDiffusionApplication';
}
- public function newObject() {
+ protected function newObject() {
return new PhabricatorRepositoryCommit();
}
diff --git a/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php b/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php
--- a/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php
+++ b/src/applications/herald/adapter/HeraldDifferentialRevisionAdapter.php
@@ -24,7 +24,7 @@
return 'PhabricatorDifferentialApplication';
}
- public function newObject() {
+ protected function newObject() {
return new DifferentialRevision();
}
diff --git a/src/applications/herald/adapter/HeraldPholioMockAdapter.php b/src/applications/herald/adapter/HeraldPholioMockAdapter.php
--- a/src/applications/herald/adapter/HeraldPholioMockAdapter.php
+++ b/src/applications/herald/adapter/HeraldPholioMockAdapter.php
@@ -13,7 +13,7 @@
return pht('React to mocks being created or updated.');
}
- public function newObject() {
+ protected function newObject() {
return new PholioMock();
}
diff --git a/src/applications/passphrase/phid/PassphraseCredentialPHIDType.php b/src/applications/passphrase/phid/PassphraseCredentialPHIDType.php
--- a/src/applications/passphrase/phid/PassphraseCredentialPHIDType.php
+++ b/src/applications/passphrase/phid/PassphraseCredentialPHIDType.php
@@ -12,6 +12,10 @@
return new PassphraseCredential();
}
+ public function getPHIDTypeApplicationClass() {
+ return 'PhabricatorPassphraseApplication';
+ }
+
protected function buildQueryForObjects(
PhabricatorObjectQuery $query,
array $phids) {
diff --git a/src/applications/phid/type/PhabricatorPHIDType.php b/src/applications/phid/type/PhabricatorPHIDType.php
--- a/src/applications/phid/type/PhabricatorPHIDType.php
+++ b/src/applications/phid/type/PhabricatorPHIDType.php
@@ -31,6 +31,13 @@
}
public function getTypeIcon() {
+ // Default to the application icon if the type doesn't specify one.
+ $application_class = $this->getPHIDTypeApplicationClass();
+ if ($application_class) {
+ $application = newv($application_class, array());
+ return $application->getFontIcon();
+ }
+
return null;
}
diff --git a/src/applications/phriction/herald/PhrictionDocumentHeraldAdapter.php b/src/applications/phriction/herald/PhrictionDocumentHeraldAdapter.php
--- a/src/applications/phriction/herald/PhrictionDocumentHeraldAdapter.php
+++ b/src/applications/phriction/herald/PhrictionDocumentHeraldAdapter.php
@@ -13,7 +13,7 @@
return pht('React to wiki documents being created or updated.');
}
- public function newObject() {
+ protected function newObject() {
return new PhrictionDocument();
}
diff --git a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php
--- a/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php
+++ b/src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php
@@ -88,17 +88,11 @@
$type_values = $saved->getParameter('types', array());
$type_values = array_fuse($type_values);
- $types = self::getIndexableDocumentTypes($this->requireViewer());
-
- $types_control = id(new AphrontFormCheckboxControl())
- ->setLabel(pht('Document Types'));
- foreach ($types as $type => $name) {
- $types_control->addCheckbox(
- 'types[]',
- $type,
- $name,
- isset($type_values[$type]));
- }
+ $types_control = id(new AphrontFormTokenizerControl())
+ ->setLabel(pht('Document Types'))
+ ->setName('types')
+ ->setDatasource(new PhabricatorSearchDocumentTypeDatasource())
+ ->setValue($type_values);
$form
->appendChild(
@@ -115,7 +109,7 @@
->setName('query')
->setValue($saved->getParameter('query')))
->appendChild($status_control)
- ->appendChild($types_control)
+ ->appendControl($types_control)
->appendControl(
id(new AphrontFormTokenizerControl())
->setName('authorPHIDs')
@@ -208,13 +202,6 @@
asort($results);
- // Put tasks first, see T4606.
- $results = array_select_keys(
- $results,
- array(
- ManiphestTaskPHIDType::TYPECONST,
- )) + $results;
-
return $results;
}
diff --git a/src/applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php b/src/applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php
new file mode 100644
--- /dev/null
+++ b/src/applications/search/typeahead/PhabricatorSearchDocumentTypeDatasource.php
@@ -0,0 +1,56 @@
+<?php
+
+final class PhabricatorSearchDocumentTypeDatasource
+ extends PhabricatorTypeaheadDatasource {
+
+ public function getBrowseTitle() {
+ return pht('Browse Document Types');
+ }
+
+ public function getPlaceholderText() {
+ return pht('Select a document type...');
+ }
+
+ public function getDatasourceApplicationClass() {
+ return 'PhabricatorSearchApplication';
+ }
+
+ public function loadResults() {
+ $results = $this->buildResults();
+ return $this->filterResultsAgainstTokens($results);
+ }
+
+ public function renderTokens(array $values) {
+ $results = $this->buildResults();
+ $results = array_select_keys($results, $values);
+
+ $tokens = array();
+ foreach ($results as $result) {
+ $tokens[] = PhabricatorTypeaheadTokenView::newFromTypeaheadResult(
+ $result);
+ }
+
+ return $tokens;
+ }
+
+ private function buildResults() {
+ $types =
+ PhabricatorSearchApplicationSearchEngine::getIndexableDocumentTypes();
+
+ $icons = mpull(
+ PhabricatorPHIDType::getAllTypes(),
+ 'getTypeIcon',
+ 'getTypeConstant');
+
+ $results = array();
+ foreach ($types as $type => $name) {
+ $results[$type] = id(new PhabricatorTypeaheadResult())
+ ->setPHID($type)
+ ->setName($name)
+ ->setIcon(idx($icons, $type));
+ }
+
+ return $results;
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 5:30 PM (6 h, 51 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6779053
Default Alt Text
D12510.diff (12 KB)
Attached To
Mode
D12510: Use a typeahead for "document types" in global search
Attached
Detach File
Event Timeline
Log In to Comment