Changeset View
Changeset View
Standalone View
Standalone View
src/applications/drydock/query/DrydockLeaseSearchEngine.php
Show All 34 Lines | final class DrydockLeaseSearchEngine | ||||
protected function buildQueryFromParameters(array $map) { | protected function buildQueryFromParameters(array $map) { | ||||
$query = $this->newQuery(); | $query = $this->newQuery(); | ||||
if ($map['statuses']) { | if ($map['statuses']) { | ||||
$query->withStatuses($map['statuses']); | $query->withStatuses($map['statuses']); | ||||
} | } | ||||
if ($map['ownerPHIDs']) { | |||||
$query->withOwnerPHIDs($map['ownerPHIDs']); | |||||
} | |||||
return $query; | return $query; | ||||
} | } | ||||
protected function buildCustomSearchFields() { | protected function buildCustomSearchFields() { | ||||
return array( | return array( | ||||
id(new PhabricatorSearchCheckboxesField()) | id(new PhabricatorSearchCheckboxesField()) | ||||
->setLabel(pht('Statuses')) | ->setLabel(pht('Statuses')) | ||||
->setKey('statuses') | ->setKey('statuses') | ||||
->setOptions(DrydockLeaseStatus::getStatusMap()), | ->setOptions(DrydockLeaseStatus::getStatusMap()), | ||||
id(new PhabricatorPHIDsSearchField()) | |||||
epriestley: This isn't a `Datasource` because owners are a weird mishmash of different object types, I… | |||||
Not Done Inline ActionsYeah, initially I had this as a user facing typeahead that accepted people as it's datasource, was thinking of combining build steps and people into one datasource, but then you would have to be able to search build steps by name, etc etc. yelirekim: Yeah, initially I had this as a user facing typeahead that accepted people as it's datasource… | |||||
->setLabel(pht('Owners')) | |||||
->setKey('ownerPHIDs') | |||||
->setAliases(array('owner', 'owners', 'ownerPHID')) | |||||
->setDescription(pht('Search leases by owner.')), | |||||
); | ); | ||||
} | } | ||||
protected function getURI($path) { | protected function getURI($path) { | ||||
$resource = $this->getResource(); | $resource = $this->getResource(); | ||||
if ($resource) { | if ($resource) { | ||||
$id = $resource->getID(); | $id = $resource->getID(); | ||||
return "/drydock/resource/{$id}/leases/".$path; | return "/drydock/resource/{$id}/leases/".$path; | ||||
▲ Show 20 Lines • Show All 46 Lines • Show Last 20 Lines |
This isn't a Datasource because owners are a weird mishmash of different object types, I assume? Seems OK to me to let users search by owner, but I think pretty much anything can own a lease right now?