From 42b81a80900d98d460f4b96d3fd7873e2682ff97 Mon Sep 17 00:00:00 2001 From: Mike Riley Date: Sun, 31 Jul 2016 14:56:31 +0000 Subject: [PATCH] Move build statuses to a constants class Summary: No functional changes here, just lifting this out to make room for activities, heeding lint warnings along the way. Test Plan: before: ```lang=bash $ grep -Rn "HarbormasterBuild::" * src/applications/harbormaster/storage/HarbormasterBuildable.php:169: $build = HarbormasterBuild::initializeNewBuild($viewer) src/applications/harbormaster/storage/HarbormasterBuildable.php:173: ->setBuildStatus(HarbormasterBuild::STATUS_PENDING); src/applications/harbormaster/controller/HarbormasterStepEditController.php:242: $variables = HarbormasterBuild::getAvailableBuildVariables(); src/applications/harbormaster/controller/HarbormasterBuildableViewController.php:200: 'fa-dot-circle-o '.HarbormasterBuild::getBuildStatusColor($status), src/applications/harbormaster/controller/HarbormasterBuildableViewController.php:201: HarbormasterBuild::getBuildStatusName($status)); src/applications/harbormaster/controller/HarbormasterBuildableViewController.php:203: $item->addAttribute(HarbormasterBuild::getBuildStatusName($status)); src/applications/harbormaster/controller/HarbormasterBuildViewController.php:584: HarbormasterBuild::getBuildStatusName($status); src/applications/harbormaster/controller/HarbormasterBuildViewController.php:585: $icon = HarbormasterBuild::getBuildStatusIcon($status); src/applications/harbormaster/controller/HarbormasterBuildViewController.php:586: $color = HarbormasterBuild::getBuildStatusColor($status); src/applications/harbormaster/event/HarbormasterUIEventListener.php:135: $status_name = HarbormasterBuild::getBuildStatusName($status); src/applications/harbormaster/event/HarbormasterUIEventListener.php:136: $icon = HarbormasterBuild::getBuildStatusIcon($status); src/applications/harbormaster/event/HarbormasterUIEventListener.php:137: $color = HarbormasterBuild::getBuildStatusColor($status); src/applications/harbormaster/conduit/HarbormasterQueryBuildsConduitAPIMethod.php:78: 'buildStatusName' => HarbormasterBuild::getBuildStatusName($status), src/applications/harbormaster/engine/HarbormasterBuildEngine.php:66: $build->setBuildStatus(HarbormasterBuild::STATUS_ERROR); src/applications/harbormaster/engine/HarbormasterBuildEngine.php:109: $build->setBuildStatus(HarbormasterBuild::STATUS_ABORTED); src/applications/harbormaster/engine/HarbormasterBuildEngine.php:113: if (($build->getBuildStatus() == HarbormasterBuild::STATUS_PENDING) || src/applications/harbormaster/engine/HarbormasterBuildEngine.php:116: $build->setBuildStatus(HarbormasterBuild::STATUS_BUILDING); src/applications/harbormaster/engine/HarbormasterBuildEngine.php:121: $build->setBuildStatus(HarbormasterBuild::STATUS_BUILDING); src/applications/harbormaster/engine/HarbormasterBuildEngine.php:126: $build->setBuildStatus(HarbormasterBuild::STATUS_PAUSED); src/applications/harbormaster/engine/HarbormasterBuildEngine.php:132: if ($build->getBuildStatus() == HarbormasterBuild::STATUS_BUILDING) { src/applications/harbormaster/engine/HarbormasterBuildEngine.php:246: $build->setBuildStatus(HarbormasterBuild::STATUS_FAILED); src/applications/harbormaster/engine/HarbormasterBuildEngine.php:254: $build->setBuildStatus(HarbormasterBuild::STATUS_PASSED); src/applications/harbormaster/engine/HarbormasterBuildEngine.php:290: $build->setBuildStatus(HarbormasterBuild::STATUS_DEADLOCKED); src/applications/harbormaster/engine/HarbormasterBuildEngine.php:446: if ($build->getBuildStatus() != HarbormasterBuild::STATUS_PASSED) { src/applications/harbormaster/engine/HarbormasterBuildEngine.php:449: if ($build->getBuildStatus() == HarbormasterBuild::STATUS_FAILED || src/applications/harbormaster/engine/HarbormasterBuildEngine.php:450: $build->getBuildStatus() == HarbormasterBuild::STATUS_ERROR || src/applications/harbormaster/engine/HarbormasterBuildEngine.php:451: $build->getBuildStatus() == HarbormasterBuild::STATUS_DEADLOCKED) { ``` after: ```lang=bash $ grep -Rn "HarbormasterBuild::" * src/applications/harbormaster/storage/HarbormasterBuildable.php:169: $build = HarbormasterBuild::initializeNewBuild($viewer) src/applications/harbormaster/controller/HarbormasterStepEditController.php:242: $variables = HarbormasterBuild::getAvailableBuildVariables(); ``` ran a manual build as a sanity check Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Differential Revision: https://secure.phabricator.com/D16348 --- src/__phutil_library_map__.php | 2 + ...arbormasterQueryBuildsConduitAPIMethod.php | 3 +- .../constants/HarbormasterBuildStatus.php | 121 ++++++++++++++++ .../HarbormasterBuildViewController.php | 6 +- .../HarbormasterBuildableViewController.php | 9 +- .../engine/HarbormasterBuildEngine.php | 32 ++--- .../event/HarbormasterUIEventListener.php | 6 +- .../query/HarbormasterBuildSearchEngine.php | 6 +- .../storage/HarbormasterBuildable.php | 2 +- .../storage/build/HarbormasterBuild.php | 135 ++---------------- .../HarbormasterBuildStatusDatasource.php | 6 +- 11 files changed, 168 insertions(+), 160 deletions(-) create mode 100644 src/applications/harbormaster/constants/HarbormasterBuildStatus.php diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index c59605602e..7fb33cc430 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1131,6 +1131,7 @@ phutil_register_library_map(array( 'HarbormasterBuildQuery' => 'applications/harbormaster/query/HarbormasterBuildQuery.php', 'HarbormasterBuildRequest' => 'applications/harbormaster/engine/HarbormasterBuildRequest.php', 'HarbormasterBuildSearchEngine' => 'applications/harbormaster/query/HarbormasterBuildSearchEngine.php', + 'HarbormasterBuildStatus' => 'applications/harbormaster/constants/HarbormasterBuildStatus.php', 'HarbormasterBuildStatusDatasource' => 'applications/harbormaster/typeahead/HarbormasterBuildStatusDatasource.php', 'HarbormasterBuildStep' => 'applications/harbormaster/storage/configuration/HarbormasterBuildStep.php', 'HarbormasterBuildStepCoreCustomField' => 'applications/harbormaster/customfield/HarbormasterBuildStepCoreCustomField.php', @@ -5687,6 +5688,7 @@ phutil_register_library_map(array( 'HarbormasterBuildQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'HarbormasterBuildRequest' => 'Phobject', 'HarbormasterBuildSearchEngine' => 'PhabricatorApplicationSearchEngine', + 'HarbormasterBuildStatus' => 'Phobject', 'HarbormasterBuildStatusDatasource' => 'PhabricatorTypeaheadDatasource', 'HarbormasterBuildStep' => array( 'HarbormasterDAO', diff --git a/src/applications/harbormaster/conduit/HarbormasterQueryBuildsConduitAPIMethod.php b/src/applications/harbormaster/conduit/HarbormasterQueryBuildsConduitAPIMethod.php index 95628500c1..b559a650fc 100644 --- a/src/applications/harbormaster/conduit/HarbormasterQueryBuildsConduitAPIMethod.php +++ b/src/applications/harbormaster/conduit/HarbormasterQueryBuildsConduitAPIMethod.php @@ -66,6 +66,7 @@ final class HarbormasterQueryBuildsConduitAPIMethod $id = $build->getID(); $uri = '/harbormaster/build/'.$id.'/'; $status = $build->getBuildStatus(); + $status_name = HarbormasterBuildStatus::getBuildStatusName($status); $data[] = array( 'id' => $id, @@ -75,7 +76,7 @@ final class HarbormasterQueryBuildsConduitAPIMethod 'buildablePHID' => $build->getBuildablePHID(), 'buildPlanPHID' => $build->getBuildPlanPHID(), 'buildStatus' => $status, - 'buildStatusName' => HarbormasterBuild::getBuildStatusName($status), + 'buildStatusName' => $status_name, ); } diff --git a/src/applications/harbormaster/constants/HarbormasterBuildStatus.php b/src/applications/harbormaster/constants/HarbormasterBuildStatus.php new file mode 100644 index 0000000000..341bf4b7ab --- /dev/null +++ b/src/applications/harbormaster/constants/HarbormasterBuildStatus.php @@ -0,0 +1,121 @@ + pht('Inactive'), + self::STATUS_PENDING => pht('Pending'), + self::STATUS_BUILDING => pht('Building'), + self::STATUS_PASSED => pht('Passed'), + self::STATUS_FAILED => pht('Failed'), + self::STATUS_ABORTED => pht('Aborted'), + self::STATUS_ERROR => pht('Unexpected Error'), + self::STATUS_PAUSED => pht('Paused'), + self::STATUS_DEADLOCKED => pht('Deadlocked'), + ); + } + + public static function getBuildStatusIcon($status) { + switch ($status) { + case self::STATUS_INACTIVE: + case self::STATUS_PENDING: + return PHUIStatusItemView::ICON_OPEN; + case self::STATUS_BUILDING: + return PHUIStatusItemView::ICON_RIGHT; + case self::STATUS_PASSED: + return PHUIStatusItemView::ICON_ACCEPT; + case self::STATUS_FAILED: + return PHUIStatusItemView::ICON_REJECT; + case self::STATUS_ABORTED: + return PHUIStatusItemView::ICON_MINUS; + case self::STATUS_ERROR: + return PHUIStatusItemView::ICON_MINUS; + case self::STATUS_PAUSED: + return PHUIStatusItemView::ICON_MINUS; + case self::STATUS_DEADLOCKED: + return PHUIStatusItemView::ICON_WARNING; + default: + return PHUIStatusItemView::ICON_QUESTION; + } + } + + public static function getBuildStatusColor($status) { + switch ($status) { + case self::STATUS_INACTIVE: + return 'dark'; + case self::STATUS_PENDING: + case self::STATUS_BUILDING: + return 'blue'; + case self::STATUS_PASSED: + return 'green'; + case self::STATUS_FAILED: + case self::STATUS_ABORTED: + case self::STATUS_ERROR: + case self::STATUS_DEADLOCKED: + return 'red'; + case self::STATUS_PAUSED: + return 'dark'; + default: + return 'bluegrey'; + } + } + +} diff --git a/src/applications/harbormaster/controller/HarbormasterBuildViewController.php b/src/applications/harbormaster/controller/HarbormasterBuildViewController.php index f78db68149..7932451d2e 100644 --- a/src/applications/harbormaster/controller/HarbormasterBuildViewController.php +++ b/src/applications/harbormaster/controller/HarbormasterBuildViewController.php @@ -581,9 +581,9 @@ final class HarbormasterBuildViewController } else { $status = $build->getBuildStatus(); $status_name = - HarbormasterBuild::getBuildStatusName($status); - $icon = HarbormasterBuild::getBuildStatusIcon($status); - $color = HarbormasterBuild::getBuildStatusColor($status); + HarbormasterBuildStatus::getBuildStatusName($status); + $icon = HarbormasterBuildStatus::getBuildStatusIcon($status); + $color = HarbormasterBuildStatus::getBuildStatusColor($status); } $item->setTarget($status_name); diff --git a/src/applications/harbormaster/controller/HarbormasterBuildableViewController.php b/src/applications/harbormaster/controller/HarbormasterBuildableViewController.php index 390ff2ec3d..6a47dae429 100644 --- a/src/applications/harbormaster/controller/HarbormasterBuildableViewController.php +++ b/src/applications/harbormaster/controller/HarbormasterBuildableViewController.php @@ -196,11 +196,10 @@ final class HarbormasterBuildableViewController ->setHref($view_uri); $status = $build->getBuildStatus(); - $item->setStatusIcon( - 'fa-dot-circle-o '.HarbormasterBuild::getBuildStatusColor($status), - HarbormasterBuild::getBuildStatusName($status)); - - $item->addAttribute(HarbormasterBuild::getBuildStatusName($status)); + $status_color = HarbormasterBuildStatus::getBuildStatusColor($status); + $status_name = HarbormasterBuildStatus::getBuildStatusName($status); + $item->setStatusIcon('fa-dot-circle-o '.$status_color, $status_name); + $item->addAttribute($status_name); if ($build->isRestarting()) { $item->addIcon('fa-repeat', pht('Restarting')); diff --git a/src/applications/harbormaster/engine/HarbormasterBuildEngine.php b/src/applications/harbormaster/engine/HarbormasterBuildEngine.php index 273f899f91..4cece6a69d 100644 --- a/src/applications/harbormaster/engine/HarbormasterBuildEngine.php +++ b/src/applications/harbormaster/engine/HarbormasterBuildEngine.php @@ -63,7 +63,7 @@ final class HarbormasterBuildEngine extends Phobject { // If any exception is raised, the build is marked as a failure and the // exception is re-thrown (this ensures we don't leave builds in an // inconsistent state). - $build->setBuildStatus(HarbormasterBuild::STATUS_ERROR); + $build->setBuildStatus(HarbormasterBuildStatus::STATUS_ERROR); $build->save(); $lock->unlock(); @@ -106,30 +106,30 @@ final class HarbormasterBuildEngine extends Phobject { private function updateBuild(HarbormasterBuild $build) { if ($build->isAborting()) { $this->releaseAllArtifacts($build); - $build->setBuildStatus(HarbormasterBuild::STATUS_ABORTED); + $build->setBuildStatus(HarbormasterBuildStatus::STATUS_ABORTED); $build->save(); } - if (($build->getBuildStatus() == HarbormasterBuild::STATUS_PENDING) || + if (($build->getBuildStatus() == HarbormasterBuildStatus::STATUS_PENDING) || ($build->isRestarting())) { $this->restartBuild($build); - $build->setBuildStatus(HarbormasterBuild::STATUS_BUILDING); + $build->setBuildStatus(HarbormasterBuildStatus::STATUS_BUILDING); $build->save(); } if ($build->isResuming()) { - $build->setBuildStatus(HarbormasterBuild::STATUS_BUILDING); + $build->setBuildStatus(HarbormasterBuildStatus::STATUS_BUILDING); $build->save(); } if ($build->isPausing() && !$build->isComplete()) { - $build->setBuildStatus(HarbormasterBuild::STATUS_PAUSED); + $build->setBuildStatus(HarbormasterBuildStatus::STATUS_PAUSED); $build->save(); } $build->deleteUnprocessedCommands(); - if ($build->getBuildStatus() == HarbormasterBuild::STATUS_BUILDING) { + if ($build->getBuildStatus() == HarbormasterBuildStatus::STATUS_BUILDING) { $this->updateBuildSteps($build); } } @@ -243,7 +243,7 @@ final class HarbormasterBuildEngine extends Phobject { // If any step failed, fail the whole build, then bail. if (count($failed)) { - $build->setBuildStatus(HarbormasterBuild::STATUS_FAILED); + $build->setBuildStatus(HarbormasterBuildStatus::STATUS_FAILED); $build->save(); return; } @@ -251,7 +251,7 @@ final class HarbormasterBuildEngine extends Phobject { // If every step is complete, we're done with this build. Mark it passed // and bail. if (count($complete) == count($steps)) { - $build->setBuildStatus(HarbormasterBuild::STATUS_PASSED); + $build->setBuildStatus(HarbormasterBuildStatus::STATUS_PASSED); $build->save(); return; } @@ -287,7 +287,7 @@ final class HarbormasterBuildEngine extends Phobject { if (!$runnable && !$waiting && !$underway) { // This means the build is deadlocked, and the user has configured // circular dependencies. - $build->setBuildStatus(HarbormasterBuild::STATUS_DEADLOCKED); + $build->setBuildStatus(HarbormasterBuildStatus::STATUS_DEADLOCKED); $build->save(); return; } @@ -443,14 +443,14 @@ final class HarbormasterBuildEngine extends Phobject { $all_pass = true; $any_fail = false; foreach ($buildable->getBuilds() as $build) { - if ($build->getBuildStatus() != HarbormasterBuild::STATUS_PASSED) { + if ($build->getBuildStatus() != HarbormasterBuildStatus::STATUS_PASSED) { $all_pass = false; } - if ($build->getBuildStatus() == HarbormasterBuild::STATUS_FAILED || - $build->getBuildStatus() == HarbormasterBuild::STATUS_ERROR || - $build->getBuildStatus() == HarbormasterBuild::STATUS_DEADLOCKED) { - $any_fail = true; - } + $any_fail = in_array($build->getBuildStatus(), array( + HarbormasterBuildStatus::STATUS_FAILED, + HarbormasterBuildStatus::STATUS_ERROR, + HarbormasterBuildStatus::STATUS_DEADLOCKED, + )); } if ($any_fail) { diff --git a/src/applications/harbormaster/event/HarbormasterUIEventListener.php b/src/applications/harbormaster/event/HarbormasterUIEventListener.php index 82ffcad560..219f556b3a 100644 --- a/src/applications/harbormaster/event/HarbormasterUIEventListener.php +++ b/src/applications/harbormaster/event/HarbormasterUIEventListener.php @@ -132,9 +132,9 @@ final class HarbormasterUIEventListener } $status = $build->getBuildStatus(); - $status_name = HarbormasterBuild::getBuildStatusName($status); - $icon = HarbormasterBuild::getBuildStatusIcon($status); - $color = HarbormasterBuild::getBuildStatusColor($status); + $status_name = HarbormasterBuildStatus::getBuildStatusName($status); + $icon = HarbormasterBuildStatus::getBuildStatusIcon($status); + $color = HarbormasterBuildStatus::getBuildStatusColor($status); $item->setIcon($icon, $color, $status_name); diff --git a/src/applications/harbormaster/query/HarbormasterBuildSearchEngine.php b/src/applications/harbormaster/query/HarbormasterBuildSearchEngine.php index 7a15305b20..2999bcc6f4 100644 --- a/src/applications/harbormaster/query/HarbormasterBuildSearchEngine.php +++ b/src/applications/harbormaster/query/HarbormasterBuildSearchEngine.php @@ -107,9 +107,9 @@ final class HarbormasterBuildSearchEngine $status = $build->getBuildStatus(); - $status_icon = HarbormasterBuild::getBuildStatusIcon($status); - $status_color = HarbormasterBuild::getBuildStatusColor($status); - $status_label = HarbormasterBuild::getBuildStatusName($status); + $status_icon = HarbormasterBuildStatus::getBuildStatusIcon($status); + $status_color = HarbormasterBuildStatus::getBuildStatusColor($status); + $status_label = HarbormasterBuildStatus::getBuildStatusName($status); $item->setStatusIcon("{$status_icon} {$status_color}", $status_label); diff --git a/src/applications/harbormaster/storage/HarbormasterBuildable.php b/src/applications/harbormaster/storage/HarbormasterBuildable.php index 7a7b32618c..5e55d38824 100644 --- a/src/applications/harbormaster/storage/HarbormasterBuildable.php +++ b/src/applications/harbormaster/storage/HarbormasterBuildable.php @@ -170,7 +170,7 @@ final class HarbormasterBuildable extends HarbormasterDAO ->setBuildablePHID($this->getPHID()) ->setBuildPlanPHID($plan->getPHID()) ->setBuildParameters($parameters) - ->setBuildStatus(HarbormasterBuild::STATUS_PENDING); + ->setBuildStatus(HarbormasterBuildStatus::STATUS_PENDING); if ($initiator_phid) { $build->setInitiatorPHID($initiator_phid); } diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuild.php b/src/applications/harbormaster/storage/build/HarbormasterBuild.php index 385b9133a8..44846b9bc8 100644 --- a/src/applications/harbormaster/storage/build/HarbormasterBuild.php +++ b/src/applications/harbormaster/storage/build/HarbormasterBuild.php @@ -18,125 +18,9 @@ final class HarbormasterBuild extends HarbormasterDAO private $buildTargets = self::ATTACHABLE; private $unprocessedCommands = self::ATTACHABLE; - /** - * Not currently being built. - */ - const STATUS_INACTIVE = 'inactive'; - - /** - * Pending pick up by the Harbormaster daemon. - */ - const STATUS_PENDING = 'pending'; - - /** - * Current building the buildable. - */ - const STATUS_BUILDING = 'building'; - - /** - * The build has passed. - */ - const STATUS_PASSED = 'passed'; - - /** - * The build has failed. - */ - const STATUS_FAILED = 'failed'; - - /** - * The build has aborted. - */ - const STATUS_ABORTED = 'aborted'; - - /** - * The build encountered an unexpected error. - */ - const STATUS_ERROR = 'error'; - - /** - * The build has been paused. - */ - const STATUS_PAUSED = 'paused'; - - /** - * The build has been deadlocked. - */ - const STATUS_DEADLOCKED = 'deadlocked'; - - - /** - * Get a human readable name for a build status constant. - * - * @param const Build status constant. - * @return string Human-readable name. - */ - public static function getBuildStatusName($status) { - $map = self::getBuildStatusMap(); - return idx($map, $status, pht('Unknown ("%s")', $status)); - } - - public static function getBuildStatusMap() { - return array( - self::STATUS_INACTIVE => pht('Inactive'), - self::STATUS_PENDING => pht('Pending'), - self::STATUS_BUILDING => pht('Building'), - self::STATUS_PASSED => pht('Passed'), - self::STATUS_FAILED => pht('Failed'), - self::STATUS_ABORTED => pht('Aborted'), - self::STATUS_ERROR => pht('Unexpected Error'), - self::STATUS_PAUSED => pht('Paused'), - self::STATUS_DEADLOCKED => pht('Deadlocked'), - ); - } - - public static function getBuildStatusIcon($status) { - switch ($status) { - case self::STATUS_INACTIVE: - case self::STATUS_PENDING: - return PHUIStatusItemView::ICON_OPEN; - case self::STATUS_BUILDING: - return PHUIStatusItemView::ICON_RIGHT; - case self::STATUS_PASSED: - return PHUIStatusItemView::ICON_ACCEPT; - case self::STATUS_FAILED: - return PHUIStatusItemView::ICON_REJECT; - case self::STATUS_ABORTED: - return PHUIStatusItemView::ICON_MINUS; - case self::STATUS_ERROR: - return PHUIStatusItemView::ICON_MINUS; - case self::STATUS_PAUSED: - return PHUIStatusItemView::ICON_MINUS; - case self::STATUS_DEADLOCKED: - return PHUIStatusItemView::ICON_WARNING; - default: - return PHUIStatusItemView::ICON_QUESTION; - } - } - - public static function getBuildStatusColor($status) { - switch ($status) { - case self::STATUS_INACTIVE: - return 'dark'; - case self::STATUS_PENDING: - case self::STATUS_BUILDING: - return 'blue'; - case self::STATUS_PASSED: - return 'green'; - case self::STATUS_FAILED: - case self::STATUS_ABORTED: - case self::STATUS_ERROR: - case self::STATUS_DEADLOCKED: - return 'red'; - case self::STATUS_PAUSED: - return 'dark'; - default: - return 'bluegrey'; - } - } - public static function initializeNewBuild(PhabricatorUser $actor) { return id(new HarbormasterBuild()) - ->setBuildStatus(self::STATUS_INACTIVE) + ->setBuildStatus(HarbormasterBuildStatus::STATUS_INACTIVE) ->setBuildGeneration(0); } @@ -220,8 +104,9 @@ final class HarbormasterBuild extends HarbormasterDAO } public function isBuilding() { - return $this->getBuildStatus() === self::STATUS_PENDING || - $this->getBuildStatus() === self::STATUS_BUILDING; + return + $this->getBuildStatus() === HarbormasterBuildStatus::STATUS_PENDING || + $this->getBuildStatus() === HarbormasterBuildStatus::STATUS_BUILDING; } public function isAutobuild() { @@ -285,11 +170,11 @@ final class HarbormasterBuild extends HarbormasterDAO public function isComplete() { switch ($this->getBuildStatus()) { - case self::STATUS_PASSED: - case self::STATUS_FAILED: - case self::STATUS_ABORTED: - case self::STATUS_ERROR: - case self::STATUS_PAUSED: + case HarbormasterBuildStatus::STATUS_PASSED: + case HarbormasterBuildStatus::STATUS_FAILED: + case HarbormasterBuildStatus::STATUS_ABORTED: + case HarbormasterBuildStatus::STATUS_ERROR: + case HarbormasterBuildStatus::STATUS_PAUSED: return true; } @@ -297,7 +182,7 @@ final class HarbormasterBuild extends HarbormasterDAO } public function isPaused() { - return ($this->getBuildStatus() == self::STATUS_PAUSED); + return ($this->getBuildStatus() == HarbormasterBuildStatus::STATUS_PAUSED); } public function getURI() { diff --git a/src/applications/harbormaster/typeahead/HarbormasterBuildStatusDatasource.php b/src/applications/harbormaster/typeahead/HarbormasterBuildStatusDatasource.php index 3e757b4348..6cc11bd0c2 100644 --- a/src/applications/harbormaster/typeahead/HarbormasterBuildStatusDatasource.php +++ b/src/applications/harbormaster/typeahead/HarbormasterBuildStatusDatasource.php @@ -27,11 +27,11 @@ final class HarbormasterBuildStatusDatasource private function buildResults() { $results = array(); - $status_map = HarbormasterBuild::getBuildStatusMap(); + $status_map = HarbormasterBuildStatus::getBuildStatusMap(); foreach ($status_map as $value => $name) { $result = id(new PhabricatorTypeaheadResult()) - ->setIcon(HarbormasterBuild::getBuildStatusIcon($value)) - ->setColor(HarbormasterBuild::getBuildStatusColor($value)) + ->setIcon(HarbormasterBuildStatus::getBuildStatusIcon($value)) + ->setColor(HarbormasterBuildStatus::getBuildStatusColor($value)) ->setPHID($value) ->setName($name) ->addAttribute(pht('Status'));