Differential D21688 Diff 51701 src/applications/harbormaster/storage/HarbormasterBuildTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/storage/HarbormasterBuildTransaction.php
<?php | <?php | ||||
final class HarbormasterBuildTransaction | final class HarbormasterBuildTransaction | ||||
extends PhabricatorApplicationTransaction { | extends PhabricatorApplicationTransaction { | ||||
const TYPE_CREATE = 'harbormaster:build:create'; | |||||
const TYPE_COMMAND = 'harbormaster:build:command'; | const TYPE_COMMAND = 'harbormaster:build:command'; | ||||
public function getApplicationName() { | public function getApplicationName() { | ||||
return 'harbormaster'; | return 'harbormaster'; | ||||
} | } | ||||
public function getApplicationTransactionType() { | public function getApplicationTransactionType() { | ||||
return HarbormasterBuildPHIDType::TYPECONST; | return HarbormasterBuildPHIDType::TYPECONST; | ||||
} | } | ||||
public function getTitle() { | public function getTitle() { | ||||
$author_phid = $this->getAuthorPHID(); | $author_phid = $this->getAuthorPHID(); | ||||
$old = $this->getOldValue(); | $old = $this->getOldValue(); | ||||
$new = $this->getNewValue(); | $new = $this->getNewValue(); | ||||
switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
case self::TYPE_CREATE: | |||||
return pht( | |||||
'%s created this build.', | |||||
$this->renderHandleLink($author_phid)); | |||||
case self::TYPE_COMMAND: | case self::TYPE_COMMAND: | ||||
switch ($new) { | switch ($new) { | ||||
case HarbormasterBuildCommand::COMMAND_RESTART: | case HarbormasterBuildCommand::COMMAND_RESTART: | ||||
return pht( | return pht( | ||||
'%s restarted this build.', | '%s restarted this build.', | ||||
$this->renderHandleLink($author_phid)); | $this->renderHandleLink($author_phid)); | ||||
case HarbormasterBuildCommand::COMMAND_ABORT: | case HarbormasterBuildCommand::COMMAND_ABORT: | ||||
return pht( | return pht( | ||||
Show All 14 Lines | final class HarbormasterBuildTransaction | ||||
public function getIcon() { | public function getIcon() { | ||||
$author_phid = $this->getAuthorPHID(); | $author_phid = $this->getAuthorPHID(); | ||||
$old = $this->getOldValue(); | $old = $this->getOldValue(); | ||||
$new = $this->getNewValue(); | $new = $this->getNewValue(); | ||||
switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
case self::TYPE_CREATE: | |||||
return 'fa-plus'; | |||||
case self::TYPE_COMMAND: | case self::TYPE_COMMAND: | ||||
switch ($new) { | switch ($new) { | ||||
case HarbormasterBuildCommand::COMMAND_RESTART: | case HarbormasterBuildCommand::COMMAND_RESTART: | ||||
return 'fa-backward'; | return 'fa-backward'; | ||||
case HarbormasterBuildCommand::COMMAND_RESUME: | case HarbormasterBuildCommand::COMMAND_RESUME: | ||||
return 'fa-play'; | return 'fa-play'; | ||||
case HarbormasterBuildCommand::COMMAND_PAUSE: | case HarbormasterBuildCommand::COMMAND_PAUSE: | ||||
return 'fa-pause'; | return 'fa-pause'; | ||||
case HarbormasterBuildCommand::COMMAND_ABORT: | case HarbormasterBuildCommand::COMMAND_ABORT: | ||||
return 'fa-exclamation-triangle'; | return 'fa-exclamation-triangle'; | ||||
} | } | ||||
} | } | ||||
return parent::getIcon(); | return parent::getIcon(); | ||||
} | } | ||||
public function getColor() { | public function getColor() { | ||||
$author_phid = $this->getAuthorPHID(); | $author_phid = $this->getAuthorPHID(); | ||||
$old = $this->getOldValue(); | $old = $this->getOldValue(); | ||||
$new = $this->getNewValue(); | $new = $this->getNewValue(); | ||||
switch ($this->getTransactionType()) { | switch ($this->getTransactionType()) { | ||||
case self::TYPE_CREATE: | |||||
return 'green'; | |||||
case self::TYPE_COMMAND: | case self::TYPE_COMMAND: | ||||
switch ($new) { | switch ($new) { | ||||
case HarbormasterBuildCommand::COMMAND_PAUSE: | case HarbormasterBuildCommand::COMMAND_PAUSE: | ||||
case HarbormasterBuildCommand::COMMAND_ABORT: | case HarbormasterBuildCommand::COMMAND_ABORT: | ||||
return 'red'; | return 'red'; | ||||
} | } | ||||
} | } | ||||
return parent::getColor(); | return parent::getColor(); | ||||
} | } | ||||
} | } |