forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhabricatorProjectTriggerInvalidRule.php
93 lines (73 loc) · 1.86 KB
/
PhabricatorProjectTriggerInvalidRule.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
final class PhabricatorProjectTriggerInvalidRule
extends PhabricatorProjectTriggerRule {
const TRIGGERTYPE = 'invalid';
private $exception;
public function setException(Exception $exception) {
$this->exception = $exception;
return $this;
}
public function getException() {
return $this->exception;
}
public function getSelectControlName() {
return pht('(Invalid Rule)');
}
protected function isSelectableRule() {
return false;
}
protected function assertValidRuleRecordFormat($value) {
return;
}
protected function newDropTransactions($object, $value) {
return array();
}
protected function newDropEffects($value) {
return array();
}
protected function isValidRule() {
return false;
}
protected function newInvalidView() {
return array(
id(new PHUIIconView())
->setIcon('fa-exclamation-triangle red'),
' ',
pht(
'This is a trigger rule with a valid type ("%s") but an invalid '.
'value.',
$this->getRecord()->getType()),
);
}
protected function getDefaultValue() {
return null;
}
protected function getPHUIXControlType() {
return null;
}
protected function getPHUIXControlSpecification() {
return null;
}
public function getRuleViewLabel() {
return pht('Invalid Rule');
}
public function getRuleViewDescription($value) {
$record = $this->getRecord();
$type = $record->getType();
$exception = $this->getException();
if ($exception) {
return pht(
'This rule (of type "%s") is invalid: %s',
$type,
$exception->getMessage());
} else {
return pht(
'This rule (of type "%s") is invalid.',
$type);
}
}
public function getRuleViewIcon($value) {
return id(new PHUIIconView())
->setIcon('fa-exclamation-triangle', 'red');
}
}