Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14074879
D21559.id51321.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D21559.id51321.diff
View Options
diff --git a/src/applications/harbormaster/query/HarbormasterBuildTargetQuery.php b/src/applications/harbormaster/query/HarbormasterBuildTargetQuery.php
--- a/src/applications/harbormaster/query/HarbormasterBuildTargetQuery.php
+++ b/src/applications/harbormaster/query/HarbormasterBuildTargetQuery.php
@@ -7,6 +7,14 @@
private $phids;
private $buildPHIDs;
private $buildGenerations;
+ private $dateCreatedMin;
+ private $dateCreatedMax;
+ private $dateStartedMin;
+ private $dateStartedMax;
+ private $dateCompletedMin;
+ private $dateCompletedMax;
+ private $statuses;
+
private $needBuildSteps;
public function withIDs(array $ids) {
@@ -29,6 +37,29 @@
return $this;
}
+ public function withDateCreatedBetween($min, $max) {
+ $this->dateCreatedMin = $min;
+ $this->dateCreatedMax = $max;
+ return $this;
+ }
+
+ public function withDateStartedBetween($min, $max) {
+ $this->dateStartedMin = $min;
+ $this->dateStartedMax = $max;
+ return $this;
+ }
+
+ public function withDateCompletedBetween($min, $max) {
+ $this->dateCompletedMin = $min;
+ $this->dateCompletedMax = $max;
+ return $this;
+ }
+
+ public function withTargetStatuses(array $statuses) {
+ $this->statuses = $statuses;
+ return $this;
+ }
+
public function needBuildSteps($need_build_steps) {
$this->needBuildSteps = $need_build_steps;
return $this;
@@ -73,6 +104,55 @@
$this->buildGenerations);
}
+ if ($this->dateCreatedMin !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'dateCreated >= %d',
+ $this->dateCreatedMin);
+ }
+
+ if ($this->dateCreatedMax !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'dateCreated <= %d',
+ $this->dateCreatedMax);
+ }
+
+ if ($this->dateStartedMin !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'dateStarted >= %d',
+ $this->dateStartedMin);
+ }
+
+ if ($this->dateStartedMax !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'dateStarted <= %d',
+ $this->dateStartedMax);
+ }
+
+ if ($this->dateCompletedMin !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'dateCompleted >= %d',
+ $this->dateCompletedMin);
+ }
+
+ if ($this->dateCompletedMax !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'dateCompleted <= %d',
+ $this->dateCompletedMax);
+ }
+
+ if ($this->statuses !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'targetStatus IN (%Ls)',
+ $this->statuses);
+ }
+
return $where;
}
diff --git a/src/applications/harbormaster/query/HarbormasterBuildTargetSearchEngine.php b/src/applications/harbormaster/query/HarbormasterBuildTargetSearchEngine.php
--- a/src/applications/harbormaster/query/HarbormasterBuildTargetSearchEngine.php
+++ b/src/applications/harbormaster/query/HarbormasterBuildTargetSearchEngine.php
@@ -24,6 +24,42 @@
->setDescription(
pht('Search for targets of a given build.'))
->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.')),
);
}
@@ -34,6 +70,28 @@
$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;
}
diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php b/src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php
--- a/src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php
+++ b/src/applications/harbormaster/storage/build/HarbormasterBuildTarget.php
@@ -119,6 +119,15 @@
'key_build' => array(
'columns' => array('buildPHID', 'buildStepPHID'),
),
+ 'key_started' => array(
+ 'columns' => array('dateStarted'),
+ ),
+ 'key_completed' => array(
+ 'columns' => array('dateCompleted'),
+ ),
+ 'key_created' => array(
+ 'columns' => array('dateCreated'),
+ ),
),
) + parent::getConfiguration();
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 22, 9:06 AM (4 h, 33 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6774189
Default Alt Text
D21559.id51321.diff (6 KB)
Attached To
Mode
D21559: Add more constraints to "harbormaster.target.search"
Attached
Detach File
Event Timeline
Log In to Comment