Differential D21559 Diff 51322 src/applications/harbormaster/query/HarbormasterBuildTargetSearchEngine.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/query/HarbormasterBuildTargetSearchEngine.php
Show All 18 Lines | protected function buildCustomSearchFields() { | ||||
return array( | return array( | ||||
id(new PhabricatorSearchDatasourceField()) | id(new PhabricatorSearchDatasourceField()) | ||||
->setLabel(pht('Builds')) | ->setLabel(pht('Builds')) | ||||
->setKey('buildPHIDs') | ->setKey('buildPHIDs') | ||||
->setAliases(array('build', 'builds', 'buildPHID')) | ->setAliases(array('build', 'builds', 'buildPHID')) | ||||
->setDescription( | ->setDescription( | ||||
pht('Search for targets of a given build.')) | pht('Search for targets of a given build.')) | ||||
->setDatasource(new HarbormasterBuildPlanDatasource()), | ->setDatasource(new HarbormasterBuildPlanDatasource()), | ||||
id(new PhabricatorSearchDateField()) | |||||
->setLabel(pht('Created After')) | |||||
->setKey('createdStart') | |||||
->setDescription( | |||||
pht('Search for targets created on or after a particular date.')), | |||||
id(new PhabricatorSearchDateField()) | |||||
->setLabel(pht('Created Before')) | |||||
->setKey('createdEnd') | |||||
->setDescription( | |||||
pht('Search for targets created on or before a particular date.')), | |||||
id(new PhabricatorSearchDateField()) | |||||
->setLabel(pht('Started After')) | |||||
->setKey('startedStart') | |||||
->setDescription( | |||||
pht('Search for targets started on or after a particular date.')), | |||||
id(new PhabricatorSearchDateField()) | |||||
->setLabel(pht('Started Before')) | |||||
->setKey('startedEnd') | |||||
->setDescription( | |||||
pht('Search for targets started on or before a particular date.')), | |||||
id(new PhabricatorSearchDateField()) | |||||
->setLabel(pht('Completed After')) | |||||
->setKey('completedStart') | |||||
->setDescription( | |||||
pht('Search for targets completed on or after a particular date.')), | |||||
id(new PhabricatorSearchDateField()) | |||||
->setLabel(pht('Completed Before')) | |||||
->setKey('completedEnd') | |||||
->setDescription( | |||||
pht('Search for targets completed on or before a particular date.')), | |||||
id(new PhabricatorSearchStringListField()) | |||||
->setLabel(pht('Statuses')) | |||||
->setKey('statuses') | |||||
->setAliases(array('status')) | |||||
->setDescription( | |||||
pht('Search for targets with given statuses.')), | |||||
); | ); | ||||
} | } | ||||
protected function buildQueryFromParameters(array $map) { | protected function buildQueryFromParameters(array $map) { | ||||
$query = $this->newQuery(); | $query = $this->newQuery(); | ||||
if ($map['buildPHIDs']) { | if ($map['buildPHIDs']) { | ||||
$query->withBuildPHIDs($map['buildPHIDs']); | $query->withBuildPHIDs($map['buildPHIDs']); | ||||
} | } | ||||
if ($map['createdStart'] !== null || $map['createdEnd'] !== null) { | |||||
$query->withDateCreatedBetween( | |||||
$map['createdStart'], | |||||
$map['createdEnd']); | |||||
} | |||||
if ($map['startedStart'] !== null || $map['startedEnd'] !== null) { | |||||
$query->withDateStartedBetween( | |||||
$map['startedStart'], | |||||
$map['startedEnd']); | |||||
} | |||||
if ($map['completedStart'] !== null || $map['completedEnd'] !== null) { | |||||
$query->withDateCompletedBetween( | |||||
$map['completedStart'], | |||||
$map['completedEnd']); | |||||
} | |||||
if ($map['statuses']) { | |||||
$query->withTargetStatuses($map['statuses']); | |||||
} | |||||
return $query; | return $query; | ||||
} | } | ||||
protected function getURI($path) { | protected function getURI($path) { | ||||
return '/harbormaster/target/'.$path; | return '/harbormaster/target/'.$path; | ||||
} | } | ||||
protected function getBuiltinQueryNames() { | protected function getBuiltinQueryNames() { | ||||
Show All 29 Lines |