-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDifferentialAYXJiraField.php
132 lines (103 loc) · 3.06 KB
/
DifferentialAYXJiraField.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
final class DifferentialAYXJiraField
extends DifferentialStoredCustomField {
public function getFieldKey() {
return 'trifacta:ayx-jira';
}
public function getFieldName() {
return pht('AYX Jira Issues');
}
public function getFieldDescription() {
return pht('The Jira Issue (in AYX Jira) to track the changes');
}
public function getHeraldFieldStandardType() {
return 'standard.text';
}
public function getHeraldFieldValueType($condition) {
return new HeraldTextFieldValue();
}
public function getHeraldFieldConditions() {
return array(
HeraldAdapter::CONDITION_CONTAINS,
HeraldAdapter::CONDITION_NOT_CONTAINS,
HeraldAdapter::CONDITION_IS,
HeraldAdapter::CONDITION_IS_NOT,
HeraldAdapter::CONDITION_REGEXP,
);
}
public function shouldAppearInHerald() {
return false;
}
public function getHeraldFieldValue() {
return $this->getValue();
}
public function shouldDisableByDefault() {
return false;
}
public function shouldAppearInPropertyView() {
return true;
}
public function renderPropertyViewLabel() {
return $this->getFieldName();
}
public function renderPropertyViewValue(array $handles) {
if (!strlen($this->getValue())) {
return null;
}
return $this->getValue();
}
public function shouldAppearInApplicationTransactions() {
return true;
}
public function getOldValueForApplicationTransactions() {
return $this->getValue();
}
public function getNewValueForApplicationTransactions() {
return $this->getValue();
}
public function shouldAppearInEditView() {
return true;
}
public function renderEditControl(array $handles) {
return id(new AphrontFormTextControl())
->setName($this->getFieldKey())
->setValue($this->getValue())
->setLabel($this->getFieldName());
}
public function readValueFromRequest(AphrontRequest $request) {
$this->setValue($request->getStr($this->getFieldKey()));
}
public function getApplicationTransactionTitle(
PhabricatorApplicationTransaction $xaction) {
$author_phid = $xaction->getAuthorPHID();
$old = $xaction->getOldValue();
$new = $xaction->getNewValue();
return pht(
'%s edited the AYX Jira issues: "%s" became "%s".',
$xaction->renderHandleLink($author_phid),
$old,
$new);
}
public function getApplicationTransactionTitleForFeed(
PhabricatorApplicationTransaction $xaction) {
$object_phid = $xaction->getObjectPHID();
$author_phid = $xaction->getAuthorPHID();
$old = $xaction->getOldValue();
$new = $xaction->getNewValue();
return pht(
'%s edited the AYX Jira issues for %s: "%s" became "%s".',
$xaction->renderHandleLink($author_phid),
$xaction->renderHandleLink($object_phid),
$old,
$new);
}
public function shouldAppearInConduitDictionary() {
return true;
}
public function shouldAppearInConduitTransactions() {
return true;
}
protected function newConduitEditParameterType() {
return new ConduitStringParameterType();
}
}