Add an action to adding Panels from ApplicationSearch
Summary: Ref T5307. This adds an additional action to Use Results for creating a panel from the query. Test Plan: Navigate to Maniphest, select dropdown for Use Results. Try any of the following: - Try to set a panel without a name (fail) - Muck up query or engine (fail) - Set a fake Dashboard ID (fail) Give panel a name and select a dashboard I have edit permissions to, get taken to dashboard. Reviewers: epriestley Subscribers: Korvin Maniphest Tasks: T5307 Differential Revision: https://secure.phabricator.com/D17516
This commit is contained in:
@@ -555,8 +555,9 @@ final class PhabricatorApplicationSearchController
|
||||
->setTag('a')
|
||||
->setHref('#')
|
||||
->setText(pht('Use Results...'))
|
||||
->setIcon('fa-road')
|
||||
->setDropdownMenu($action_list);
|
||||
->setIcon('fa-bars')
|
||||
->setDropdownMenu($action_list)
|
||||
->addClass('dropdown');
|
||||
}
|
||||
|
||||
private function newOverflowingView() {
|
||||
@@ -600,9 +601,32 @@ final class PhabricatorApplicationSearchController
|
||||
|
||||
private function newBuiltinUseActions() {
|
||||
$actions = array();
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
|
||||
$is_dev = PhabricatorEnv::getEnvConfig('phabricator.developer-mode');
|
||||
|
||||
$engine = $this->getSearchEngine();
|
||||
$engine_class = get_class($engine);
|
||||
$query_key = $this->getQueryKey();
|
||||
if (!$query_key) {
|
||||
$query_key = head_key($engine->loadEnabledNamedQueries());
|
||||
}
|
||||
|
||||
$can_use = $engine->canUseInPanelContext();
|
||||
$is_installed = PhabricatorApplication::isClassInstalledForViewer(
|
||||
'PhabricatorDashboardApplication',
|
||||
$viewer);
|
||||
|
||||
if ($can_use && $is_installed) {
|
||||
$dashboard_uri = '/dashboard/install/';
|
||||
$actions[] = id(new PhabricatorActionView())
|
||||
->setIcon('fa-dashboard')
|
||||
->setName(pht('Add to Dasbhoard'))
|
||||
->setWorkflow(true)
|
||||
->setHref("/dashboard/panel/install/{$engine_class}/{$query_key}/");
|
||||
}
|
||||
|
||||
if ($is_dev) {
|
||||
$engine = $this->getSearchEngine();
|
||||
$nux_uri = $engine->getQueryBaseURI();
|
||||
@@ -610,8 +634,8 @@ final class PhabricatorApplicationSearchController
|
||||
->setQueryParam('nux', true);
|
||||
|
||||
$actions[] = id(new PhabricatorActionView())
|
||||
->setIcon('fa-bug')
|
||||
->setName(pht('Developer: Show New User State'))
|
||||
->setIcon('fa-user-plus')
|
||||
->setName(pht('DEV: New User State'))
|
||||
->setHref($nux_uri);
|
||||
}
|
||||
|
||||
@@ -620,8 +644,8 @@ final class PhabricatorApplicationSearchController
|
||||
->setQueryParam('overheated', true);
|
||||
|
||||
$actions[] = id(new PhabricatorActionView())
|
||||
->setIcon('fa-bug')
|
||||
->setName(pht('Developer: Show Overheated State'))
|
||||
->setIcon('fa-fire')
|
||||
->setName(pht('DEV: Overheated State'))
|
||||
->setHref($overheated_uri);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user