mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Search owners by repository
Summary: I've chosen passing callsign even if it is more complicated because it is nicer than PHID and can be written by hand. Test Plan: Search without repository. Search with repository. Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1571
This commit is contained in:
parent
6cb5db60d5
commit
0f2d2201ce
2 changed files with 42 additions and 7 deletions
|
@ -34,6 +34,13 @@ class PhabricatorOwnersListController extends PhabricatorOwnersController {
|
|||
$owner = new PhabricatorOwnersOwner();
|
||||
$path = new PhabricatorOwnersPath();
|
||||
|
||||
$repository_phid = '';
|
||||
if ($request->getStr('repository') != '') {
|
||||
$repository_phid = id(new PhabricatorRepository())
|
||||
->loadOneWhere('callsign = %s', $request->getStr('repository'))
|
||||
->getPHID();
|
||||
}
|
||||
|
||||
switch ($this->view) {
|
||||
case 'search':
|
||||
$packages = array();
|
||||
|
@ -50,11 +57,21 @@ class PhabricatorOwnersListController extends PhabricatorOwnersController {
|
|||
$request->getStr('name'));
|
||||
}
|
||||
|
||||
if ($request->getStr('path')) {
|
||||
if ($repository_phid || $request->getStr('path')) {
|
||||
|
||||
$join[] = qsprintf(
|
||||
$conn_r,
|
||||
'JOIN %T path ON path.packageID = p.id',
|
||||
$path->getTableName());
|
||||
|
||||
if ($repository_phid) {
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
'path.repositoryPHID = %s',
|
||||
$repository_phid);
|
||||
}
|
||||
|
||||
if ($request->getStr('path')) {
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
'path.path LIKE %~ OR %s LIKE CONCAT(path.path, %s)',
|
||||
|
@ -63,6 +80,8 @@ class PhabricatorOwnersListController extends PhabricatorOwnersController {
|
|||
'%');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($request->getArr('owner')) {
|
||||
$join[] = qsprintf(
|
||||
$conn_r,
|
||||
|
@ -132,6 +151,14 @@ class PhabricatorOwnersListController extends PhabricatorOwnersController {
|
|||
);
|
||||
}
|
||||
|
||||
$callsigns = array('' => '(Any Repository)');
|
||||
$repositories = id(new PhabricatorRepository())
|
||||
->loadAllWhere('1 = 1 ORDER BY callsign');
|
||||
foreach ($repositories as $repository) {
|
||||
$callsigns[$repository->getCallsign()] =
|
||||
$repository->getCallsign().': '.$repository->getName();
|
||||
}
|
||||
|
||||
$form = id(new AphrontFormView())
|
||||
->setUser($user)
|
||||
->setAction('/owners/view/search/')
|
||||
|
@ -148,6 +175,12 @@ class PhabricatorOwnersListController extends PhabricatorOwnersController {
|
|||
->setName('owner')
|
||||
->setLabel('Owner')
|
||||
->setValue($owners_search_value))
|
||||
->appendChild(
|
||||
id(new AphrontFormSelectControl())
|
||||
->setName('repository')
|
||||
->setLabel('Repository')
|
||||
->setOptions($callsigns)
|
||||
->setValue($request->getStr('repository')))
|
||||
->appendChild(
|
||||
id(new AphrontFormTextControl())
|
||||
->setName('path')
|
||||
|
|
|
@ -11,10 +11,12 @@ phutil_require_module('phabricator', 'applications/owners/storage/owner');
|
|||
phutil_require_module('phabricator', 'applications/owners/storage/package');
|
||||
phutil_require_module('phabricator', 'applications/owners/storage/path');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'applications/repository/storage/repository');
|
||||
phutil_require_module('phabricator', 'storage/qsprintf');
|
||||
phutil_require_module('phabricator', 'storage/queryfx');
|
||||
phutil_require_module('phabricator', 'view/control/table');
|
||||
phutil_require_module('phabricator', 'view/form/base');
|
||||
phutil_require_module('phabricator', 'view/form/control/select');
|
||||
phutil_require_module('phabricator', 'view/form/control/submit');
|
||||
phutil_require_module('phabricator', 'view/form/control/text');
|
||||
phutil_require_module('phabricator', 'view/form/control/tokenizer');
|
||||
|
|
Loading…
Reference in a new issue