Differential D21689 Diff 51702 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 PhabricatorModularTransaction { | ||||
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 getBaseTransactionClass() { | ||||
$author_phid = $this->getAuthorPHID(); | return 'HarbormasterBuildTransactionType'; | ||||
$old = $this->getOldValue(); | |||||
$new = $this->getNewValue(); | |||||
switch ($this->getTransactionType()) { | |||||
case self::TYPE_COMMAND: | |||||
switch ($new) { | |||||
case HarbormasterBuildCommand::COMMAND_RESTART: | |||||
return pht( | |||||
'%s restarted this build.', | |||||
$this->renderHandleLink($author_phid)); | |||||
case HarbormasterBuildCommand::COMMAND_ABORT: | |||||
return pht( | |||||
'%s aborted this build.', | |||||
$this->renderHandleLink($author_phid)); | |||||
case HarbormasterBuildCommand::COMMAND_RESUME: | |||||
return pht( | |||||
'%s resumed this build.', | |||||
$this->renderHandleLink($author_phid)); | |||||
case HarbormasterBuildCommand::COMMAND_PAUSE: | |||||
return pht( | |||||
'%s paused this build.', | |||||
$this->renderHandleLink($author_phid)); | |||||
} | |||||
} | |||||
return parent::getTitle(); | |||||
} | } | ||||
public function getIcon() { | |||||
$author_phid = $this->getAuthorPHID(); | |||||
$old = $this->getOldValue(); | |||||
$new = $this->getNewValue(); | |||||
switch ($this->getTransactionType()) { | |||||
case self::TYPE_COMMAND: | |||||
switch ($new) { | |||||
case HarbormasterBuildCommand::COMMAND_RESTART: | |||||
return 'fa-backward'; | |||||
case HarbormasterBuildCommand::COMMAND_RESUME: | |||||
return 'fa-play'; | |||||
case HarbormasterBuildCommand::COMMAND_PAUSE: | |||||
return 'fa-pause'; | |||||
case HarbormasterBuildCommand::COMMAND_ABORT: | |||||
return 'fa-exclamation-triangle'; | |||||
} | |||||
} | |||||
return parent::getIcon(); | |||||
} | |||||
public function getColor() { | |||||
$author_phid = $this->getAuthorPHID(); | |||||
$old = $this->getOldValue(); | |||||
$new = $this->getNewValue(); | |||||
switch ($this->getTransactionType()) { | |||||
case self::TYPE_COMMAND: | |||||
switch ($new) { | |||||
case HarbormasterBuildCommand::COMMAND_PAUSE: | |||||
case HarbormasterBuildCommand::COMMAND_ABORT: | |||||
return 'red'; | |||||
} | |||||
} | |||||
return parent::getColor(); | |||||
} | |||||
} | } |