mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 12:52:42 +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:
parent
fc0dc02bb9
commit
e6158391d2
7 changed files with 41 additions and 49 deletions
|
@ -939,6 +939,7 @@ phutil_register_library_map(array(
|
|||
'DrydockObjectAuthorizationView' => 'applications/drydock/view/DrydockObjectAuthorizationView.php',
|
||||
'DrydockQuery' => 'applications/drydock/query/DrydockQuery.php',
|
||||
'DrydockRepositoryOperation' => 'applications/drydock/storage/DrydockRepositoryOperation.php',
|
||||
'DrydockRepositoryOperationController' => 'applications/drydock/controller/DrydockRepositoryOperationController.php',
|
||||
'DrydockRepositoryOperationDismissController' => 'applications/drydock/controller/DrydockRepositoryOperationDismissController.php',
|
||||
'DrydockRepositoryOperationListController' => 'applications/drydock/controller/DrydockRepositoryOperationListController.php',
|
||||
'DrydockRepositoryOperationPHIDType' => 'applications/drydock/phid/DrydockRepositoryOperationPHIDType.php',
|
||||
|
@ -5066,16 +5067,17 @@ phutil_register_library_map(array(
|
|||
'DrydockDAO',
|
||||
'PhabricatorPolicyInterface',
|
||||
),
|
||||
'DrydockRepositoryOperationDismissController' => 'DrydockController',
|
||||
'DrydockRepositoryOperationListController' => 'DrydockController',
|
||||
'DrydockRepositoryOperationController' => 'DrydockController',
|
||||
'DrydockRepositoryOperationDismissController' => 'DrydockRepositoryOperationController',
|
||||
'DrydockRepositoryOperationListController' => 'DrydockRepositoryOperationController',
|
||||
'DrydockRepositoryOperationPHIDType' => 'PhabricatorPHIDType',
|
||||
'DrydockRepositoryOperationQuery' => 'DrydockQuery',
|
||||
'DrydockRepositoryOperationSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||
'DrydockRepositoryOperationStatusController' => 'DrydockController',
|
||||
'DrydockRepositoryOperationStatusController' => 'DrydockRepositoryOperationController',
|
||||
'DrydockRepositoryOperationStatusView' => 'AphrontView',
|
||||
'DrydockRepositoryOperationType' => 'Phobject',
|
||||
'DrydockRepositoryOperationUpdateWorker' => 'DrydockWorker',
|
||||
'DrydockRepositoryOperationViewController' => 'DrydockController',
|
||||
'DrydockRepositoryOperationViewController' => 'DrydockRepositoryOperationController',
|
||||
'DrydockResource' => array(
|
||||
'DrydockDAO',
|
||||
'PhabricatorPolicyInterface',
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
abstract class DrydockRepositoryOperationController
|
||||
extends DrydockController {
|
||||
|
||||
public function buildApplicationMenu() {
|
||||
return $this->newApplicationMenu()
|
||||
->setSearchEngine(new DrydockRepositoryOperationSearchEngine());
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
final class DrydockRepositoryOperationDismissController
|
||||
extends DrydockController {
|
||||
extends DrydockRepositoryOperationController {
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$viewer = $request->getViewer();
|
||||
|
|
|
@ -1,37 +1,16 @@
|
|||
<?php
|
||||
|
||||
final class DrydockRepositoryOperationListController
|
||||
extends DrydockController {
|
||||
extends DrydockRepositoryOperationController {
|
||||
|
||||
public function shouldAllowPublic() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$query_key = $request->getURIData('queryKey');
|
||||
|
||||
$engine = new DrydockRepositoryOperationSearchEngine();
|
||||
|
||||
$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;
|
||||
return id(new DrydockRepositoryOperationSearchEngine())
|
||||
->setController($this)
|
||||
->buildResponse();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
final class DrydockRepositoryOperationStatusController
|
||||
extends DrydockController {
|
||||
extends DrydockRepositoryOperationController {
|
||||
|
||||
public function shouldAllowPublic() {
|
||||
return true;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
|
||||
final class DrydockRepositoryOperationViewController
|
||||
extends DrydockController {
|
||||
extends DrydockRepositoryOperationController {
|
||||
|
||||
public function shouldAllowPublic() {
|
||||
return true;
|
||||
|
@ -50,16 +50,14 @@ final class DrydockRepositoryOperationViewController
|
|||
->setUser($viewer)
|
||||
->setOperation($operation);
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
$crumbs,
|
||||
$object_box,
|
||||
$status_view,
|
||||
),
|
||||
array(
|
||||
'title' => $title,
|
||||
));
|
||||
|
||||
return $this->newPage()
|
||||
->setTitle($title)
|
||||
->setCrumbs($crumbs)
|
||||
->appendChild(
|
||||
array(
|
||||
$object_box,
|
||||
$status_view,
|
||||
));
|
||||
}
|
||||
|
||||
private function buildActionListView(DrydockRepositoryOperation $operation) {
|
||||
|
|
|
@ -70,7 +70,8 @@ final class DrydockRepositoryOperationSearchEngine
|
|||
$icon = DrydockRepositoryOperation::getOperationStateIcon($state);
|
||||
$name = DrydockRepositoryOperation::getOperationStateName($state);
|
||||
|
||||
$item->addIcon($icon, $name);
|
||||
$item->setStatusIcon($icon, $name);
|
||||
|
||||
$item->addByline(
|
||||
array(
|
||||
pht('Via:'),
|
||||
|
@ -78,13 +79,14 @@ final class DrydockRepositoryOperationSearchEngine
|
|||
$viewer->renderHandle($operation->getAuthorPHID()),
|
||||
));
|
||||
|
||||
$item->addAttribute(
|
||||
$viewer->renderHandle(
|
||||
$operation->getObjectPHID()));
|
||||
$object_phid = $operation->getObjectPHID();
|
||||
$repository_phid = $operation->getRepositoryPHID();
|
||||
|
||||
$item->addAttribute(
|
||||
$viewer->renderHandle(
|
||||
$operation->getRepositoryPHID()));
|
||||
$item->addAttribute($viewer->renderHandle($object_phid));
|
||||
|
||||
if ($repository_phid !== $object_phid) {
|
||||
$item->addAttribute($viewer->renderHandle($repository_phid));
|
||||
}
|
||||
|
||||
$view->addItem($item);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue