1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 23:01:04 +01:00

Make query results page slightly more generic

Summary: Ref T2625. We currently hard-code the URI; instead, derive it from the Engine. I weakened the strength of getQueryResultsPageURI to let it build from a NamedQuery or a SavedQuery, because constructing a SavedQuery for a builtin NamedQuery is a bit of a pain.

Test Plan: Clicked links on the saved queries page, got query results.

Reviewers: btrahan, blc

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2625

Differential Revision: https://secure.phabricator.com/D6060
This commit is contained in:
epriestley 2013-05-27 13:43:02 -07:00
parent 3db82cb2ec
commit a67b1f950c
5 changed files with 9 additions and 8 deletions

View file

@ -22,7 +22,7 @@ final class PhabricatorPasteListController extends PhabricatorPasteController {
if ($request->isFormPost()) { if ($request->isFormPost()) {
return id(new AphrontRedirectResponse())->setURI( return id(new AphrontRedirectResponse())->setURI(
$engine->getQueryResultsPageURI( $engine->getQueryResultsPageURI(
$engine->buildSavedQueryFromRequest($request))); $engine->buildSavedQueryFromRequest($request)->getQueryKey()));
} }
$nav = $this->buildSideNavView(); $nav = $this->buildSideNavView();

View file

@ -31,7 +31,7 @@ final class PhabricatorPasteQueriesController
$item = id(new PhabricatorObjectItemView()) $item = id(new PhabricatorObjectItemView())
->setHeader($named_query->getQueryName()) ->setHeader($named_query->getQueryName())
->setHref('/paste/query/'.$named_query->getQueryKey().'/'); ->setHref($engine->getQueryResultsPageURI($named_query->getQueryKey()));
if ($named_query->getIsBuiltin()) { if ($named_query->getIsBuiltin()) {
$item->addIcon('lock-grey', pht('Builtin')); $item->addIcon('lock-grey', pht('Builtin'));

View file

@ -80,8 +80,8 @@ final class PhabricatorPasteSearchEngine
return $form; return $form;
} }
public function getQueryResultsPageURI(PhabricatorSavedQuery $query) { public function getQueryResultsPageURI($query_key) {
return '/paste/query/'.$query->getQueryKey().'/'; return '/paste/query/'.$query_key.'/';
} }
public function getQueryManagementURI() { public function getQueryManagementURI() {

View file

@ -44,7 +44,8 @@ final class PhabricatorSearchEditController
// If we haven't saved the query yet, this is a "Save..." operation, so // If we haven't saved the query yet, this is a "Save..." operation, so
// take the user back to the query if they cancel instead of back to the // take the user back to the query if they cancel instead of back to the
// management interface. // management interface.
$cancel_uri = $engine->getQueryResultsPageURI($saved_query); $cancel_uri = $engine->getQueryResultsPageURI(
$saved_query->getQueryKey());
} }
$e_name = true; $e_name = true;

View file

@ -56,11 +56,11 @@ abstract class PhabricatorApplicationSearchEngine {
* Return an application URI corresponding to the results page of a query. * Return an application URI corresponding to the results page of a query.
* Normally, this is something like `/application/query/QUERYKEY/`. * Normally, this is something like `/application/query/QUERYKEY/`.
* *
* @param PhabricatorSavedQuery The query to build a URI for. * @param string The query key to build a URI for.
* @return string URI where the query can be executed. * @return string URI where the query can be executed.
* @task uri * @task uri
*/ */
abstract public function getQueryResultsPageURI(PhabricatorSavedQuery $query); abstract public function getQueryResultsPageURI($query_key);
/** /**