1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 04:20:55 +01:00

Pick some preset build statuses

Summary:
We're picking three useful groups of build statuses to provide as default queries:

 - Stuff not yet building
 - Stuff building
 - Stuff which has finished building

These are reasonable buckets for builds since (unlike most objects in phabricatorland) users are generally waiting impatiently for the machine to do something for them, rather than being responsible for doing something with the machine.

Test Plan: clicked around the search engine and enjoyed my defaults

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D16349
This commit is contained in:
Mike Riley 2016-07-31 15:35:18 +00:00 committed by yelirekim
parent 42b81a8090
commit 33fca12816
3 changed files with 45 additions and 10 deletions

View file

@ -118,4 +118,28 @@ final class HarbormasterBuildStatus extends Phobject {
} }
} }
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,
);
}
} }

View file

@ -55,6 +55,9 @@ final class HarbormasterBuildSearchEngine
protected function getBuiltinQueryNames() { protected function getBuiltinQueryNames() {
return array( return array(
'all' => pht('All Builds'), 'all' => pht('All Builds'),
'waiting' => pht('Waiting'),
'active' => pht('Active'),
'completed' => pht('Completed'),
); );
} }
@ -65,6 +68,21 @@ final class HarbormasterBuildSearchEngine
switch ($query_key) { switch ($query_key) {
case 'all': case 'all':
return $query; 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); return parent::buildSavedQueryFromBuiltin($query_key);

View file

@ -169,16 +169,9 @@ final class HarbormasterBuild extends HarbormasterDAO
} }
public function isComplete() { public function isComplete() {
switch ($this->getBuildStatus()) { return in_array(
case HarbormasterBuildStatus::STATUS_PASSED: $this->getBuildStatus(),
case HarbormasterBuildStatus::STATUS_FAILED: HarbormasterBuildStatus::getCompletedStatusConstants());
case HarbormasterBuildStatus::STATUS_ABORTED:
case HarbormasterBuildStatus::STATUS_ERROR:
case HarbormasterBuildStatus::STATUS_PAUSED:
return true;
}
return false;
} }
public function isPaused() { public function isPaused() {