mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 09:20:58 +01:00
Add "project.column.search" for querying workboard column information
Summary: Ref T12074. Provide a basic but functional v3 API endpoint for reading workboard column information. There is no equivalent to this in the UI yet, although there may be some day (perhaps adjacent to T5024). Test Plan: - Queried for all columns. - Queried for columns on a particular board using `projectPHIDs`. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12074 Differential Revision: https://secure.phabricator.com/D17157
This commit is contained in:
parent
ad3745c801
commit
63bfa5ccb5
4 changed files with 133 additions and 1 deletions
|
@ -3427,6 +3427,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorProjectColumnPosition' => 'applications/project/storage/PhabricatorProjectColumnPosition.php',
|
'PhabricatorProjectColumnPosition' => 'applications/project/storage/PhabricatorProjectColumnPosition.php',
|
||||||
'PhabricatorProjectColumnPositionQuery' => 'applications/project/query/PhabricatorProjectColumnPositionQuery.php',
|
'PhabricatorProjectColumnPositionQuery' => 'applications/project/query/PhabricatorProjectColumnPositionQuery.php',
|
||||||
'PhabricatorProjectColumnQuery' => 'applications/project/query/PhabricatorProjectColumnQuery.php',
|
'PhabricatorProjectColumnQuery' => 'applications/project/query/PhabricatorProjectColumnQuery.php',
|
||||||
|
'PhabricatorProjectColumnSearchEngine' => 'applications/project/query/PhabricatorProjectColumnSearchEngine.php',
|
||||||
'PhabricatorProjectColumnTransaction' => 'applications/project/storage/PhabricatorProjectColumnTransaction.php',
|
'PhabricatorProjectColumnTransaction' => 'applications/project/storage/PhabricatorProjectColumnTransaction.php',
|
||||||
'PhabricatorProjectColumnTransactionEditor' => 'applications/project/editor/PhabricatorProjectColumnTransactionEditor.php',
|
'PhabricatorProjectColumnTransactionEditor' => 'applications/project/editor/PhabricatorProjectColumnTransactionEditor.php',
|
||||||
'PhabricatorProjectColumnTransactionQuery' => 'applications/project/query/PhabricatorProjectColumnTransactionQuery.php',
|
'PhabricatorProjectColumnTransactionQuery' => 'applications/project/query/PhabricatorProjectColumnTransactionQuery.php',
|
||||||
|
@ -4454,6 +4455,7 @@ phutil_register_library_map(array(
|
||||||
'ProjectAddProjectsEmailCommand' => 'applications/project/command/ProjectAddProjectsEmailCommand.php',
|
'ProjectAddProjectsEmailCommand' => 'applications/project/command/ProjectAddProjectsEmailCommand.php',
|
||||||
'ProjectBoardTaskCard' => 'applications/project/view/ProjectBoardTaskCard.php',
|
'ProjectBoardTaskCard' => 'applications/project/view/ProjectBoardTaskCard.php',
|
||||||
'ProjectCanLockProjectsCapability' => 'applications/project/capability/ProjectCanLockProjectsCapability.php',
|
'ProjectCanLockProjectsCapability' => 'applications/project/capability/ProjectCanLockProjectsCapability.php',
|
||||||
|
'ProjectColumnSearchConduitAPIMethod' => 'applications/project/conduit/ProjectColumnSearchConduitAPIMethod.php',
|
||||||
'ProjectConduitAPIMethod' => 'applications/project/conduit/ProjectConduitAPIMethod.php',
|
'ProjectConduitAPIMethod' => 'applications/project/conduit/ProjectConduitAPIMethod.php',
|
||||||
'ProjectCreateConduitAPIMethod' => 'applications/project/conduit/ProjectCreateConduitAPIMethod.php',
|
'ProjectCreateConduitAPIMethod' => 'applications/project/conduit/ProjectCreateConduitAPIMethod.php',
|
||||||
'ProjectCreateProjectsCapability' => 'applications/project/capability/ProjectCreateProjectsCapability.php',
|
'ProjectCreateProjectsCapability' => 'applications/project/capability/ProjectCreateProjectsCapability.php',
|
||||||
|
@ -8565,6 +8567,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorPolicyInterface',
|
'PhabricatorPolicyInterface',
|
||||||
'PhabricatorDestructibleInterface',
|
'PhabricatorDestructibleInterface',
|
||||||
'PhabricatorExtendedPolicyInterface',
|
'PhabricatorExtendedPolicyInterface',
|
||||||
|
'PhabricatorConduitResultInterface',
|
||||||
),
|
),
|
||||||
'PhabricatorProjectColumnDetailController' => 'PhabricatorProjectBoardController',
|
'PhabricatorProjectColumnDetailController' => 'PhabricatorProjectBoardController',
|
||||||
'PhabricatorProjectColumnEditController' => 'PhabricatorProjectBoardController',
|
'PhabricatorProjectColumnEditController' => 'PhabricatorProjectBoardController',
|
||||||
|
@ -8576,6 +8579,7 @@ phutil_register_library_map(array(
|
||||||
),
|
),
|
||||||
'PhabricatorProjectColumnPositionQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorProjectColumnPositionQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'PhabricatorProjectColumnQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorProjectColumnQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
|
'PhabricatorProjectColumnSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'PhabricatorProjectColumnTransaction' => 'PhabricatorApplicationTransaction',
|
'PhabricatorProjectColumnTransaction' => 'PhabricatorApplicationTransaction',
|
||||||
'PhabricatorProjectColumnTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
|
'PhabricatorProjectColumnTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||||
'PhabricatorProjectColumnTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
'PhabricatorProjectColumnTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
||||||
|
@ -9849,6 +9853,7 @@ phutil_register_library_map(array(
|
||||||
'ProjectAddProjectsEmailCommand' => 'MetaMTAEmailTransactionCommand',
|
'ProjectAddProjectsEmailCommand' => 'MetaMTAEmailTransactionCommand',
|
||||||
'ProjectBoardTaskCard' => 'Phobject',
|
'ProjectBoardTaskCard' => 'Phobject',
|
||||||
'ProjectCanLockProjectsCapability' => 'PhabricatorPolicyCapability',
|
'ProjectCanLockProjectsCapability' => 'PhabricatorPolicyCapability',
|
||||||
|
'ProjectColumnSearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
|
||||||
'ProjectConduitAPIMethod' => 'ConduitAPIMethod',
|
'ProjectConduitAPIMethod' => 'ConduitAPIMethod',
|
||||||
'ProjectCreateConduitAPIMethod' => 'ProjectConduitAPIMethod',
|
'ProjectCreateConduitAPIMethod' => 'ProjectConduitAPIMethod',
|
||||||
'ProjectCreateProjectsCapability' => 'PhabricatorPolicyCapability',
|
'ProjectCreateProjectsCapability' => 'PhabricatorPolicyCapability',
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class ProjectColumnSearchConduitAPIMethod
|
||||||
|
extends PhabricatorSearchEngineAPIMethod {
|
||||||
|
|
||||||
|
public function getAPIMethodName() {
|
||||||
|
return 'project.column.search';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newSearchEngine() {
|
||||||
|
return new PhabricatorProjectColumnSearchEngine();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMethodSummary() {
|
||||||
|
return pht('Read information about workboard columns.');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorProjectColumnSearchEngine
|
||||||
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getResultTypeDescription() {
|
||||||
|
return pht('Workboard Columns');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorProjectApplication';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function newQuery() {
|
||||||
|
return new PhabricatorProjectColumnQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function buildCustomSearchFields() {
|
||||||
|
return array(
|
||||||
|
id(new PhabricatorPHIDsSearchField())
|
||||||
|
->setLabel(pht('Projects'))
|
||||||
|
->setKey('projectPHIDs')
|
||||||
|
->setAliases(array('project', 'projects', 'projectPHID')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function buildQueryFromParameters(array $map) {
|
||||||
|
$query = $this->newQuery();
|
||||||
|
|
||||||
|
if ($map['projectPHIDs']) {
|
||||||
|
$query->withProjectPHIDs($map['projectPHIDs']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getURI($path) {
|
||||||
|
// NOTE: There's no way to query columns in the web UI, at least for
|
||||||
|
// the moment.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getBuiltinQueryNames() {
|
||||||
|
$names = array();
|
||||||
|
|
||||||
|
$names['all'] = pht('All');
|
||||||
|
|
||||||
|
return $names;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 $projects,
|
||||||
|
PhabricatorSavedQuery $query,
|
||||||
|
array $handles) {
|
||||||
|
assert_instances_of($projects, 'PhabricatorProjectColumn');
|
||||||
|
$viewer = $this->requireViewer();
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -6,7 +6,8 @@ final class PhabricatorProjectColumn
|
||||||
PhabricatorApplicationTransactionInterface,
|
PhabricatorApplicationTransactionInterface,
|
||||||
PhabricatorPolicyInterface,
|
PhabricatorPolicyInterface,
|
||||||
PhabricatorDestructibleInterface,
|
PhabricatorDestructibleInterface,
|
||||||
PhabricatorExtendedPolicyInterface {
|
PhabricatorExtendedPolicyInterface,
|
||||||
|
PhabricatorConduitResultInterface {
|
||||||
|
|
||||||
const STATUS_ACTIVE = 0;
|
const STATUS_ACTIVE = 0;
|
||||||
const STATUS_HIDDEN = 1;
|
const STATUS_HIDDEN = 1;
|
||||||
|
@ -183,6 +184,40 @@ final class PhabricatorProjectColumn
|
||||||
return sprintf('%s%012d', $group, $sequence);
|
return sprintf('%s%012d', $group, $sequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -( PhabricatorConduitResultInterface )---------------------------------- */
|
||||||
|
|
||||||
|
public function getFieldSpecificationsForConduit() {
|
||||||
|
return array(
|
||||||
|
id(new PhabricatorConduitSearchFieldSpecification())
|
||||||
|
->setKey('name')
|
||||||
|
->setType('string')
|
||||||
|
->setDescription(pht('The display name of the column.')),
|
||||||
|
id(new PhabricatorConduitSearchFieldSpecification())
|
||||||
|
->setKey('project')
|
||||||
|
->setType('map<string, wild>')
|
||||||
|
->setDescription(pht('The project the column belongs to.')),
|
||||||
|
id(new PhabricatorConduitSearchFieldSpecification())
|
||||||
|
->setKey('proxyPHID')
|
||||||
|
->setType('phid?')
|
||||||
|
->setDescription(
|
||||||
|
pht(
|
||||||
|
'For columns that proxy another object (like a subproject or '.
|
||||||
|
'milestone), the PHID of the object they proxy.')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getFieldValuesForConduit() {
|
||||||
|
return array(
|
||||||
|
'name' => $this->getDisplayName(),
|
||||||
|
'proxyPHID' => $this->getProxyPHID(),
|
||||||
|
'project' => $this->getProject()->getRefForConduit(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getConduitSearchAttachments() {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
public function getRefForConduit() {
|
public function getRefForConduit() {
|
||||||
return array(
|
return array(
|
||||||
'id' => (int)$this->getID(),
|
'id' => (int)$this->getID(),
|
||||||
|
|
Loading…
Reference in a new issue