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

Add developer UI for accessing NUX and "Overheated" query states

Summary: Ref T11773. Not committed to this implementation, but adds some "Developer" query actions to jump to the nux/overheated states without needing to know secret magic URL variables.

Test Plan: {F1878984}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11773

Differential Revision: https://secure.phabricator.com/D16736
This commit is contained in:
epriestley 2016-10-20 09:09:34 -07:00
parent 1fdb8ba112
commit c3644216bf
2 changed files with 49 additions and 3 deletions

View file

@ -111,6 +111,7 @@ final class PhabricatorApplicationSearchController
'before' => true, 'before' => true,
'after' => true, 'after' => true,
'nux' => true, 'nux' => true,
'overheated' => true,
); );
foreach ($pt_data as $pt_key => $pt_value) { foreach ($pt_data as $pt_key => $pt_value) {
@ -238,7 +239,8 @@ final class PhabricatorApplicationSearchController
$nux_view = null; $nux_view = null;
} }
$is_overheated = $query->getIsOverheated(); $force_overheated = $request->getBool('overheated');
$is_overheated = $query->getIsOverheated() || $force_overheated;
if ($nux_view) { if ($nux_view) {
$box->appendChild($nux_view); $box->appendChild($nux_view);
@ -277,13 +279,23 @@ final class PhabricatorApplicationSearchController
$header = $result_header; $header = $result_header;
} }
if ($list->getActions()) { $actions = $list->getActions();
foreach ($list->getActions() as $action) { if ($actions) {
foreach ($actions as $action) {
$header->addActionLink($action); $header->addActionLink($action);
} }
} }
$use_actions = $engine->newUseResultsActions($saved_query); $use_actions = $engine->newUseResultsActions($saved_query);
// TODO: Eventually, modularize all this stuff.
$builtin_use_actions = $this->newBuiltinUseActions();
if ($builtin_use_actions) {
foreach ($builtin_use_actions as $builtin_use_action) {
$use_actions[] = $builtin_use_action;
}
}
if ($use_actions) { if ($use_actions) {
$use_dropdown = $this->newUseResultsDropdown( $use_dropdown = $this->newUseResultsDropdown(
$saved_query, $saved_query,
@ -554,4 +566,34 @@ final class PhabricatorApplicationSearchController
)); ));
} }
private function newBuiltinUseActions() {
$actions = array();
$is_dev = PhabricatorEnv::getEnvConfig('phabricator.developer-mode');
if ($is_dev) {
$engine = $this->getSearchEngine();
$nux_uri = $engine->getQueryBaseURI();
$nux_uri = id(new PhutilURI($nux_uri))
->setQueryParam('nux', true);
$actions[] = id(new PhabricatorActionView())
->setIcon('fa-bug')
->setName(pht('Developer: Show New User State'))
->setHref($nux_uri);
}
if ($is_dev) {
$overheated_uri = $this->getRequest()->getRequestURI()
->setQueryParam('overheated', true);
$actions[] = id(new PhabricatorActionView())
->setIcon('fa-bug')
->setName(pht('Developer: Show Overheated State'))
->setHref($overheated_uri);
}
return $actions;
}
} }

View file

@ -406,6 +406,10 @@ abstract class PhabricatorApplicationSearchEngine extends Phobject {
return $this->getURI('query/edit/'); return $this->getURI('query/edit/');
} }
public function getQueryBaseURI() {
return $this->getURI('');
}
/** /**
* Return the URI to a path within the application. Used to construct default * Return the URI to a path within the application. Used to construct default