Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/plan/HarbormasterBuildPlanBehavior.php
<?php | <?php | ||||
final class HarbormasterBuildPlanBehavior | final class HarbormasterBuildPlanBehavior | ||||
extends Phobject { | extends Phobject { | ||||
private $key; | private $key; | ||||
private $name; | private $name; | ||||
private $options; | private $options; | ||||
private $defaultKey; | private $defaultKey; | ||||
private $editInstructions; | private $editInstructions; | ||||
const BEHAVIOR_RUNNABLE = 'runnable'; | const BEHAVIOR_RUNNABLE = 'runnable'; | ||||
const RUNNABLE_IF_VIEWABLE = 'view'; | const RUNNABLE_IF_VIEWABLE = 'view'; | ||||
const RUNNABLE_IF_EDITABLE = 'edit'; | const RUNNABLE_IF_EDITABLE = 'edit'; | ||||
const BEHAVIOR_RESTARTABLE = 'restartable'; | |||||
const RESTARTABLE_ALWAYS = 'always'; | |||||
const RESTARTABLE_NEVER = 'never'; | |||||
public function setKey($key) { | public function setKey($key) { | ||||
$this->key = $key; | $this->key = $key; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getKey() { | public function getKey() { | ||||
return $this->key; | return $this->key; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | $aggregate_options = array( | ||||
->setName(pht('Never')) | ->setName(pht('Never')) | ||||
->setDescription( | ->setDescription( | ||||
pht( | pht( | ||||
'The buildable does not wait for the build.')), | 'The buildable does not wait for the build.')), | ||||
); | ); | ||||
$restart_options = array( | $restart_options = array( | ||||
id(new HarbormasterBuildPlanBehaviorOption()) | id(new HarbormasterBuildPlanBehaviorOption()) | ||||
->setKey('always') | ->setKey(self::RESTARTABLE_ALWAYS) | ||||
->setIcon('fa-repeat green') | ->setIcon('fa-repeat green') | ||||
->setName(pht('Always')) | ->setName(pht('Always')) | ||||
->setIsDefault(true) | ->setIsDefault(true) | ||||
->setDescription( | ->setDescription( | ||||
pht('The build may be restarted.')), | pht('The build may be restarted.')), | ||||
id(new HarbormasterBuildPlanBehaviorOption()) | id(new HarbormasterBuildPlanBehaviorOption()) | ||||
->setKey('never') | ->setKey(self::RESTARTABLE_NEVER) | ||||
->setIcon('fa-times red') | ->setIcon('fa-times red') | ||||
->setName(pht('Never')) | ->setName(pht('Never')) | ||||
->setDescription( | ->setDescription( | ||||
pht('The build may not be restarted.')), | pht('The build may not be restarted.')), | ||||
); | ); | ||||
$run_options = array( | $run_options = array( | ||||
id(new HarbormasterBuildPlanBehaviorOption()) | id(new HarbormasterBuildPlanBehaviorOption()) | ||||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | $behaviors = array( | ||||
'them to "pass"), or any build fails (which changes them to '. | 'them to "pass"), or any build fails (which changes them to '. | ||||
'"fail").'. | '"fail").'. | ||||
"\n\n". | "\n\n". | ||||
'You can change this behavior if you do not want to wait for this '. | 'You can change this behavior if you do not want to wait for this '. | ||||
'build, or do not care if it fails.')) | 'build, or do not care if it fails.')) | ||||
->setName(pht('Affects Buildable')) | ->setName(pht('Affects Buildable')) | ||||
->setOptions($aggregate_options), | ->setOptions($aggregate_options), | ||||
id(new self()) | id(new self()) | ||||
->setKey('restartable') | ->setKey(self::BEHAVIOR_RESTARTABLE) | ||||
->setEditInstructions( | ->setEditInstructions( | ||||
pht( | pht( | ||||
'Usually, builds may be restarted. This may be useful if you '. | 'Usually, builds may be restarted. This may be useful if you '. | ||||
'suspect a build has failed for environmental or circumstantial '. | 'suspect a build has failed for environmental or circumstantial '. | ||||
'reasons unrelated to the actual code, and want to give it '. | 'reasons unrelated to the actual code, and want to give it '. | ||||
'another chance at glory.'. | 'another chance at glory.'. | ||||
"\n\n". | "\n\n". | ||||
'If you want to prevent a build from being restarted, you can '. | 'If you want to prevent a build from being restarted, you can '. | ||||
Show All 36 Lines |