1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 18:22:41 +01:00

Provide a Drydock "Console" controller

Summary:
Ref T2015. After introducing ApplicationSearch, the left nav turned into a soupy mess. Split the major sections into four separate areas, and unify them with a simple console.

This also reverts all the prefix stuff, since the results were awful and I don't anticipate it ever being the best solution to any UX problem.

Test Plan:
Browsed blueprints, resources, leases and logs.

Here's the new console:

{F93279}

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2015

Differential Revision: https://secure.phabricator.com/D7833
This commit is contained in:
epriestley 2013-12-26 12:30:36 -08:00
parent 9c9a9a919e
commit 5fdd800bb6
21 changed files with 234 additions and 75 deletions

View file

@ -636,6 +636,7 @@ phutil_register_library_map(array(
'DrydockAllocatorWorker' => 'applications/drydock/worker/DrydockAllocatorWorker.php', 'DrydockAllocatorWorker' => 'applications/drydock/worker/DrydockAllocatorWorker.php',
'DrydockApacheWebrootInterface' => 'applications/drydock/interface/webroot/DrydockApacheWebrootInterface.php', 'DrydockApacheWebrootInterface' => 'applications/drydock/interface/webroot/DrydockApacheWebrootInterface.php',
'DrydockBlueprint' => 'applications/drydock/storage/DrydockBlueprint.php', 'DrydockBlueprint' => 'applications/drydock/storage/DrydockBlueprint.php',
'DrydockBlueprintController' => 'applications/drydock/controller/DrydockBlueprintController.php',
'DrydockBlueprintCreateController' => 'applications/drydock/controller/DrydockBlueprintCreateController.php', 'DrydockBlueprintCreateController' => 'applications/drydock/controller/DrydockBlueprintCreateController.php',
'DrydockBlueprintEditController' => 'applications/drydock/controller/DrydockBlueprintEditController.php', 'DrydockBlueprintEditController' => 'applications/drydock/controller/DrydockBlueprintEditController.php',
'DrydockBlueprintImplementation' => 'applications/drydock/blueprint/DrydockBlueprintImplementation.php', 'DrydockBlueprintImplementation' => 'applications/drydock/blueprint/DrydockBlueprintImplementation.php',
@ -645,12 +646,14 @@ phutil_register_library_map(array(
'DrydockBlueprintSearchEngine' => 'applications/drydock/query/DrydockBlueprintSearchEngine.php', 'DrydockBlueprintSearchEngine' => 'applications/drydock/query/DrydockBlueprintSearchEngine.php',
'DrydockBlueprintViewController' => 'applications/drydock/controller/DrydockBlueprintViewController.php', 'DrydockBlueprintViewController' => 'applications/drydock/controller/DrydockBlueprintViewController.php',
'DrydockCommandInterface' => 'applications/drydock/interface/command/DrydockCommandInterface.php', 'DrydockCommandInterface' => 'applications/drydock/interface/command/DrydockCommandInterface.php',
'DrydockConsoleController' => 'applications/drydock/controller/DrydockConsoleController.php',
'DrydockConstants' => 'applications/drydock/constants/DrydockConstants.php', 'DrydockConstants' => 'applications/drydock/constants/DrydockConstants.php',
'DrydockController' => 'applications/drydock/controller/DrydockController.php', 'DrydockController' => 'applications/drydock/controller/DrydockController.php',
'DrydockDAO' => 'applications/drydock/storage/DrydockDAO.php', 'DrydockDAO' => 'applications/drydock/storage/DrydockDAO.php',
'DrydockFilesystemInterface' => 'applications/drydock/interface/filesystem/DrydockFilesystemInterface.php', 'DrydockFilesystemInterface' => 'applications/drydock/interface/filesystem/DrydockFilesystemInterface.php',
'DrydockInterface' => 'applications/drydock/interface/DrydockInterface.php', 'DrydockInterface' => 'applications/drydock/interface/DrydockInterface.php',
'DrydockLease' => 'applications/drydock/storage/DrydockLease.php', 'DrydockLease' => 'applications/drydock/storage/DrydockLease.php',
'DrydockLeaseController' => 'applications/drydock/controller/DrydockLeaseController.php',
'DrydockLeaseListController' => 'applications/drydock/controller/DrydockLeaseListController.php', 'DrydockLeaseListController' => 'applications/drydock/controller/DrydockLeaseListController.php',
'DrydockLeaseQuery' => 'applications/drydock/query/DrydockLeaseQuery.php', 'DrydockLeaseQuery' => 'applications/drydock/query/DrydockLeaseQuery.php',
'DrydockLeaseReleaseController' => 'applications/drydock/controller/DrydockLeaseReleaseController.php', 'DrydockLeaseReleaseController' => 'applications/drydock/controller/DrydockLeaseReleaseController.php',
@ -660,6 +663,7 @@ phutil_register_library_map(array(
'DrydockLocalCommandInterface' => 'applications/drydock/interface/command/DrydockLocalCommandInterface.php', 'DrydockLocalCommandInterface' => 'applications/drydock/interface/command/DrydockLocalCommandInterface.php',
'DrydockLocalHostBlueprintImplementation' => 'applications/drydock/blueprint/DrydockLocalHostBlueprintImplementation.php', 'DrydockLocalHostBlueprintImplementation' => 'applications/drydock/blueprint/DrydockLocalHostBlueprintImplementation.php',
'DrydockLog' => 'applications/drydock/storage/DrydockLog.php', 'DrydockLog' => 'applications/drydock/storage/DrydockLog.php',
'DrydockLogController' => 'applications/drydock/controller/DrydockLogController.php',
'DrydockLogListController' => 'applications/drydock/controller/DrydockLogListController.php', 'DrydockLogListController' => 'applications/drydock/controller/DrydockLogListController.php',
'DrydockLogQuery' => 'applications/drydock/query/DrydockLogQuery.php', 'DrydockLogQuery' => 'applications/drydock/query/DrydockLogQuery.php',
'DrydockLogSearchEngine' => 'applications/drydock/query/DrydockLogSearchEngine.php', 'DrydockLogSearchEngine' => 'applications/drydock/query/DrydockLogSearchEngine.php',
@ -675,6 +679,7 @@ phutil_register_library_map(array(
'DrydockPreallocatedHostBlueprintImplementation' => 'applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php', 'DrydockPreallocatedHostBlueprintImplementation' => 'applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php',
'DrydockResource' => 'applications/drydock/storage/DrydockResource.php', 'DrydockResource' => 'applications/drydock/storage/DrydockResource.php',
'DrydockResourceCloseController' => 'applications/drydock/controller/DrydockResourceCloseController.php', 'DrydockResourceCloseController' => 'applications/drydock/controller/DrydockResourceCloseController.php',
'DrydockResourceController' => 'applications/drydock/controller/DrydockResourceController.php',
'DrydockResourceListController' => 'applications/drydock/controller/DrydockResourceListController.php', 'DrydockResourceListController' => 'applications/drydock/controller/DrydockResourceListController.php',
'DrydockResourceQuery' => 'applications/drydock/query/DrydockResourceQuery.php', 'DrydockResourceQuery' => 'applications/drydock/query/DrydockResourceQuery.php',
'DrydockResourceSearchEngine' => 'applications/drydock/query/DrydockResourceSearchEngine.php', 'DrydockResourceSearchEngine' => 'applications/drydock/query/DrydockResourceSearchEngine.php',
@ -3043,17 +3048,19 @@ phutil_register_library_map(array(
0 => 'DrydockDAO', 0 => 'DrydockDAO',
1 => 'PhabricatorPolicyInterface', 1 => 'PhabricatorPolicyInterface',
), ),
'DrydockBlueprintCreateController' => 'DrydockController', 'DrydockBlueprintController' => 'DrydockController',
'DrydockBlueprintEditController' => 'DrydockController', 'DrydockBlueprintCreateController' => 'DrydockBlueprintController',
'DrydockBlueprintEditController' => 'DrydockBlueprintController',
'DrydockBlueprintListController' => 'DrydockBlueprintListController' =>
array( array(
0 => 'DrydockController', 0 => 'DrydockBlueprintController',
1 => 'PhabricatorApplicationSearchResultsControllerInterface', 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
), ),
'DrydockBlueprintQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'DrydockBlueprintQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'DrydockBlueprintSearchEngine' => 'PhabricatorApplicationSearchEngine', 'DrydockBlueprintSearchEngine' => 'PhabricatorApplicationSearchEngine',
'DrydockBlueprintViewController' => 'DrydockController', 'DrydockBlueprintViewController' => 'DrydockBlueprintController',
'DrydockCommandInterface' => 'DrydockInterface', 'DrydockCommandInterface' => 'DrydockInterface',
'DrydockConsoleController' => 'DrydockController',
'DrydockController' => 'PhabricatorController', 'DrydockController' => 'PhabricatorController',
'DrydockDAO' => 'PhabricatorLiskDAO', 'DrydockDAO' => 'PhabricatorLiskDAO',
'DrydockFilesystemInterface' => 'DrydockInterface', 'DrydockFilesystemInterface' => 'DrydockInterface',
@ -3062,16 +3069,17 @@ phutil_register_library_map(array(
0 => 'DrydockDAO', 0 => 'DrydockDAO',
1 => 'PhabricatorPolicyInterface', 1 => 'PhabricatorPolicyInterface',
), ),
'DrydockLeaseController' => 'DrydockController',
'DrydockLeaseListController' => 'DrydockLeaseListController' =>
array( array(
0 => 'DrydockController', 0 => 'DrydockLeaseController',
1 => 'PhabricatorApplicationSearchResultsControllerInterface', 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
), ),
'DrydockLeaseQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'DrydockLeaseQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'DrydockLeaseReleaseController' => 'DrydockController', 'DrydockLeaseReleaseController' => 'DrydockLeaseController',
'DrydockLeaseSearchEngine' => 'PhabricatorApplicationSearchEngine', 'DrydockLeaseSearchEngine' => 'PhabricatorApplicationSearchEngine',
'DrydockLeaseStatus' => 'DrydockConstants', 'DrydockLeaseStatus' => 'DrydockConstants',
'DrydockLeaseViewController' => 'DrydockController', 'DrydockLeaseViewController' => 'DrydockLeaseController',
'DrydockLocalCommandInterface' => 'DrydockCommandInterface', 'DrydockLocalCommandInterface' => 'DrydockCommandInterface',
'DrydockLocalHostBlueprintImplementation' => 'DrydockBlueprintImplementation', 'DrydockLocalHostBlueprintImplementation' => 'DrydockBlueprintImplementation',
'DrydockLog' => 'DrydockLog' =>
@ -3079,9 +3087,10 @@ phutil_register_library_map(array(
0 => 'DrydockDAO', 0 => 'DrydockDAO',
1 => 'PhabricatorPolicyInterface', 1 => 'PhabricatorPolicyInterface',
), ),
'DrydockLogController' => 'DrydockController',
'DrydockLogListController' => 'DrydockLogListController' =>
array( array(
0 => 'DrydockController', 0 => 'DrydockLogController',
1 => 'PhabricatorApplicationSearchResultsControllerInterface', 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
), ),
'DrydockLogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'DrydockLogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
@ -3101,16 +3110,17 @@ phutil_register_library_map(array(
0 => 'DrydockDAO', 0 => 'DrydockDAO',
1 => 'PhabricatorPolicyInterface', 1 => 'PhabricatorPolicyInterface',
), ),
'DrydockResourceCloseController' => 'DrydockController', 'DrydockResourceCloseController' => 'DrydockResourceController',
'DrydockResourceController' => 'DrydockController',
'DrydockResourceListController' => 'DrydockResourceListController' =>
array( array(
0 => 'DrydockController', 0 => 'DrydockResourceController',
1 => 'PhabricatorApplicationSearchResultsControllerInterface', 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
), ),
'DrydockResourceQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'DrydockResourceQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'DrydockResourceSearchEngine' => 'PhabricatorApplicationSearchEngine', 'DrydockResourceSearchEngine' => 'PhabricatorApplicationSearchEngine',
'DrydockResourceStatus' => 'DrydockConstants', 'DrydockResourceStatus' => 'DrydockConstants',
'DrydockResourceViewController' => 'DrydockController', 'DrydockResourceViewController' => 'DrydockResourceController',
'DrydockSFTPFilesystemInterface' => 'DrydockFilesystemInterface', 'DrydockSFTPFilesystemInterface' => 'DrydockFilesystemInterface',
'DrydockSSHCommandInterface' => 'DrydockCommandInterface', 'DrydockSSHCommandInterface' => 'DrydockCommandInterface',
'DrydockWebrootInterface' => 'DrydockInterface', 'DrydockWebrootInterface' => 'DrydockInterface',

View file

@ -33,7 +33,7 @@ final class PhabricatorApplicationDrydock extends PhabricatorApplication {
public function getRoutes() { public function getRoutes() {
return array( return array(
'/drydock/' => array( '/drydock/' => array(
'' => 'DrydockResourceListController', '' => 'DrydockConsoleController',
'blueprint/' => array( 'blueprint/' => array(
'(?:query/(?P<queryKey>[^/]+)/)?' => 'DrydockBlueprintListController', '(?:query/(?P<queryKey>[^/]+)/)?' => 'DrydockBlueprintListController',
'(?P<id>[1-9]\d*)/' => 'DrydockBlueprintViewController', '(?P<id>[1-9]\d*)/' => 'DrydockBlueprintViewController',

View file

@ -0,0 +1,27 @@
<?php
abstract class DrydockBlueprintController
extends DrydockController {
public function buildSideNavView() {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
id(new DrydockBlueprintSearchEngine())
->setViewer($this->getRequest()->getUser())
->addNavigationItems($nav->getMenu());
$nav->selectFilter(null);
return $nav;
}
public function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
$crumbs->addTextCrumb(
pht('Blueprints'),
$this->getApplicationURI('blueprint/'));
return $crumbs;
}
}

View file

@ -1,10 +1,7 @@
<?php <?php
final class DrydockBlueprintCreateController final class DrydockBlueprintCreateController
extends DrydockController { extends DrydockBlueprintController {
public function willProcessRequest(array $data) {
}
public function processRequest() { public function processRequest() {
$request = $this->getRequest(); $request = $this->getRequest();

View file

@ -1,6 +1,6 @@
<?php <?php
final class DrydockBlueprintEditController extends DrydockController { final class DrydockBlueprintEditController extends DrydockBlueprintController {
private $id; private $id;

View file

@ -1,6 +1,6 @@
<?php <?php
final class DrydockBlueprintListController extends DrydockController final class DrydockBlueprintListController extends DrydockBlueprintController
implements PhabricatorApplicationSearchResultsControllerInterface { implements PhabricatorApplicationSearchResultsControllerInterface {
private $queryKey; private $queryKey;
@ -18,7 +18,7 @@ final class DrydockBlueprintListController extends DrydockController
$controller = id(new PhabricatorApplicationSearchController($request)) $controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new DrydockBlueprintSearchEngine()) ->setSearchEngine(new DrydockBlueprintSearchEngine())
->setNavigation($this->buildSideNav()); ->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller); return $this->delegateToController($controller);
} }

View file

@ -1,6 +1,6 @@
<?php <?php
final class DrydockBlueprintViewController extends DrydockController { final class DrydockBlueprintViewController extends DrydockBlueprintController {
private $id; private $id;

View file

@ -0,0 +1,80 @@
<?php
final class DrydockConsoleController extends DrydockController {
public function shouldAllowPublic() {
return true;
}
public function buildSideNavView() {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
// These are only used on mobile.
$nav->addFilter('blueprint', pht('Blueprints'));
$nav->addFilter('resource', pht('Resources'));
$nav->addFilter('lease', pht('Leases'));
$nav->addFilter('log', pht('Logs'));
$nav->selectFilter(null);
return $nav;
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
$menu = id(new PHUIObjectItemListView())
->setUser($viewer);
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Blueprints'))
->setHref($this->getApplicationURI('blueprint/'))
->addAttribute(
pht(
'Configure blueprints so Drydock can build resources, like '.
'hosts and working copies.')));
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Resources'))
->setHref($this->getApplicationURI('resource/'))
->addAttribute(
pht(
'View and manage resources Drydock has built, like hosts.')));
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Leases'))
->setHref($this->getApplicationURI('lease/'))
->addAttribute(
pht(
'Manage leases on resources.')));
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Logs'))
->setHref($this->getApplicationURI('log/'))
->addAttribute(
pht(
'View logs.')));
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Console'));
return $this->buildApplicationPage(
array(
$crumbs,
$menu,
),
array(
'title' => pht('Drydock Console'),
'device' => true,
));
}
}

View file

@ -2,33 +2,10 @@
abstract class DrydockController extends PhabricatorController { abstract class DrydockController extends PhabricatorController {
final protected function buildSideNav($selected = null) { abstract function buildSideNavView();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/drydock/'));
id(new DrydockBlueprintSearchEngine())
->setViewer($this->getRequest()->getUser())
->addNavigationItems($nav->getMenu(), pht('Blueprints'));
id(new DrydockLeaseSearchEngine())
->setViewer($this->getRequest()->getUser())
->addNavigationItems($nav->getMenu(), pht('Leases'));
id(new DrydockResourceSearchEngine())
->setViewer($this->getRequest()->getUser())
->addNavigationItems($nav->getMenu(), pht('Resources'));
id(new DrydockLogSearchEngine())
->setViewer($this->getRequest()->getUser())
->addNavigationItems($nav->getMenu(), pht('Logs'));
$nav->selectFilter($selected, 'resource');
return $nav;
}
public function buildApplicationMenu() { public function buildApplicationMenu() {
return $this->buildSideNav(null)->getMenu(); return $this->buildSideNavView()->getMenu();
} }
protected function buildLogTableView(array $logs) { protected function buildLogTableView(array $logs) {

View file

@ -0,0 +1,27 @@
<?php
abstract class DrydockLeaseController
extends DrydockController {
public function buildSideNavView() {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
id(new DrydockLeaseSearchEngine())
->setViewer($this->getRequest()->getUser())
->addNavigationItems($nav->getMenu());
$nav->selectFilter(null);
return $nav;
}
public function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
$crumbs->addTextCrumb(
pht('Leases'),
$this->getApplicationURI('lease/'));
return $crumbs;
}
}

View file

@ -1,6 +1,6 @@
<?php <?php
final class DrydockLeaseListController extends DrydockController final class DrydockLeaseListController extends DrydockLeaseController
implements PhabricatorApplicationSearchResultsControllerInterface { implements PhabricatorApplicationSearchResultsControllerInterface {
private $queryKey; private $queryKey;
@ -18,7 +18,7 @@ final class DrydockLeaseListController extends DrydockController
$controller = id(new PhabricatorApplicationSearchController($request)) $controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new DrydockLeaseSearchEngine()) ->setSearchEngine(new DrydockLeaseSearchEngine())
->setNavigation($this->buildSideNav()); ->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller); return $this->delegateToController($controller);
} }

View file

@ -1,6 +1,6 @@
<?php <?php
final class DrydockLeaseReleaseController extends DrydockController { final class DrydockLeaseReleaseController extends DrydockLeaseController {
private $id; private $id;

View file

@ -1,6 +1,6 @@
<?php <?php
final class DrydockLeaseViewController extends DrydockController { final class DrydockLeaseViewController extends DrydockLeaseController {
private $id; private $id;

View file

@ -0,0 +1,27 @@
<?php
abstract class DrydockLogController
extends DrydockController {
public function buildSideNavView() {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
id(new DrydockLogSearchEngine())
->setViewer($this->getRequest()->getUser())
->addNavigationItems($nav->getMenu());
$nav->selectFilter(null);
return $nav;
}
public function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
$crumbs->addTextCrumb(
pht('Logs'),
$this->getApplicationURI('log/'));
return $crumbs;
}
}

View file

@ -1,6 +1,6 @@
<?php <?php
final class DrydockLogListController extends DrydockController final class DrydockLogListController extends DrydockLogController
implements PhabricatorApplicationSearchResultsControllerInterface { implements PhabricatorApplicationSearchResultsControllerInterface {
private $queryKey; private $queryKey;
@ -18,7 +18,7 @@ final class DrydockLogListController extends DrydockController
$controller = id(new PhabricatorApplicationSearchController($request)) $controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new DrydockLogSearchEngine()) ->setSearchEngine(new DrydockLogSearchEngine())
->setNavigation($this->buildSideNav()); ->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller); return $this->delegateToController($controller);
} }

View file

@ -1,6 +1,6 @@
<?php <?php
final class DrydockResourceCloseController extends DrydockController { final class DrydockResourceCloseController extends DrydockResourceController {
private $id; private $id;

View file

@ -0,0 +1,27 @@
<?php
abstract class DrydockResourceController
extends DrydockController {
public function buildSideNavView() {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
id(new DrydockResourceSearchEngine())
->setViewer($this->getRequest()->getUser())
->addNavigationItems($nav->getMenu());
$nav->selectFilter(null);
return $nav;
}
public function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
$crumbs->addTextCrumb(
pht('Resources'),
$this->getApplicationURI('resource/'));
return $crumbs;
}
}

View file

@ -1,6 +1,6 @@
<?php <?php
final class DrydockResourceListController extends DrydockController final class DrydockResourceListController extends DrydockResourceController
implements PhabricatorApplicationSearchResultsControllerInterface { implements PhabricatorApplicationSearchResultsControllerInterface {
private $queryKey; private $queryKey;
@ -18,7 +18,7 @@ final class DrydockResourceListController extends DrydockController
$controller = id(new PhabricatorApplicationSearchController($request)) $controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($this->queryKey) ->setQueryKey($this->queryKey)
->setSearchEngine(new DrydockResourceSearchEngine()) ->setSearchEngine(new DrydockResourceSearchEngine())
->setNavigation($this->buildSideNav()); ->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller); return $this->delegateToController($controller);
} }

View file

@ -1,6 +1,6 @@
<?php <?php
final class DrydockResourceViewController extends DrydockController { final class DrydockResourceViewController extends DrydockResourceController {
private $id; private $id;

View file

@ -154,8 +154,8 @@ final class PhabricatorApplicationSearchController
} }
$nav->selectFilter( $nav->selectFilter(
$engine->getNavPrefix().'query/'.$saved_query->getQueryKey(), 'query/'.$saved_query->getQueryKey(),
$engine->getNavPrefix().'query/advanced'); 'query/advanced');
$form = id(new AphrontFormView()) $form = id(new AphrontFormView())
->setUser($user); ->setUser($user);

View file

@ -107,40 +107,27 @@ abstract class PhabricatorApplicationSearchEngine {
->setEngineClassName(get_class($this)); ->setEngineClassName(get_class($this));
} }
public function getNavPrefix() { public function addNavigationItems(PHUIListView $menu) {
return get_class($this).':';
}
public function addNavigationItems(PHUIListView $menu, $label = null) {
$viewer = $this->requireViewer(); $viewer = $this->requireViewer();
$menu->newLabel(coalesce($label, pht('Queries'))); $menu->newLabel(pht('Queries'));
$named_queries = $this->loadEnabledNamedQueries(); $named_queries = $this->loadEnabledNamedQueries();
$prefix = $this->getNavPrefix();
foreach ($named_queries as $query) { foreach ($named_queries as $query) {
$key = $query->getQueryKey(); $key = $query->getQueryKey();
$uri = $this->getQueryResultsPageURI($key); $uri = $this->getQueryResultsPageURI($key);
$menu->newLink( $menu->newLink($query->getQueryName(), $uri, 'query/'.$key);
$query->getQueryName(),
$uri,
$prefix.'query/'.$key);
} }
if ($viewer->isLoggedIn()) { if ($viewer->isLoggedIn()) {
$manage_uri = $this->getQueryManagementURI(); $manage_uri = $this->getQueryManagementURI();
$menu->newLink( $menu->newLink(pht('Edit Queries...'), $manage_uri, 'query/edit');
pht('Edit Queries...'),
$manage_uri,
$prefix.'query/edit');
} }
$menu->newLabel(pht('Search')); $menu->newLabel(pht('Search'));
$advanced_uri = $this->getQueryResultsPageURI('advanced'); $advanced_uri = $this->getQueryResultsPageURI('advanced');
$menu->newLink( $menu->newLink(pht('Advanced Search'), $advanced_uri, 'query/advanced');
pht('Advanced Search'),
$advanced_uri, $prefix.'query/advanced');
return $this; return $this;
} }