mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 09:20:58 +01:00
Introduce DrydockQuery to slightly reduce code duplication
Summary: Ref T2015. All the Drydock query classes share the application method; move it into a shared base class to slightly shrink the codebase. Test Plan: Browsed query UIs. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2015 Differential Revision: https://secure.phabricator.com/D7837
This commit is contained in:
parent
9b0fa5747b
commit
1ba52fac86
6 changed files with 20 additions and 27 deletions
|
@ -676,6 +676,7 @@ phutil_register_library_map(array(
|
||||||
'DrydockPHIDTypeLease' => 'applications/drydock/phid/DrydockPHIDTypeLease.php',
|
'DrydockPHIDTypeLease' => 'applications/drydock/phid/DrydockPHIDTypeLease.php',
|
||||||
'DrydockPHIDTypeResource' => 'applications/drydock/phid/DrydockPHIDTypeResource.php',
|
'DrydockPHIDTypeResource' => 'applications/drydock/phid/DrydockPHIDTypeResource.php',
|
||||||
'DrydockPreallocatedHostBlueprintImplementation' => 'applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php',
|
'DrydockPreallocatedHostBlueprintImplementation' => 'applications/drydock/blueprint/DrydockPreallocatedHostBlueprintImplementation.php',
|
||||||
|
'DrydockQuery' => 'applications/drydock/query/DrydockQuery.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',
|
'DrydockResourceController' => 'applications/drydock/controller/DrydockResourceController.php',
|
||||||
|
@ -3055,7 +3056,7 @@ phutil_register_library_map(array(
|
||||||
0 => 'DrydockBlueprintController',
|
0 => 'DrydockBlueprintController',
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
||||||
),
|
),
|
||||||
'DrydockBlueprintQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'DrydockBlueprintQuery' => 'DrydockQuery',
|
||||||
'DrydockBlueprintSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'DrydockBlueprintSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'DrydockBlueprintViewController' => 'DrydockBlueprintController',
|
'DrydockBlueprintViewController' => 'DrydockBlueprintController',
|
||||||
'DrydockCommandInterface' => 'DrydockInterface',
|
'DrydockCommandInterface' => 'DrydockInterface',
|
||||||
|
@ -3074,7 +3075,7 @@ phutil_register_library_map(array(
|
||||||
0 => 'DrydockLeaseController',
|
0 => 'DrydockLeaseController',
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
||||||
),
|
),
|
||||||
'DrydockLeaseQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'DrydockLeaseQuery' => 'DrydockQuery',
|
||||||
'DrydockLeaseReleaseController' => 'DrydockLeaseController',
|
'DrydockLeaseReleaseController' => 'DrydockLeaseController',
|
||||||
'DrydockLeaseSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'DrydockLeaseSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'DrydockLeaseStatus' => 'DrydockConstants',
|
'DrydockLeaseStatus' => 'DrydockConstants',
|
||||||
|
@ -3092,7 +3093,7 @@ phutil_register_library_map(array(
|
||||||
0 => 'DrydockLogController',
|
0 => 'DrydockLogController',
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
||||||
),
|
),
|
||||||
'DrydockLogQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'DrydockLogQuery' => 'DrydockQuery',
|
||||||
'DrydockLogSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'DrydockLogSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'DrydockManagementCloseWorkflow' => 'DrydockManagementWorkflow',
|
'DrydockManagementCloseWorkflow' => 'DrydockManagementWorkflow',
|
||||||
'DrydockManagementCreateResourceWorkflow' => 'DrydockManagementWorkflow',
|
'DrydockManagementCreateResourceWorkflow' => 'DrydockManagementWorkflow',
|
||||||
|
@ -3103,6 +3104,7 @@ phutil_register_library_map(array(
|
||||||
'DrydockPHIDTypeLease' => 'PhabricatorPHIDType',
|
'DrydockPHIDTypeLease' => 'PhabricatorPHIDType',
|
||||||
'DrydockPHIDTypeResource' => 'PhabricatorPHIDType',
|
'DrydockPHIDTypeResource' => 'PhabricatorPHIDType',
|
||||||
'DrydockPreallocatedHostBlueprintImplementation' => 'DrydockBlueprintImplementation',
|
'DrydockPreallocatedHostBlueprintImplementation' => 'DrydockBlueprintImplementation',
|
||||||
|
'DrydockQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'DrydockResource' =>
|
'DrydockResource' =>
|
||||||
array(
|
array(
|
||||||
0 => 'DrydockDAO',
|
0 => 'DrydockDAO',
|
||||||
|
@ -3115,7 +3117,7 @@ phutil_register_library_map(array(
|
||||||
0 => 'DrydockResourceController',
|
0 => 'DrydockResourceController',
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
||||||
),
|
),
|
||||||
'DrydockResourceQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'DrydockResourceQuery' => 'DrydockQuery',
|
||||||
'DrydockResourceSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'DrydockResourceSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'DrydockResourceStatus' => 'DrydockConstants',
|
'DrydockResourceStatus' => 'DrydockConstants',
|
||||||
'DrydockResourceViewController' => 'DrydockResourceController',
|
'DrydockResourceViewController' => 'DrydockResourceController',
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class DrydockBlueprintQuery
|
final class DrydockBlueprintQuery extends DrydockQuery {
|
||||||
extends PhabricatorCursorPagedPolicyAwareQuery {
|
|
||||||
|
|
||||||
private $ids;
|
private $ids;
|
||||||
private $phids;
|
private $phids;
|
||||||
|
@ -63,8 +62,4 @@ final class DrydockBlueprintQuery
|
||||||
return $this->formatWhereClause($where);
|
return $this->formatWhereClause($where);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryApplicationClass() {
|
|
||||||
return 'PhabricatorApplicationDrydock';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class DrydockLeaseQuery
|
final class DrydockLeaseQuery extends DrydockQuery {
|
||||||
extends PhabricatorCursorPagedPolicyAwareQuery {
|
|
||||||
|
|
||||||
private $ids;
|
private $ids;
|
||||||
private $phids;
|
private $phids;
|
||||||
|
@ -106,8 +105,4 @@ final class DrydockLeaseQuery
|
||||||
return $this->formatWhereClause($where);
|
return $this->formatWhereClause($where);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryApplicationClass() {
|
|
||||||
return 'PhabricatorApplicationDrydock';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class DrydockLogQuery extends PhabricatorCursorPagedPolicyAwareQuery {
|
final class DrydockLogQuery extends DrydockQuery {
|
||||||
|
|
||||||
private $resourceIDs;
|
private $resourceIDs;
|
||||||
private $leaseIDs;
|
private $leaseIDs;
|
||||||
|
@ -110,8 +110,4 @@ final class DrydockLogQuery extends PhabricatorCursorPagedPolicyAwareQuery {
|
||||||
return $this->formatWhereClause($where);
|
return $this->formatWhereClause($where);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryApplicationClass() {
|
|
||||||
return 'PhabricatorApplicationDrydock';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
10
src/applications/drydock/query/DrydockQuery.php
Normal file
10
src/applications/drydock/query/DrydockQuery.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
abstract class DrydockQuery
|
||||||
|
extends PhabricatorCursorPagedPolicyAwareQuery {
|
||||||
|
|
||||||
|
public function getQueryApplicationClass() {
|
||||||
|
return 'PhabricatorApplicationDrydock';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class DrydockResourceQuery
|
final class DrydockResourceQuery extends DrydockQuery {
|
||||||
extends PhabricatorCursorPagedPolicyAwareQuery {
|
|
||||||
|
|
||||||
private $ids;
|
private $ids;
|
||||||
private $phids;
|
private $phids;
|
||||||
|
@ -94,8 +93,4 @@ final class DrydockResourceQuery
|
||||||
return $this->formatWhereClause($where);
|
return $this->formatWhereClause($where);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getQueryApplicationClass() {
|
|
||||||
return 'PhabricatorApplicationDrydock';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue