Page MenuHomePhabricator

D16349.id.diff
No OneTemporary

D16349.id.diff

diff --git a/src/applications/harbormaster/constants/HarbormasterBuildStatus.php b/src/applications/harbormaster/constants/HarbormasterBuildStatus.php
--- a/src/applications/harbormaster/constants/HarbormasterBuildStatus.php
+++ b/src/applications/harbormaster/constants/HarbormasterBuildStatus.php
@@ -118,4 +118,28 @@
}
}
+ public static function getWaitingStatusConstants() {
+ return array(
+ self::STATUS_INACTIVE,
+ self::STATUS_PENDING,
+ );
+ }
+
+ public static function getActiveStatusConstants() {
+ return array(
+ self::STATUS_BUILDING,
+ self::STATUS_PAUSED,
+ );
+ }
+
+ public static function getCompletedStatusConstants() {
+ return array(
+ self::STATUS_PASSED,
+ self::STATUS_FAILED,
+ self::STATUS_ABORTED,
+ self::STATUS_ERROR,
+ self::STATUS_DEADLOCKED,
+ );
+ }
+
}
diff --git a/src/applications/harbormaster/query/HarbormasterBuildSearchEngine.php b/src/applications/harbormaster/query/HarbormasterBuildSearchEngine.php
--- a/src/applications/harbormaster/query/HarbormasterBuildSearchEngine.php
+++ b/src/applications/harbormaster/query/HarbormasterBuildSearchEngine.php
@@ -55,6 +55,9 @@
protected function getBuiltinQueryNames() {
return array(
'all' => pht('All Builds'),
+ 'waiting' => pht('Waiting'),
+ 'active' => pht('Active'),
+ 'completed' => pht('Completed'),
);
}
@@ -65,6 +68,21 @@
switch ($query_key) {
case 'all':
return $query;
+ case 'waiting':
+ return $query
+ ->setParameter(
+ 'statuses',
+ HarbormasterBuildStatus::getWaitingStatusConstants());
+ case 'active':
+ return $query
+ ->setParameter(
+ 'statuses',
+ HarbormasterBuildStatus::getActiveStatusConstants());
+ case 'completed':
+ return $query
+ ->setParameter(
+ 'statuses',
+ HarbormasterBuildStatus::getCompletedStatusConstants());
}
return parent::buildSavedQueryFromBuiltin($query_key);
diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuild.php b/src/applications/harbormaster/storage/build/HarbormasterBuild.php
--- a/src/applications/harbormaster/storage/build/HarbormasterBuild.php
+++ b/src/applications/harbormaster/storage/build/HarbormasterBuild.php
@@ -169,16 +169,9 @@
}
public function isComplete() {
- switch ($this->getBuildStatus()) {
- case HarbormasterBuildStatus::STATUS_PASSED:
- case HarbormasterBuildStatus::STATUS_FAILED:
- case HarbormasterBuildStatus::STATUS_ABORTED:
- case HarbormasterBuildStatus::STATUS_ERROR:
- case HarbormasterBuildStatus::STATUS_PAUSED:
- return true;
- }
-
- return false;
+ return in_array(
+ $this->getBuildStatus(),
+ HarbormasterBuildStatus::getCompletedStatusConstants());
}
public function isPaused() {

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 10, 12:05 PM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6717505
Default Alt Text
D16349.id.diff (2 KB)

Event Timeline