Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15310274
D14295.id34505.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
12 KB
Referenced Files
None
Subscribers
None
D14295.id34505.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -881,8 +881,10 @@
'DrydockObjectAuthorizationView' => 'applications/drydock/view/DrydockObjectAuthorizationView.php',
'DrydockQuery' => 'applications/drydock/query/DrydockQuery.php',
'DrydockRepositoryOperation' => 'applications/drydock/storage/DrydockRepositoryOperation.php',
+ 'DrydockRepositoryOperationListController' => 'applications/drydock/controller/DrydockRepositoryOperationListController.php',
'DrydockRepositoryOperationPHIDType' => 'applications/drydock/phid/DrydockRepositoryOperationPHIDType.php',
'DrydockRepositoryOperationQuery' => 'applications/drydock/query/DrydockRepositoryOperationQuery.php',
+ 'DrydockRepositoryOperationSearchEngine' => 'applications/drydock/query/DrydockRepositoryOperationSearchEngine.php',
'DrydockRepositoryOperationType' => 'applications/drydock/operation/DrydockRepositoryOperationType.php',
'DrydockRepositoryOperationUpdateWorker' => 'applications/drydock/worker/DrydockRepositoryOperationUpdateWorker.php',
'DrydockRepositoryOperationViewController' => 'applications/drydock/controller/DrydockRepositoryOperationViewController.php',
@@ -4665,8 +4667,10 @@
'DrydockDAO',
'PhabricatorPolicyInterface',
),
+ 'DrydockRepositoryOperationListController' => 'DrydockController',
'DrydockRepositoryOperationPHIDType' => 'PhabricatorPHIDType',
'DrydockRepositoryOperationQuery' => 'DrydockQuery',
+ 'DrydockRepositoryOperationSearchEngine' => 'PhabricatorApplicationSearchEngine',
'DrydockRepositoryOperationType' => 'Phobject',
'DrydockRepositoryOperationUpdateWorker' => 'DrydockWorker',
'DrydockRepositoryOperationViewController' => 'DrydockController',
diff --git a/src/applications/drydock/application/PhabricatorDrydockApplication.php b/src/applications/drydock/application/PhabricatorDrydockApplication.php
--- a/src/applications/drydock/application/PhabricatorDrydockApplication.php
+++ b/src/applications/drydock/application/PhabricatorDrydockApplication.php
@@ -91,6 +91,8 @@
),
),
'(?P<type>operation)/' => array(
+ '(?:query/(?P<queryKey>[^/]+)/)?'
+ => 'DrydockRepositoryOperationListController',
'(?P<id>[1-9]\d*)/' => array(
'' => 'DrydockRepositoryOperationViewController',
),
diff --git a/src/applications/drydock/controller/DrydockAuthorizationAuthorizeController.php b/src/applications/drydock/controller/DrydockAuthorizationAuthorizeController.php
--- a/src/applications/drydock/controller/DrydockAuthorizationAuthorizeController.php
+++ b/src/applications/drydock/controller/DrydockAuthorizationAuthorizeController.php
@@ -82,14 +82,4 @@
->addCancelButton($authorization_uri);
}
- public function buildSideNavView() {
- // TODO: Get rid of this, but it's currently required by DrydockController.
- return null;
- }
-
- public function buildApplicationMenu() {
- // TODO: As above.
- return null;
- }
-
}
diff --git a/src/applications/drydock/controller/DrydockAuthorizationViewController.php b/src/applications/drydock/controller/DrydockAuthorizationViewController.php
--- a/src/applications/drydock/controller/DrydockAuthorizationViewController.php
+++ b/src/applications/drydock/controller/DrydockAuthorizationViewController.php
@@ -128,14 +128,4 @@
return $view;
}
- public function buildSideNavView() {
- // TODO: Get rid of this, but it's currently required by DrydockController.
- return null;
- }
-
- public function buildApplicationMenu() {
- // TODO: As above.
- return null;
- }
-
}
diff --git a/src/applications/drydock/controller/DrydockConsoleController.php b/src/applications/drydock/controller/DrydockConsoleController.php
--- a/src/applications/drydock/controller/DrydockConsoleController.php
+++ b/src/applications/drydock/controller/DrydockConsoleController.php
@@ -15,6 +15,7 @@
$nav->addFilter('blueprint', pht('Blueprints'));
$nav->addFilter('resource', pht('Resources'));
$nav->addFilter('lease', pht('Leases'));
+ $nav->addFilter('operation', pht('Repository Operations'));
$nav->selectFilter(null);
@@ -52,6 +53,13 @@
->setHref($this->getApplicationURI('lease/'))
->addAttribute(pht('Manage leases on resources.')));
+ $menu->addItem(
+ id(new PHUIObjectItemView())
+ ->setHeader(pht('Repository Operations'))
+ ->setFontIcon('fa-fighter-jet')
+ ->setHref($this->getApplicationURI('operation/'))
+ ->addAttribute(pht('Review the repository operation queue.')));
+
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Console'));
diff --git a/src/applications/drydock/controller/DrydockController.php b/src/applications/drydock/controller/DrydockController.php
--- a/src/applications/drydock/controller/DrydockController.php
+++ b/src/applications/drydock/controller/DrydockController.php
@@ -2,12 +2,6 @@
abstract class DrydockController extends PhabricatorController {
- abstract public function buildSideNavView();
-
- public function buildApplicationMenu() {
- return $this->buildSideNavView()->getMenu();
- }
-
protected function buildLocksTab($owner_phid) {
$locks = DrydockSlotLock::loadLocks($owner_phid);
diff --git a/src/applications/drydock/controller/DrydockRepositoryOperationListController.php b/src/applications/drydock/controller/DrydockRepositoryOperationListController.php
new file mode 100644
--- /dev/null
+++ b/src/applications/drydock/controller/DrydockRepositoryOperationListController.php
@@ -0,0 +1,38 @@
+<?php
+
+final class DrydockRepositoryOperationListController
+ extends DrydockController {
+
+ public function shouldAllowPublic() {
+ return true;
+ }
+
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
+ $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;
+ }
+
+}
diff --git a/src/applications/drydock/controller/DrydockRepositoryOperationViewController.php b/src/applications/drydock/controller/DrydockRepositoryOperationViewController.php
--- a/src/applications/drydock/controller/DrydockRepositoryOperationViewController.php
+++ b/src/applications/drydock/controller/DrydockRepositoryOperationViewController.php
@@ -3,6 +3,10 @@
final class DrydockRepositoryOperationViewController
extends DrydockController {
+ public function shouldAllowPublic() {
+ return true;
+ }
+
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
@@ -33,6 +37,9 @@
$properties->setActionList($actions);
$crumbs = $this->buildApplicationCrumbs();
+ $crumbs->addTextCrumb(
+ pht('Operations'),
+ $this->getApplicationURI('operation/'));
$crumbs->addTextCrumb($title);
$object_box = id(new PHUIObjectBoxView())
@@ -79,14 +86,4 @@
return $view;
}
- public function buildSideNavView() {
- // TODO: Get rid of this, but it's currently required by DrydockController.
- return null;
- }
-
- public function buildApplicationMenu() {
- // TODO: As above.
- return null;
- }
-
}
diff --git a/src/applications/drydock/operation/DrydockLandRepositoryOperation.php b/src/applications/drydock/operation/DrydockLandRepositoryOperation.php
--- a/src/applications/drydock/operation/DrydockLandRepositoryOperation.php
+++ b/src/applications/drydock/operation/DrydockLandRepositoryOperation.php
@@ -5,6 +5,12 @@
const OPCONST = 'land';
+ public function getOperationDescription(
+ DrydockRepositoryOperation $operation,
+ PhabricatorUser $viewer) {
+ return pht('Land Revision');
+ }
+
public function applyOperation(
DrydockRepositoryOperation $operation,
DrydockInterface $interface) {
diff --git a/src/applications/drydock/operation/DrydockRepositoryOperationType.php b/src/applications/drydock/operation/DrydockRepositoryOperationType.php
--- a/src/applications/drydock/operation/DrydockRepositoryOperationType.php
+++ b/src/applications/drydock/operation/DrydockRepositoryOperationType.php
@@ -8,6 +8,10 @@
DrydockRepositoryOperation $operation,
DrydockInterface $interface);
+ abstract public function getOperationDescription(
+ DrydockRepositoryOperation $operation,
+ PhabricatorUser $viewer);
+
final public function setViewer(PhabricatorUser $viewer) {
$this->viewer = $viewer;
return $this;
diff --git a/src/applications/drydock/query/DrydockRepositoryOperationSearchEngine.php b/src/applications/drydock/query/DrydockRepositoryOperationSearchEngine.php
new file mode 100644
--- /dev/null
+++ b/src/applications/drydock/query/DrydockRepositoryOperationSearchEngine.php
@@ -0,0 +1,99 @@
+<?php
+
+final class DrydockRepositoryOperationSearchEngine
+ extends PhabricatorApplicationSearchEngine {
+
+ public function getResultTypeDescription() {
+ return pht('Drydock Repository Operations');
+ }
+
+ public function getApplicationClassName() {
+ return 'PhabricatorDrydockApplication';
+ }
+
+ public function newQuery() {
+ return id(new DrydockRepositoryOperationQuery());
+ }
+
+ protected function buildQueryFromParameters(array $map) {
+ $query = $this->newQuery();
+
+ return $query;
+ }
+
+ protected function buildCustomSearchFields() {
+ return array(
+ );
+ }
+
+ protected function getURI($path) {
+ return '/drydock/operation/'.$path;
+ }
+
+ protected function getBuiltinQueryNames() {
+ return array(
+ 'all' => pht('All Operations'),
+ );
+ }
+
+ public function buildSavedQueryFromBuiltin($query_key) {
+ $query = $this->newSavedQuery();
+ $query->setQueryKey($query_key);
+
+ switch ($query_key) {
+ case 'all':
+ return $query;
+ }
+
+ return parent::buildSavedQueryFromBuiltin($query_key);
+ }
+
+ protected function renderResultList(
+ array $operations,
+ PhabricatorSavedQuery $query,
+ array $handles) {
+ assert_instances_of($operations, 'DrydockRepositoryOperation');
+
+ $viewer = $this->requireViewer();
+
+ $view = new PHUIObjectItemListView();
+ foreach ($operations as $operation) {
+ $id = $operation->getID();
+
+ $item = id(new PHUIObjectItemView())
+ ->setHeader($operation->getOperationDescription($viewer))
+ ->setHref($this->getApplicationURI("operation/{$id}/"))
+ ->setObjectName(pht('Repository Operation %d', $id));
+
+ $state = $operation->getOperationState();
+
+ $icon = DrydockRepositoryOperation::getOperationStateIcon($state);
+ $name = DrydockRepositoryOperation::getOperationStateName($state);
+
+ $item->addIcon($icon, $name);
+ $item->addByline(
+ array(
+ pht('Via:'),
+ ' ',
+ $viewer->renderHandle($operation->getAuthorPHID()),
+ ));
+
+ $item->addAttribute(
+ $viewer->renderHandle(
+ $operation->getObjectPHID()));
+
+ $item->addAttribute(
+ $viewer->renderHandle(
+ $operation->getRepositoryPHID()));
+
+ $view->addItem($item);
+ }
+
+ $result = id(new PhabricatorApplicationSearchResultView())
+ ->setObjectList($view)
+ ->setNoDataString(pht('No matching operations.'));
+
+ return $result;
+ }
+
+}
diff --git a/src/applications/drydock/storage/DrydockRepositoryOperation.php b/src/applications/drydock/storage/DrydockRepositoryOperation.php
--- a/src/applications/drydock/storage/DrydockRepositoryOperation.php
+++ b/src/applications/drydock/storage/DrydockRepositoryOperation.php
@@ -136,6 +136,12 @@
$interface);
}
+ public function getOperationDescription(PhabricatorUser $viewer) {
+ return $this->getImplementation()->getOperationDescription(
+ $this,
+ $viewer);
+ }
+
/* -( PhabricatorPolicyInterface )----------------------------------------- */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 7, 8:18 AM (4 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7328510
Default Alt Text
D14295.id34505.diff (12 KB)
Attached To
Mode
D14295: Add a basic list view for repository operations
Attached
Detach File
Event Timeline
Log In to Comment