Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/harbormaster/xaction/buildable/HarbormasterBuildableMessageTransaction.php
12264 views
1
<?php
2
3
final class HarbormasterBuildableMessageTransaction
4
extends HarbormasterBuildableTransactionType {
5
6
const TRANSACTIONTYPE = 'harbormaster:buildable:command';
7
8
public function generateOldValue($object) {
9
return null;
10
}
11
12
public function getTitle() {
13
$new = $this->getNewValue();
14
15
switch ($new) {
16
case HarbormasterBuildMessageRestartTransaction::MESSAGETYPE:
17
return pht(
18
'%s restarted this buildable.',
19
$this->renderAuthor());
20
case HarbormasterBuildMessageResumeTransaction::MESSAGETYPE:
21
return pht(
22
'%s resumed this buildable.',
23
$this->renderAuthor());
24
case HarbormasterBuildMessagePauseTransaction::MESSAGETYPE:
25
return pht(
26
'%s paused this buildable.',
27
$this->renderAuthor());
28
case HarbormasterBuildMessageAbortTransaction::MESSAGETYPE:
29
return pht(
30
'%s aborted this buildable.',
31
$this->renderAuthor());
32
}
33
34
return parent::getTitle();
35
}
36
37
public function getIcon() {
38
$new = $this->getNewValue();
39
40
switch ($new) {
41
case HarbormasterBuildMessageRestartTransaction::MESSAGETYPE:
42
return 'fa-backward';
43
case HarbormasterBuildMessageResumeTransaction::MESSAGETYPE:
44
return 'fa-play';
45
case HarbormasterBuildMessagePauseTransaction::MESSAGETYPE:
46
return 'fa-pause';
47
case HarbormasterBuildMessageAbortTransaction::MESSAGETYPE:
48
return 'fa-exclamation-triangle';
49
}
50
51
return parent::getIcon();
52
}
53
54
public function getColor() {
55
$new = $this->getNewValue();
56
57
switch ($new) {
58
case HarbormasterBuildMessagePauseTransaction::MESSAGETYPE:
59
return 'red';
60
}
61
62
return parent::getColor();
63
}
64
65
}
66
67