1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Make Drydock repository operations a little more modern and consistent

Summary: Ref T10457. Use modern controller and UI tech to build the list view and actions.

Test Plan:
  - Viewed operation list.
  - Viewed operation detail.
  - Checked menus on mobile.

{F1139757}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10457

Differential Revision: https://secure.phabricator.com/D15393
This commit is contained in:
epriestley 2016-03-03 06:34:18 -08:00
parent fc0dc02bb9
commit e6158391d2
7 changed files with 41 additions and 49 deletions

View file

@ -939,6 +939,7 @@ phutil_register_library_map(array(
'DrydockObjectAuthorizationView' => 'applications/drydock/view/DrydockObjectAuthorizationView.php', 'DrydockObjectAuthorizationView' => 'applications/drydock/view/DrydockObjectAuthorizationView.php',
'DrydockQuery' => 'applications/drydock/query/DrydockQuery.php', 'DrydockQuery' => 'applications/drydock/query/DrydockQuery.php',
'DrydockRepositoryOperation' => 'applications/drydock/storage/DrydockRepositoryOperation.php', 'DrydockRepositoryOperation' => 'applications/drydock/storage/DrydockRepositoryOperation.php',
'DrydockRepositoryOperationController' => 'applications/drydock/controller/DrydockRepositoryOperationController.php',
'DrydockRepositoryOperationDismissController' => 'applications/drydock/controller/DrydockRepositoryOperationDismissController.php', 'DrydockRepositoryOperationDismissController' => 'applications/drydock/controller/DrydockRepositoryOperationDismissController.php',
'DrydockRepositoryOperationListController' => 'applications/drydock/controller/DrydockRepositoryOperationListController.php', 'DrydockRepositoryOperationListController' => 'applications/drydock/controller/DrydockRepositoryOperationListController.php',
'DrydockRepositoryOperationPHIDType' => 'applications/drydock/phid/DrydockRepositoryOperationPHIDType.php', 'DrydockRepositoryOperationPHIDType' => 'applications/drydock/phid/DrydockRepositoryOperationPHIDType.php',
@ -5066,16 +5067,17 @@ phutil_register_library_map(array(
'DrydockDAO', 'DrydockDAO',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',
), ),
'DrydockRepositoryOperationDismissController' => 'DrydockController', 'DrydockRepositoryOperationController' => 'DrydockController',
'DrydockRepositoryOperationListController' => 'DrydockController', 'DrydockRepositoryOperationDismissController' => 'DrydockRepositoryOperationController',
'DrydockRepositoryOperationListController' => 'DrydockRepositoryOperationController',
'DrydockRepositoryOperationPHIDType' => 'PhabricatorPHIDType', 'DrydockRepositoryOperationPHIDType' => 'PhabricatorPHIDType',
'DrydockRepositoryOperationQuery' => 'DrydockQuery', 'DrydockRepositoryOperationQuery' => 'DrydockQuery',
'DrydockRepositoryOperationSearchEngine' => 'PhabricatorApplicationSearchEngine', 'DrydockRepositoryOperationSearchEngine' => 'PhabricatorApplicationSearchEngine',
'DrydockRepositoryOperationStatusController' => 'DrydockController', 'DrydockRepositoryOperationStatusController' => 'DrydockRepositoryOperationController',
'DrydockRepositoryOperationStatusView' => 'AphrontView', 'DrydockRepositoryOperationStatusView' => 'AphrontView',
'DrydockRepositoryOperationType' => 'Phobject', 'DrydockRepositoryOperationType' => 'Phobject',
'DrydockRepositoryOperationUpdateWorker' => 'DrydockWorker', 'DrydockRepositoryOperationUpdateWorker' => 'DrydockWorker',
'DrydockRepositoryOperationViewController' => 'DrydockController', 'DrydockRepositoryOperationViewController' => 'DrydockRepositoryOperationController',
'DrydockResource' => array( 'DrydockResource' => array(
'DrydockDAO', 'DrydockDAO',
'PhabricatorPolicyInterface', 'PhabricatorPolicyInterface',

View file

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

View file

@ -1,7 +1,7 @@
<?php <?php
final class DrydockRepositoryOperationDismissController final class DrydockRepositoryOperationDismissController
extends DrydockController { extends DrydockRepositoryOperationController {
public function handleRequest(AphrontRequest $request) { public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer(); $viewer = $request->getViewer();

View file

@ -1,37 +1,16 @@
<?php <?php
final class DrydockRepositoryOperationListController final class DrydockRepositoryOperationListController
extends DrydockController { extends DrydockRepositoryOperationController {
public function shouldAllowPublic() { public function shouldAllowPublic() {
return true; return true;
} }
public function handleRequest(AphrontRequest $request) { public function handleRequest(AphrontRequest $request) {
$query_key = $request->getURIData('queryKey'); return id(new DrydockRepositoryOperationSearchEngine())
->setController($this)
$engine = new DrydockRepositoryOperationSearchEngine(); ->buildResponse();
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($query_key)
->setSearchEngine($engine)
->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller);
}
public function buildSideNavView() {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
$engine = id(new DrydockRepositoryOperationSearchEngine())
->setViewer($this->getViewer());
$engine->addNavigationItems($nav->getMenu());
$nav->selectFilter(null);
return $nav;
} }
} }

View file

@ -1,7 +1,7 @@
<?php <?php
final class DrydockRepositoryOperationStatusController final class DrydockRepositoryOperationStatusController
extends DrydockController { extends DrydockRepositoryOperationController {
public function shouldAllowPublic() { public function shouldAllowPublic() {
return true; return true;

View file

@ -1,7 +1,7 @@
<?php <?php
final class DrydockRepositoryOperationViewController final class DrydockRepositoryOperationViewController
extends DrydockController { extends DrydockRepositoryOperationController {
public function shouldAllowPublic() { public function shouldAllowPublic() {
return true; return true;
@ -50,16 +50,14 @@ final class DrydockRepositoryOperationViewController
->setUser($viewer) ->setUser($viewer)
->setOperation($operation); ->setOperation($operation);
return $this->buildApplicationPage( return $this->newPage()
array( ->setTitle($title)
$crumbs, ->setCrumbs($crumbs)
$object_box, ->appendChild(
$status_view, array(
), $object_box,
array( $status_view,
'title' => $title, ));
));
} }
private function buildActionListView(DrydockRepositoryOperation $operation) { private function buildActionListView(DrydockRepositoryOperation $operation) {

View file

@ -70,7 +70,8 @@ final class DrydockRepositoryOperationSearchEngine
$icon = DrydockRepositoryOperation::getOperationStateIcon($state); $icon = DrydockRepositoryOperation::getOperationStateIcon($state);
$name = DrydockRepositoryOperation::getOperationStateName($state); $name = DrydockRepositoryOperation::getOperationStateName($state);
$item->addIcon($icon, $name); $item->setStatusIcon($icon, $name);
$item->addByline( $item->addByline(
array( array(
pht('Via:'), pht('Via:'),
@ -78,13 +79,14 @@ final class DrydockRepositoryOperationSearchEngine
$viewer->renderHandle($operation->getAuthorPHID()), $viewer->renderHandle($operation->getAuthorPHID()),
)); ));
$item->addAttribute( $object_phid = $operation->getObjectPHID();
$viewer->renderHandle( $repository_phid = $operation->getRepositoryPHID();
$operation->getObjectPHID()));
$item->addAttribute( $item->addAttribute($viewer->renderHandle($object_phid));
$viewer->renderHandle(
$operation->getRepositoryPHID())); if ($repository_phid !== $object_phid) {
$item->addAttribute($viewer->renderHandle($repository_phid));
}
$view->addItem($item); $view->addItem($item);
} }