Differential D21693 Diff 51706 src/applications/harbormaster/storage/HarbormasterBuildableTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/storage/HarbormasterBuildableTransaction.php
<?php | <?php | ||||
final class HarbormasterBuildableTransaction | final class HarbormasterBuildableTransaction | ||||
extends PhabricatorApplicationTransaction { | extends PhabricatorApplicationTransaction { | ||||
const TYPE_CREATE = 'harbormaster:buildable:create'; | |||||
const TYPE_COMMAND = 'harbormaster:buildable:command'; | const TYPE_COMMAND = 'harbormaster:buildable:command'; | ||||
public function getApplicationName() { | public function getApplicationName() { | ||||
return 'harbormaster'; | return 'harbormaster'; | ||||
} | } | ||||
public function getApplicationTransactionType() { | public function getApplicationTransactionType() { | ||||
return HarbormasterBuildablePHIDType::TYPECONST; | return HarbormasterBuildablePHIDType::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 buildable.', | |||||
$this->renderHandleLink($author_phid)); | |||||
case self::TYPE_COMMAND: | case self::TYPE_COMMAND: | ||||
switch ($new) { | switch ($new) { | ||||
case HarbormasterBuildMessageRestartTransaction::MESSAGETYPE: | case HarbormasterBuildMessageRestartTransaction::MESSAGETYPE: | ||||
return pht( | return pht( | ||||
'%s restarted this buildable.', | '%s restarted this buildable.', | ||||
$this->renderHandleLink($author_phid)); | $this->renderHandleLink($author_phid)); | ||||
case HarbormasterBuildMessageResumeTransaction::MESSAGETYPE: | case HarbormasterBuildMessageResumeTransaction::MESSAGETYPE: | ||||
return pht( | return pht( | ||||
Show All 14 Lines | final class HarbormasterBuildableTransaction | ||||
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 HarbormasterBuildMessageRestartTransaction::MESSAGETYPE: | case HarbormasterBuildMessageRestartTransaction::MESSAGETYPE: | ||||
return 'fa-backward'; | return 'fa-backward'; | ||||
case HarbormasterBuildMessageResumeTransaction::MESSAGETYPE: | case HarbormasterBuildMessageResumeTransaction::MESSAGETYPE: | ||||
return 'fa-play'; | return 'fa-play'; | ||||
case HarbormasterBuildMessagePauseTransaction::MESSAGETYPE: | case HarbormasterBuildMessagePauseTransaction::MESSAGETYPE: | ||||
return 'fa-pause'; | return 'fa-pause'; | ||||
case HarbormasterBuildMessageAbortTransaction::MESSAGETYPE: | case HarbormasterBuildMessageAbortTransaction::MESSAGETYPE: | ||||
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 HarbormasterBuildMessagePauseTransaction::MESSAGETYPE: | case HarbormasterBuildMessagePauseTransaction::MESSAGETYPE: | ||||
return 'red'; | return 'red'; | ||||
} | } | ||||
} | } | ||||
return parent::getColor(); | return parent::getColor(); | ||||
} | } | ||||
} | } |