Implement viewer() and members(project) typeahead functions
Summary:
Ref T4100. This is still a bit rough around the edges, but mostly does what we're after.
- Implements viewer() and members(...) functions.
- The new browse workflow makes these discoverable.
Test Plan: {F374201}
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: chad, epriestley
Maniphest Tasks: T4100
Differential Revision: https://secure.phabricator.com/D12444
This commit is contained in:
@@ -165,9 +165,6 @@ final class PhabricatorApplicationSearchController
|
||||
$errors = $engine->getErrors();
|
||||
if ($errors) {
|
||||
$run_query = false;
|
||||
$errors = id(new PHUIInfoView())
|
||||
->setTitle(pht('Query Errors'))
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
$submit = id(new AphrontFormSubmitControl())
|
||||
@@ -214,45 +211,57 @@ final class PhabricatorApplicationSearchController
|
||||
$anchor = id(new PhabricatorAnchorView())
|
||||
->setAnchorName('R'));
|
||||
|
||||
$query = $engine->buildQueryFromSavedQuery($saved_query);
|
||||
try {
|
||||
$query = $engine->buildQueryFromSavedQuery($saved_query);
|
||||
|
||||
$pager = $engine->newPagerForSavedQuery($saved_query);
|
||||
$pager->readFromRequest($request);
|
||||
$pager = $engine->newPagerForSavedQuery($saved_query);
|
||||
$pager->readFromRequest($request);
|
||||
|
||||
$objects = $engine->executeQuery($query, $pager);
|
||||
$objects = $engine->executeQuery($query, $pager);
|
||||
|
||||
// TODO: To support Dashboard panels, rendering is moving into
|
||||
// SearchEngines. Move it all the way in and then get rid of this.
|
||||
// TODO: To support Dashboard panels, rendering is moving into
|
||||
// SearchEngines. Move it all the way in and then get rid of this.
|
||||
|
||||
$interface = 'PhabricatorApplicationSearchResultsControllerInterface';
|
||||
if ($parent instanceof $interface) {
|
||||
$list = $parent->renderResultsList($objects, $saved_query);
|
||||
} else {
|
||||
$engine->setRequest($request);
|
||||
$interface = 'PhabricatorApplicationSearchResultsControllerInterface';
|
||||
if ($parent instanceof $interface) {
|
||||
$list = $parent->renderResultsList($objects, $saved_query);
|
||||
} else {
|
||||
$engine->setRequest($request);
|
||||
|
||||
$list = $engine->renderResults(
|
||||
$objects,
|
||||
$saved_query);
|
||||
}
|
||||
|
||||
$nav->appendChild($list);
|
||||
|
||||
// TODO: This is a bit hacky.
|
||||
if ($list instanceof PHUIObjectItemListView) {
|
||||
$list->setNoDataString(pht('No results found for this query.'));
|
||||
$list->setPager($pager);
|
||||
} else {
|
||||
if ($pager->willShowPagingControls()) {
|
||||
$pager_box = id(new PHUIBoxView())
|
||||
->addPadding(PHUI::PADDING_MEDIUM)
|
||||
->addMargin(PHUI::MARGIN_LARGE)
|
||||
->setBorder(true)
|
||||
->appendChild($pager);
|
||||
$nav->appendChild($pager_box);
|
||||
$list = $engine->renderResults(
|
||||
$objects,
|
||||
$saved_query);
|
||||
}
|
||||
|
||||
$nav->appendChild($list);
|
||||
|
||||
// TODO: This is a bit hacky.
|
||||
if ($list instanceof PHUIObjectItemListView) {
|
||||
$list->setNoDataString(pht('No results found for this query.'));
|
||||
$list->setPager($pager);
|
||||
} else {
|
||||
if ($pager->willShowPagingControls()) {
|
||||
$pager_box = id(new PHUIBoxView())
|
||||
->addPadding(PHUI::PADDING_MEDIUM)
|
||||
->addMargin(PHUI::MARGIN_LARGE)
|
||||
->setBorder(true)
|
||||
->appendChild($pager);
|
||||
$nav->appendChild($pager_box);
|
||||
}
|
||||
}
|
||||
} catch (PhabricatorTypeaheadInvalidTokenException $ex) {
|
||||
$errors[] = pht(
|
||||
'This query specifies an invalid parameter. Review the '.
|
||||
'query parameters and correct errors.');
|
||||
}
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
$errors = id(new PHUIInfoView())
|
||||
->setTitle(pht('Query Errors'))
|
||||
->setErrors($errors);
|
||||
}
|
||||
|
||||
if ($errors) {
|
||||
$nav->appendChild($errors);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user