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

Use modern SearchEngine construction in Nuance

Summary: Ref T10537. Minor cleanup of controllers to be more modern / work better on mobile.

Test Plan: Browsed all queue / source pages.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10537

Differential Revision: https://secure.phabricator.com/D15428
This commit is contained in:
epriestley 2016-03-07 15:18:55 -08:00
parent 2ddd78647b
commit 98542637a1
10 changed files with 51 additions and 58 deletions

View file

@ -1433,6 +1433,7 @@ phutil_register_library_map(array(
'NuancePhabricatorFormSourceDefinition' => 'applications/nuance/source/NuancePhabricatorFormSourceDefinition.php',
'NuanceQuery' => 'applications/nuance/query/NuanceQuery.php',
'NuanceQueue' => 'applications/nuance/storage/NuanceQueue.php',
'NuanceQueueController' => 'applications/nuance/controller/NuanceQueueController.php',
'NuanceQueueDatasource' => 'applications/nuance/typeahead/NuanceQueueDatasource.php',
'NuanceQueueEditController' => 'applications/nuance/controller/NuanceQueueEditController.php',
'NuanceQueueEditor' => 'applications/nuance/editor/NuanceQueueEditor.php',
@ -1457,6 +1458,7 @@ phutil_register_library_map(array(
'NuanceSchemaSpec' => 'applications/nuance/storage/NuanceSchemaSpec.php',
'NuanceSource' => 'applications/nuance/storage/NuanceSource.php',
'NuanceSourceActionController' => 'applications/nuance/controller/NuanceSourceActionController.php',
'NuanceSourceController' => 'applications/nuance/controller/NuanceSourceController.php',
'NuanceSourceCreateController' => 'applications/nuance/controller/NuanceSourceCreateController.php',
'NuanceSourceDefaultEditCapability' => 'applications/nuance/capability/NuanceSourceDefaultEditCapability.php',
'NuanceSourceDefaultViewCapability' => 'applications/nuance/capability/NuanceSourceDefaultViewCapability.php',
@ -5678,17 +5680,18 @@ phutil_register_library_map(array(
'PhabricatorPolicyInterface',
'PhabricatorApplicationTransactionInterface',
),
'NuanceQueueController' => 'NuanceController',
'NuanceQueueDatasource' => 'PhabricatorTypeaheadDatasource',
'NuanceQueueEditController' => 'NuanceController',
'NuanceQueueEditController' => 'NuanceQueueController',
'NuanceQueueEditor' => 'PhabricatorApplicationTransactionEditor',
'NuanceQueueListController' => 'NuanceController',
'NuanceQueueListController' => 'NuanceQueueController',
'NuanceQueuePHIDType' => 'PhabricatorPHIDType',
'NuanceQueueQuery' => 'NuanceQuery',
'NuanceQueueSearchEngine' => 'PhabricatorApplicationSearchEngine',
'NuanceQueueTransaction' => 'NuanceTransaction',
'NuanceQueueTransactionComment' => 'PhabricatorApplicationTransactionComment',
'NuanceQueueTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'NuanceQueueViewController' => 'NuanceController',
'NuanceQueueViewController' => 'NuanceQueueController',
'NuanceRequestor' => array(
'NuanceDAO',
'PhabricatorPolicyInterface',
@ -5710,14 +5713,15 @@ phutil_register_library_map(array(
'PhabricatorPolicyInterface',
),
'NuanceSourceActionController' => 'NuanceController',
'NuanceSourceCreateController' => 'NuanceController',
'NuanceSourceController' => 'NuanceController',
'NuanceSourceCreateController' => 'NuanceSourceController',
'NuanceSourceDefaultEditCapability' => 'PhabricatorPolicyCapability',
'NuanceSourceDefaultViewCapability' => 'PhabricatorPolicyCapability',
'NuanceSourceDefinition' => 'Phobject',
'NuanceSourceDefinitionTestCase' => 'PhabricatorTestCase',
'NuanceSourceEditController' => 'NuanceController',
'NuanceSourceEditController' => 'NuanceSourceController',
'NuanceSourceEditor' => 'PhabricatorApplicationTransactionEditor',
'NuanceSourceListController' => 'NuanceController',
'NuanceSourceListController' => 'NuanceSourceController',
'NuanceSourceManageCapability' => 'PhabricatorPolicyCapability',
'NuanceSourcePHIDType' => 'PhabricatorPHIDType',
'NuanceSourceQuery' => 'NuanceQuery',
@ -5725,7 +5729,7 @@ phutil_register_library_map(array(
'NuanceSourceTransaction' => 'NuanceTransaction',
'NuanceSourceTransactionComment' => 'PhabricatorApplicationTransactionComment',
'NuanceSourceTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
'NuanceSourceViewController' => 'NuanceController',
'NuanceSourceViewController' => 'NuanceSourceController',
'NuanceTransaction' => 'PhabricatorApplicationTransaction',
'OwnersConduitAPIMethod' => 'ConduitAPIMethod',
'OwnersEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod',

View file

@ -0,0 +1,11 @@
<?php
abstract class NuanceQueueController
extends NuanceController {
public function buildApplicationMenu() {
return $this->newApplicationMenu()
->setSearchEngine(new NuanceQueueSearchEngine());
}
}

View file

@ -1,6 +1,7 @@
<?php
final class NuanceQueueEditController extends NuanceController {
final class NuanceQueueEditController
extends NuanceQueueController {
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();

View file

@ -1,31 +1,12 @@
<?php
final class NuanceQueueListController
extends NuanceController {
extends NuanceQueueController {
public function handleRequest(AphrontRequest $request) {
$request = $this->getRequest();
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($request->getURIData('queryKey'))
->setSearchEngine(new NuanceQueueSearchEngine())
->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller);
}
public function buildSideNavView($for_app = false) {
$user = $this->getRequest()->getUser();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
id(new NuanceQueueSearchEngine())
->setViewer($user)
->addNavigationItems($nav->getMenu());
$nav->selectFilter(null);
return $nav;
return id(new NuanceQueueSearchEngine())
->setController($this)
->buildResponse();
}
protected function buildApplicationCrumbs() {

View file

@ -1,6 +1,7 @@
<?php
final class NuanceQueueViewController extends NuanceController {
final class NuanceQueueViewController
extends NuanceQueueController {
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();

View file

@ -0,0 +1,11 @@
<?php
abstract class NuanceSourceController
extends NuanceController {
public function buildApplicationMenu() {
return $this->newApplicationMenu()
->setSearchEngine(new NuanceSourceSearchEngine());
}
}

View file

@ -1,6 +1,7 @@
<?php
final class NuanceSourceCreateController extends NuanceController {
final class NuanceSourceCreateController
extends NuanceSourceController {
public function handleRequest(AphrontRequest $request) {
$can_edit = $this->requireApplicationCapability(

View file

@ -1,6 +1,7 @@
<?php
final class NuanceSourceEditController extends NuanceController {
final class NuanceSourceEditController
extends NuanceSourceController {
public function handleRequest(AphrontRequest $request) {
$can_edit = $this->requireApplicationCapability(

View file

@ -1,31 +1,12 @@
<?php
final class NuanceSourceListController
extends NuanceController {
extends NuanceSourceController {
public function handleRequest(AphrontRequest $request) {
$request = $this->getRequest();
$controller = id(new PhabricatorApplicationSearchController($request))
->setQueryKey($request->getURIData('queryKey'))
->setSearchEngine(new NuanceSourceSearchEngine())
->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller);
}
public function buildSideNavView($for_app = false) {
$user = $this->getRequest()->getUser();
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
id(new NuanceSourceSearchEngine())
->setViewer($user)
->addNavigationItems($nav->getMenu());
$nav->selectFilter(null);
return $nav;
return id(new NuanceSourceSearchEngine())
->setController($this)
->buildResponse();
}
protected function buildApplicationCrumbs() {

View file

@ -1,6 +1,7 @@
<?php
final class NuanceSourceViewController extends NuanceController {
final class NuanceSourceViewController
extends NuanceSourceController {
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();