Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/harbormaster/editor/HarbormasterBuildTransactionEditor.php b/src/applications/harbormaster/editor/HarbormasterBuildTransactionEditor.php
index b3bda8ffd2..f548a56e77 100644
--- a/src/applications/harbormaster/editor/HarbormasterBuildTransactionEditor.php
+++ b/src/applications/harbormaster/editor/HarbormasterBuildTransactionEditor.php
@@ -1,109 +1,102 @@
<?php
final class HarbormasterBuildTransactionEditor
extends PhabricatorApplicationTransactionEditor {
public function getEditorApplicationClass() {
return 'PhabricatorHarbormasterApplication';
}
public function getEditorObjectsDescription() {
return pht('Harbormaster Builds');
}
public function getTransactionTypes() {
$types = parent::getTransactionTypes();
- $types[] = HarbormasterBuildTransaction::TYPE_CREATE;
$types[] = HarbormasterBuildTransaction::TYPE_COMMAND;
return $types;
}
protected function getCustomTransactionOldValue(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
- case HarbormasterBuildTransaction::TYPE_CREATE:
case HarbormasterBuildTransaction::TYPE_COMMAND:
return null;
}
return parent::getCustomTransactionOldValue($object, $xaction);
}
protected function getCustomTransactionNewValue(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
- case HarbormasterBuildTransaction::TYPE_CREATE:
- return true;
case HarbormasterBuildTransaction::TYPE_COMMAND:
return $xaction->getNewValue();
}
return parent::getCustomTransactionNewValue($object, $xaction);
}
protected function applyCustomInternalTransaction(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
- case HarbormasterBuildTransaction::TYPE_CREATE:
- return;
case HarbormasterBuildTransaction::TYPE_COMMAND:
return $this->executeBuildCommand($object, $xaction);
}
return parent::applyCustomInternalTransaction($object, $xaction);
}
private function executeBuildCommand(
HarbormasterBuild $build,
HarbormasterBuildTransaction $xaction) {
$actor = $this->getActor();
$message_type = $xaction->getNewValue();
// TODO: Restore logic that tests if the command can issue without causing
// anything to lapse into an invalid state. This should not be the same
// as the logic which powers the web UI: for example, if an "abort" is
// queued we want to disable "Abort" in the web UI, but should obviously
// process it here.
switch ($message_type) {
case HarbormasterBuildCommand::COMMAND_ABORT:
// TODO: This should move to external effects, perhaps.
$build->releaseAllArtifacts($actor);
$build->setBuildStatus(HarbormasterBuildStatus::STATUS_ABORTED);
break;
case HarbormasterBuildCommand::COMMAND_RESTART:
$build->restartBuild($actor);
$build->setBuildStatus(HarbormasterBuildStatus::STATUS_BUILDING);
break;
case HarbormasterBuildCommand::COMMAND_RESUME:
$build->setBuildStatus(HarbormasterBuildStatus::STATUS_BUILDING);
break;
case HarbormasterBuildCommand::COMMAND_PAUSE:
$build->setBuildStatus(HarbormasterBuildStatus::STATUS_PAUSED);
break;
}
}
protected function applyCustomExternalTransaction(
PhabricatorLiskDAO $object,
PhabricatorApplicationTransaction $xaction) {
switch ($xaction->getTransactionType()) {
- case HarbormasterBuildTransaction::TYPE_CREATE:
case HarbormasterBuildTransaction::TYPE_COMMAND:
return;
}
return parent::applyCustomExternalTransaction($object, $xaction);
}
}
diff --git a/src/applications/harbormaster/storage/HarbormasterBuildTransaction.php b/src/applications/harbormaster/storage/HarbormasterBuildTransaction.php
index e16a51008c..1396c15068 100644
--- a/src/applications/harbormaster/storage/HarbormasterBuildTransaction.php
+++ b/src/applications/harbormaster/storage/HarbormasterBuildTransaction.php
@@ -1,94 +1,85 @@
<?php
final class HarbormasterBuildTransaction
extends PhabricatorApplicationTransaction {
- const TYPE_CREATE = 'harbormaster:build:create';
const TYPE_COMMAND = 'harbormaster:build:command';
public function getApplicationName() {
return 'harbormaster';
}
public function getApplicationTransactionType() {
return HarbormasterBuildPHIDType::TYPECONST;
}
public function getTitle() {
$author_phid = $this->getAuthorPHID();
$old = $this->getOldValue();
$new = $this->getNewValue();
switch ($this->getTransactionType()) {
- case self::TYPE_CREATE:
- return pht(
- '%s created this build.',
- $this->renderHandleLink($author_phid));
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_CREATE:
- return 'fa-plus';
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_CREATE:
- return 'green';
case self::TYPE_COMMAND:
switch ($new) {
case HarbormasterBuildCommand::COMMAND_PAUSE:
case HarbormasterBuildCommand::COMMAND_ABORT:
return 'red';
}
}
return parent::getColor();
}
}

File Metadata

Mime Type
text/x-diff
Expires
Tue, Nov 26, 10:44 PM (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1251
Default Alt Text
(6 KB)

Event Timeline