1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-03-03 07:59:15 +01:00

Showing tasks & diffs in the typeahead.

Summary: Trying to show tasks & diffs in the typeahead. My brain has got dumber as I have not been in touch with phab dev. Waiting for your comments and pointers.

Test Plan:
{F47352}
The tasks should show up in the type-ahead.

Reviewers: epriestley, Afaque_Hussain

Reviewed By: epriestley

CC: aran, Korvin, AnhNhan, blc

Maniphest Tasks: T2948

Differential Revision: https://secure.phabricator.com/D6175
This commit is contained in:
Afaque Hussain 2013-07-08 09:50:00 -07:00 committed by epriestley
parent f510edb9a1
commit 36f7ee5030
3 changed files with 97 additions and 41 deletions

View file

@ -2124,7 +2124,7 @@ celerity_register_resource_map(array(
),
'javelin-behavior-phabricator-search-typeahead' =>
array(
'uri' => '/res/b39896d5/rsrc/js/core/behavior-search-typeahead.js',
'uri' => '/res/439de76f/rsrc/js/core/behavior-search-typeahead.js',
'type' => 'js',
'requires' =>
array(
@ -4173,7 +4173,7 @@ celerity_register_resource_map(array(
'uri' => '/res/pkg/178f5351/core.pkg.css',
'type' => 'css',
),
'0b587556' =>
'75ccea43' =>
array(
'name' => 'core.pkg.js',
'symbols' =>
@ -4216,7 +4216,7 @@ celerity_register_resource_map(array(
35 => 'phabricator-hovercard',
36 => 'javelin-behavior-phabricator-hovercards',
),
'uri' => '/res/pkg/0b587556/core.pkg.js',
'uri' => '/res/pkg/75ccea43/core.pkg.js',
'type' => 'js',
),
'4ccfeb47' =>
@ -4389,17 +4389,17 @@ celerity_register_resource_map(array(
'diffusion-icons-css' => 'c8ce2d88',
'global-drag-and-drop-css' => '178f5351',
'inline-comment-summary-css' => 'dd27a69b',
'javelin-aphlict' => '0b587556',
'javelin-aphlict' => '75ccea43',
'javelin-behavior' => 'a9f14d76',
'javelin-behavior-aphlict-dropdown' => '0b587556',
'javelin-behavior-aphlict-listen' => '0b587556',
'javelin-behavior-aphront-basic-tokenizer' => '0b587556',
'javelin-behavior-aphlict-dropdown' => '75ccea43',
'javelin-behavior-aphlict-listen' => '75ccea43',
'javelin-behavior-aphront-basic-tokenizer' => '75ccea43',
'javelin-behavior-aphront-drag-and-drop' => '9488bb69',
'javelin-behavior-aphront-drag-and-drop-textarea' => '9488bb69',
'javelin-behavior-aphront-form-disable-on-submit' => '0b587556',
'javelin-behavior-aphront-form-disable-on-submit' => '75ccea43',
'javelin-behavior-audit-preview' => '96909266',
'javelin-behavior-dark-console' => '4ccfeb47',
'javelin-behavior-device' => '0b587556',
'javelin-behavior-device' => '75ccea43',
'javelin-behavior-differential-accept-with-errors' => '9488bb69',
'javelin-behavior-differential-add-reviewers-and-ccs' => '9488bb69',
'javelin-behavior-differential-comment-jump' => '9488bb69',
@ -4415,33 +4415,33 @@ celerity_register_resource_map(array(
'javelin-behavior-diffusion-commit-graph' => '96909266',
'javelin-behavior-diffusion-pull-lastmodified' => '96909266',
'javelin-behavior-error-log' => '4ccfeb47',
'javelin-behavior-global-drag-and-drop' => '0b587556',
'javelin-behavior-history-install' => '0b587556',
'javelin-behavior-konami' => '0b587556',
'javelin-behavior-lightbox-attachments' => '0b587556',
'javelin-behavior-global-drag-and-drop' => '75ccea43',
'javelin-behavior-history-install' => '75ccea43',
'javelin-behavior-konami' => '75ccea43',
'javelin-behavior-lightbox-attachments' => '75ccea43',
'javelin-behavior-load-blame' => '9488bb69',
'javelin-behavior-maniphest-batch-selector' => '98f64f07',
'javelin-behavior-maniphest-subpriority-editor' => '98f64f07',
'javelin-behavior-maniphest-transaction-controls' => '98f64f07',
'javelin-behavior-maniphest-transaction-expand' => '98f64f07',
'javelin-behavior-maniphest-transaction-preview' => '98f64f07',
'javelin-behavior-phabricator-active-nav' => '0b587556',
'javelin-behavior-phabricator-autofocus' => '0b587556',
'javelin-behavior-phabricator-gesture' => '0b587556',
'javelin-behavior-phabricator-hovercards' => '0b587556',
'javelin-behavior-phabricator-keyboard-shortcuts' => '0b587556',
'javelin-behavior-phabricator-nav' => '0b587556',
'javelin-behavior-phabricator-active-nav' => '75ccea43',
'javelin-behavior-phabricator-autofocus' => '75ccea43',
'javelin-behavior-phabricator-gesture' => '75ccea43',
'javelin-behavior-phabricator-hovercards' => '75ccea43',
'javelin-behavior-phabricator-keyboard-shortcuts' => '75ccea43',
'javelin-behavior-phabricator-nav' => '75ccea43',
'javelin-behavior-phabricator-object-selector' => '9488bb69',
'javelin-behavior-phabricator-oncopy' => '0b587556',
'javelin-behavior-phabricator-remarkup-assist' => '0b587556',
'javelin-behavior-phabricator-reveal-content' => '0b587556',
'javelin-behavior-phabricator-search-typeahead' => '0b587556',
'javelin-behavior-phabricator-tooltips' => '0b587556',
'javelin-behavior-phabricator-watch-anchor' => '0b587556',
'javelin-behavior-refresh-csrf' => '0b587556',
'javelin-behavior-phabricator-oncopy' => '75ccea43',
'javelin-behavior-phabricator-remarkup-assist' => '75ccea43',
'javelin-behavior-phabricator-reveal-content' => '75ccea43',
'javelin-behavior-phabricator-search-typeahead' => '75ccea43',
'javelin-behavior-phabricator-tooltips' => '75ccea43',
'javelin-behavior-phabricator-watch-anchor' => '75ccea43',
'javelin-behavior-refresh-csrf' => '75ccea43',
'javelin-behavior-repository-crossreference' => '9488bb69',
'javelin-behavior-toggle-class' => '0b587556',
'javelin-behavior-workflow' => '0b587556',
'javelin-behavior-toggle-class' => '75ccea43',
'javelin-behavior-workflow' => '75ccea43',
'javelin-dom' => 'a9f14d76',
'javelin-event' => 'a9f14d76',
'javelin-history' => 'a9f14d76',
@ -4466,31 +4466,31 @@ celerity_register_resource_map(array(
'maniphest-transaction-detail-css' => 'adc3c36d',
'phabricator-action-list-view-css' => '178f5351',
'phabricator-application-launch-view-css' => '178f5351',
'phabricator-busy' => '0b587556',
'phabricator-busy' => '75ccea43',
'phabricator-content-source-view-css' => 'dd27a69b',
'phabricator-core-css' => '178f5351',
'phabricator-crumbs-view-css' => '178f5351',
'phabricator-drag-and-drop-file-upload' => '9488bb69',
'phabricator-dropdown-menu' => '0b587556',
'phabricator-file-upload' => '0b587556',
'phabricator-dropdown-menu' => '75ccea43',
'phabricator-file-upload' => '75ccea43',
'phabricator-filetree-view-css' => '178f5351',
'phabricator-flag-css' => '178f5351',
'phabricator-form-view-css' => '178f5351',
'phabricator-header-view-css' => '178f5351',
'phabricator-hovercard' => '0b587556',
'phabricator-hovercard' => '75ccea43',
'phabricator-jump-nav' => '178f5351',
'phabricator-keyboard-shortcut' => '0b587556',
'phabricator-keyboard-shortcut-manager' => '0b587556',
'phabricator-keyboard-shortcut' => '75ccea43',
'phabricator-keyboard-shortcut-manager' => '75ccea43',
'phabricator-main-menu-view' => '178f5351',
'phabricator-menu-item' => '0b587556',
'phabricator-menu-item' => '75ccea43',
'phabricator-nav-view-css' => '178f5351',
'phabricator-notification' => '0b587556',
'phabricator-notification' => '75ccea43',
'phabricator-notification-css' => '178f5351',
'phabricator-notification-menu-css' => '178f5351',
'phabricator-object-item-list-view-css' => '178f5351',
'phabricator-object-selector-css' => 'dd27a69b',
'phabricator-phtize' => '0b587556',
'phabricator-prefab' => '0b587556',
'phabricator-phtize' => '75ccea43',
'phabricator-prefab' => '75ccea43',
'phabricator-project-tag-css' => 'adc3c36d',
'phabricator-property-list-view-css' => '178f5351',
'phabricator-remarkup-css' => '178f5351',
@ -4498,8 +4498,8 @@ celerity_register_resource_map(array(
'phabricator-side-menu-view-css' => '178f5351',
'phabricator-standard-page-view' => '178f5351',
'phabricator-tag-view-css' => '178f5351',
'phabricator-textareautils' => '0b587556',
'phabricator-tooltip' => '0b587556',
'phabricator-textareautils' => '75ccea43',
'phabricator-tooltip' => '75ccea43',
'phabricator-transaction-view-css' => '178f5351',
'phabricator-zindex-css' => '178f5351',
'phui-button-css' => '178f5351',

View file

@ -29,6 +29,7 @@ final class PhabricatorTypeaheadCommonDatasourceController
$need_arcanist_projects = false;
$need_noproject = false;
$need_symbols = false;
$need_jump_objects = false;
switch ($this->type) {
case 'mainsearch':
$need_users = true;
@ -36,6 +37,7 @@ final class PhabricatorTypeaheadCommonDatasourceController
$need_rich_data = true;
$need_symbols = true;
$need_projs = true;
$need_jump_objects = true;
break;
case 'searchowner':
$need_users = true;
@ -299,6 +301,60 @@ final class PhabricatorTypeaheadCommonDatasourceController
}
}
if ($need_jump_objects) {
$response = PhabricatorJumpNavHandler::jumpPostResponse($query);
if ($response) {
$is_task = array();
$is_revision = array();
preg_match('/T[0-9]+/', $response->getURI(), $is_task);
preg_match('/D[0-9]+/', $response->getURI(), $is_revision);
if ($is_task) {
for ($i = 0; $i < count($is_task); $i++) {
$is_task[$i] = substr($is_task[$i], 1); // Remove leading 'T'.
}
$tasks = id(new ManiphestTaskQuery())
->setViewer($viewer)
->withTaskIDs($is_task)
->execute();
if ($tasks) {
foreach ($tasks as $task) {
$results[] = id(new PhabricatorTypeaheadResult())
->setName('T'.$task->getID())
->setDisplayType("Task")
->setURI('/T'.$task->getID())
->setPHID($task->getPHID())
->setPriorityType('jump');
}
}
}
if ($is_revision) {
for ($i = 0; $i < count($is_revision); $i++) {
$is_revision[$i] = substr($is_revision[$i], 1);
}
$revisions = id(new DifferentialRevisionQuery())
->setViewer($viewer)
->withIDs($is_revision)
->execute();
if ($revisions) {
foreach ($revisions as $revision) {
$results[] = id(new PhabricatorTypeaheadResult())
->setName('D'.$revision->getID())
->setDisplayType("Revision")
->setURI('/D'.$revision->getID())
->setPHID($revision->getPHID())
->setPriorityType('jump');
}
}
}
}
}
$content = mpull($results, 'getWireFormat');
if ($request->isAjax()) {

View file

@ -51,7 +51,7 @@ JX.behavior('phabricator-search-typeahead', function(config) {
var sort_handler = function(value, list, cmp) {
var priority_hits = {};
var type_priority = {
// TODO: Put jump nav hits like "D123" first.
'jump' : 1,
'apps' : 2,
'user' : 3,
'symb' : 4