mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 14:00:56 +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();
|
$owner = new PhabricatorOwnersOwner();
|
||||||
$path = new PhabricatorOwnersPath();
|
$path = new PhabricatorOwnersPath();
|
||||||
|
|
||||||
|
$repository_phid = '';
|
||||||
|
if ($request->getStr('repository') != '') {
|
||||||
|
$repository_phid = id(new PhabricatorRepository())
|
||||||
|
->loadOneWhere('callsign = %s', $request->getStr('repository'))
|
||||||
|
->getPHID();
|
||||||
|
}
|
||||||
|
|
||||||
switch ($this->view) {
|
switch ($this->view) {
|
||||||
case 'search':
|
case 'search':
|
||||||
$packages = array();
|
$packages = array();
|
||||||
|
@ -50,11 +57,21 @@ class PhabricatorOwnersListController extends PhabricatorOwnersController {
|
||||||
$request->getStr('name'));
|
$request->getStr('name'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->getStr('path')) {
|
if ($repository_phid || $request->getStr('path')) {
|
||||||
|
|
||||||
$join[] = qsprintf(
|
$join[] = qsprintf(
|
||||||
$conn_r,
|
$conn_r,
|
||||||
'JOIN %T path ON path.packageID = p.id',
|
'JOIN %T path ON path.packageID = p.id',
|
||||||
$path->getTableName());
|
$path->getTableName());
|
||||||
|
|
||||||
|
if ($repository_phid) {
|
||||||
|
$where[] = qsprintf(
|
||||||
|
$conn_r,
|
||||||
|
'path.repositoryPHID = %s',
|
||||||
|
$repository_phid);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($request->getStr('path')) {
|
||||||
$where[] = qsprintf(
|
$where[] = qsprintf(
|
||||||
$conn_r,
|
$conn_r,
|
||||||
'path.path LIKE %~ OR %s LIKE CONCAT(path.path, %s)',
|
'path.path LIKE %~ OR %s LIKE CONCAT(path.path, %s)',
|
||||||
|
@ -63,6 +80,8 @@ class PhabricatorOwnersListController extends PhabricatorOwnersController {
|
||||||
'%');
|
'%');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if ($request->getArr('owner')) {
|
if ($request->getArr('owner')) {
|
||||||
$join[] = qsprintf(
|
$join[] = qsprintf(
|
||||||
$conn_r,
|
$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())
|
$form = id(new AphrontFormView())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
->setAction('/owners/view/search/')
|
->setAction('/owners/view/search/')
|
||||||
|
@ -148,6 +175,12 @@ class PhabricatorOwnersListController extends PhabricatorOwnersController {
|
||||||
->setName('owner')
|
->setName('owner')
|
||||||
->setLabel('Owner')
|
->setLabel('Owner')
|
||||||
->setValue($owners_search_value))
|
->setValue($owners_search_value))
|
||||||
|
->appendChild(
|
||||||
|
id(new AphrontFormSelectControl())
|
||||||
|
->setName('repository')
|
||||||
|
->setLabel('Repository')
|
||||||
|
->setOptions($callsigns)
|
||||||
|
->setValue($request->getStr('repository')))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormTextControl())
|
id(new AphrontFormTextControl())
|
||||||
->setName('path')
|
->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/package');
|
||||||
phutil_require_module('phabricator', 'applications/owners/storage/path');
|
phutil_require_module('phabricator', 'applications/owners/storage/path');
|
||||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
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/qsprintf');
|
||||||
phutil_require_module('phabricator', 'storage/queryfx');
|
phutil_require_module('phabricator', 'storage/queryfx');
|
||||||
phutil_require_module('phabricator', 'view/control/table');
|
phutil_require_module('phabricator', 'view/control/table');
|
||||||
phutil_require_module('phabricator', 'view/form/base');
|
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/submit');
|
||||||
phutil_require_module('phabricator', 'view/form/control/text');
|
phutil_require_module('phabricator', 'view/form/control/text');
|
||||||
phutil_require_module('phabricator', 'view/form/control/tokenizer');
|
phutil_require_module('phabricator', 'view/form/control/tokenizer');
|
||||||
|
|
Loading…
Reference in a new issue