1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 11:30:55 +01:00

Show repositories in global autocomplete dropdown

Summary: Fixes T9523.

Test Plan: {F1059225}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9523

Differential Revision: https://secure.phabricator.com/D14994
This commit is contained in:
epriestley 2016-01-11 04:24:47 -08:00
parent add8333b98
commit 9fb929dff3
6 changed files with 40 additions and 19 deletions

View file

@ -8,7 +8,7 @@
return array(
'names' => array(
'core.pkg.css' => '1eed0b4f',
'core.pkg.js' => '57dff7df',
'core.pkg.js' => '6ae03393',
'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => '2de124c9',
'differential.pkg.js' => '64e69521',
@ -492,7 +492,7 @@ return array(
'rsrc/js/core/behavior-reorder-applications.js' => '76b9fc3e',
'rsrc/js/core/behavior-reveal-content.js' => '60821bc7',
'rsrc/js/core/behavior-scrollbar.js' => '834a1173',
'rsrc/js/core/behavior-search-typeahead.js' => '048330fa',
'rsrc/js/core/behavior-search-typeahead.js' => '0b7a4f6e',
'rsrc/js/core/behavior-select-on-click.js' => '4e3e79a6',
'rsrc/js/core/behavior-time-typeahead.js' => 'f80d6bf0',
'rsrc/js/core/behavior-toggle-class.js' => '5d7c9f33',
@ -640,7 +640,7 @@ return array(
'javelin-behavior-phabricator-oncopy' => '2926fff2',
'javelin-behavior-phabricator-remarkup-assist' => 'b60b6d9b',
'javelin-behavior-phabricator-reveal-content' => '60821bc7',
'javelin-behavior-phabricator-search-typeahead' => '048330fa',
'javelin-behavior-phabricator-search-typeahead' => '0b7a4f6e',
'javelin-behavior-phabricator-show-older-transactions' => 'dbbf48b6',
'javelin-behavior-phabricator-tooltips' => '3ee3408b',
'javelin-behavior-phabricator-transaction-comment-form' => 'b23b49e6',
@ -878,16 +878,6 @@ return array(
'javelin-behavior-device',
'phabricator-title',
),
'048330fa' => array(
'javelin-behavior',
'javelin-typeahead-ondemand-source',
'javelin-typeahead',
'javelin-dom',
'javelin-uri',
'javelin-util',
'javelin-stratcom',
'phabricator-prefab',
),
'05270951' => array(
'javelin-util',
'javelin-magical-init',
@ -915,6 +905,16 @@ return array(
'javelin-dom',
'javelin-router',
),
'0b7a4f6e' => array(
'javelin-behavior',
'javelin-typeahead-ondemand-source',
'javelin-typeahead',
'javelin-dom',
'javelin-uri',
'javelin-util',
'javelin-stratcom',
'phabricator-prefab',
),
'0f764c35' => array(
'javelin-install',
'javelin-util',

View file

@ -24,13 +24,31 @@ final class DiffusionRepositoryDatasource
->withDatasourceQuery($raw_query);
$repos = $this->executeQuery($query);
$type_icon = id(new PhabricatorRepositoryRepositoryPHIDType())
->getTypeIcon();
$image_sprite =
"phabricator-search-icon phui-font-fa phui-icon-view {$type_icon}";
$results = array();
foreach ($repos as $repo) {
$display_name = $repo->getMonogram().' '.$repo->getName();
$name = $display_name;
$slug = $repo->getRepositorySlug();
if (strlen($slug)) {
$name = "{$name} {$slug}";
}
$results[] = id(new PhabricatorTypeaheadResult())
->setName($repo->getMonogram().' '.$repo->getName())
->setName($name)
->setDisplayName($display_name)
->setURI($repo->getURI())
->setPHID($repo->getPHID())
->setPriorityString($repo->getMonogram());
->setPriorityString($repo->getMonogram())
->setPriorityType('repo')
->setImageSprite($image_sprite)
->setDisplayType(pht('Repository'));
}
return $results;

View file

@ -10,7 +10,7 @@ final class PhabricatorRepositoryRepositoryPHIDType
}
public function getTypeIcon() {
return 'fa-database';
return 'fa-code';
}
public function newObject() {

View file

@ -606,9 +606,10 @@ final class PhabricatorRepositoryQuery
}
$where[] = qsprintf(
$conn,
'r.name LIKE %> OR r.callsign LIKE %>',
'r.name LIKE %> OR r.callsign LIKE %> OR r.repositorySlug LIKE %>',
$query,
$callsign);
$callsign,
$query);
}
if ($this->slugs !== null) {

View file

@ -21,6 +21,7 @@ final class PhabricatorSearchDatasource
new PhabricatorProjectDatasource(),
new PhabricatorApplicationDatasource(),
new PhabricatorTypeaheadMonogramDatasource(),
new DiffusionRepositoryDatasource(),
new DiffusionSymbolDatasource(),
);
}

View file

@ -54,7 +54,8 @@ JX.behavior('phabricator-search-typeahead', function(config) {
'apps' : 2,
'proj' : 3,
'user' : 4,
'symb' : 5
'repo' : 5,
'symb' : 6
};
var tokens = this.tokenize(value);