mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 21:32:43 +01:00
Modernize "owners" datasource
Summary: Ref T4420. Update owners. Test Plan: - Used typeahead from Herald. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T4420 Differential Revision: https://secure.phabricator.com/D9880
This commit is contained in:
parent
e9dbe747ff
commit
6eb879210a
4 changed files with 38 additions and 4 deletions
|
@ -1866,6 +1866,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorOwnersOwner' => 'applications/owners/storage/PhabricatorOwnersOwner.php',
|
'PhabricatorOwnersOwner' => 'applications/owners/storage/PhabricatorOwnersOwner.php',
|
||||||
'PhabricatorOwnersPHIDTypePackage' => 'applications/owners/phid/PhabricatorOwnersPHIDTypePackage.php',
|
'PhabricatorOwnersPHIDTypePackage' => 'applications/owners/phid/PhabricatorOwnersPHIDTypePackage.php',
|
||||||
'PhabricatorOwnersPackage' => 'applications/owners/storage/PhabricatorOwnersPackage.php',
|
'PhabricatorOwnersPackage' => 'applications/owners/storage/PhabricatorOwnersPackage.php',
|
||||||
|
'PhabricatorOwnersPackageDatasource' => 'applications/owners/typeahead/PhabricatorOwnersPackageDatasource.php',
|
||||||
'PhabricatorOwnersPackagePathValidator' => 'applications/repository/worker/commitchangeparser/PhabricatorOwnersPackagePathValidator.php',
|
'PhabricatorOwnersPackagePathValidator' => 'applications/repository/worker/commitchangeparser/PhabricatorOwnersPackagePathValidator.php',
|
||||||
'PhabricatorOwnersPackageQuery' => 'applications/owners/query/PhabricatorOwnersPackageQuery.php',
|
'PhabricatorOwnersPackageQuery' => 'applications/owners/query/PhabricatorOwnersPackageQuery.php',
|
||||||
'PhabricatorOwnersPackageTestCase' => 'applications/owners/storage/__tests__/PhabricatorOwnersPackageTestCase.php',
|
'PhabricatorOwnersPackageTestCase' => 'applications/owners/storage/__tests__/PhabricatorOwnersPackageTestCase.php',
|
||||||
|
@ -4718,6 +4719,7 @@ phutil_register_library_map(array(
|
||||||
0 => 'PhabricatorOwnersDAO',
|
0 => 'PhabricatorOwnersDAO',
|
||||||
1 => 'PhabricatorPolicyInterface',
|
1 => 'PhabricatorPolicyInterface',
|
||||||
),
|
),
|
||||||
|
'PhabricatorOwnersPackageDatasource' => 'PhabricatorTypeaheadDatasource',
|
||||||
'PhabricatorOwnersPackageQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorOwnersPackageQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'PhabricatorOwnersPackageTestCase' => 'PhabricatorTestCase',
|
'PhabricatorOwnersPackageTestCase' => 'PhabricatorTestCase',
|
||||||
'PhabricatorOwnersPath' => 'PhabricatorOwnersDAO',
|
'PhabricatorOwnersPath' => 'PhabricatorOwnersDAO',
|
||||||
|
|
|
@ -594,13 +594,13 @@ final class HeraldRuleController extends HeraldController {
|
||||||
'taskpriority' => new ManiphestTaskPriorityDatasource(),
|
'taskpriority' => new ManiphestTaskPriorityDatasource(),
|
||||||
'buildplan' => new HarbormasterBuildPlanDatasource(),
|
'buildplan' => new HarbormasterBuildPlanDatasource(),
|
||||||
'arcanistprojects' => new DiffusionArcanistProjectDatasource(),
|
'arcanistprojects' => new DiffusionArcanistProjectDatasource(),
|
||||||
|
'package' => new PhabricatorOwnersPackageDatasource(),
|
||||||
);
|
);
|
||||||
|
|
||||||
$sources = mpull($sources, 'getDatasourceURI');
|
$sources = mpull($sources, 'getDatasourceURI');
|
||||||
$sources += array(
|
$sources += array(
|
||||||
'email' => '/typeahead/common/mailable/',
|
'email' => '/typeahead/common/mailable/',
|
||||||
'user' => '/typeahead/common/accounts/',
|
'user' => '/typeahead/common/accounts/',
|
||||||
'package' => '/typeahead/common/packages/',
|
|
||||||
'project' => '/typeahead/common/projects/',
|
'project' => '/typeahead/common/projects/',
|
||||||
'userorproject' => '/typeahead/common/accountsorprojects/',
|
'userorproject' => '/typeahead/common/accountsorprojects/',
|
||||||
);
|
);
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorOwnersPackageDatasource
|
||||||
|
extends PhabricatorTypeaheadDatasource {
|
||||||
|
|
||||||
|
public function getPlaceholderText() {
|
||||||
|
return pht('Type a package name...');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getDatasourceApplicationClass() {
|
||||||
|
return 'PhabricatorApplicationOwners';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadResults() {
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
$raw_query = $this->getRawQuery();
|
||||||
|
|
||||||
|
$results = array();
|
||||||
|
|
||||||
|
$packages = id(new PhabricatorOwnersPackageQuery())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
foreach ($packages as $package) {
|
||||||
|
$results[] = id(new PhabricatorTypeaheadResult())
|
||||||
|
->setIcon('fa-list-alt bluegrey')
|
||||||
|
->setName($package->getName())
|
||||||
|
->setURI('/owners/package/'.$package->getID().'/')
|
||||||
|
->setPHID($package->getPHID());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -72,9 +72,6 @@ final class PhabricatorTypeaheadCommonDatasourceController
|
||||||
$need_projs = true;
|
$need_projs = true;
|
||||||
$need_packages = true;
|
$need_packages = true;
|
||||||
break;
|
break;
|
||||||
case 'packages':
|
|
||||||
$need_packages = true;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
Loading…
Reference in a new issue