Skip to content

Commit 8bd3145

Browse files
author
Devashish Chandra
committed
Add Custom field in Differential for AYX Jira
Summary: Adding a custom field in Differential to add Jira Issues from the Alteryx Jira. Test Plan: Deploy to staging and verify Reviewers: lbly, hverlin, arash Reviewed By: hverlin Subscribers: amandhania Differential Revision: https://phab.trifacta.com/D64524
1 parent 2a688ed commit 8bd3145

File tree

2 files changed

+163
-0
lines changed

2 files changed

+163
-0
lines changed

DifferentialAYXJiraField.php

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<?php
2+
3+
final class DifferentialAYXJiraField
4+
extends DifferentialStoredCustomField {
5+
6+
public function getFieldKey() {
7+
return 'trifacta:ayx-jira';
8+
}
9+
10+
public function getFieldName() {
11+
return pht('AYX Jira Issues');
12+
}
13+
14+
public function getFieldDescription() {
15+
return pht('The Jira Issue (in AYX Jira) to track the changes');
16+
}
17+
18+
public function getHeraldFieldStandardType() {
19+
return 'standard.text';
20+
}
21+
22+
public function getHeraldFieldValueType($condition) {
23+
return new HeraldTextFieldValue();
24+
}
25+
26+
public function getHeraldFieldConditions() {
27+
return array(
28+
HeraldAdapter::CONDITION_CONTAINS,
29+
HeraldAdapter::CONDITION_NOT_CONTAINS,
30+
HeraldAdapter::CONDITION_IS,
31+
HeraldAdapter::CONDITION_IS_NOT,
32+
HeraldAdapter::CONDITION_REGEXP,
33+
);
34+
}
35+
36+
public function shouldAppearInHerald() {
37+
return false;
38+
}
39+
40+
public function getHeraldFieldValue() {
41+
return $this->getValue();
42+
}
43+
44+
public function shouldDisableByDefault() {
45+
return false;
46+
}
47+
48+
public function shouldAppearInPropertyView() {
49+
return true;
50+
}
51+
52+
public function renderPropertyViewLabel() {
53+
return $this->getFieldName();
54+
}
55+
56+
public function renderPropertyViewValue(array $handles) {
57+
if (!strlen($this->getValue())) {
58+
return null;
59+
}
60+
61+
return $this->getValue();
62+
}
63+
64+
public function shouldAppearInApplicationTransactions() {
65+
return true;
66+
}
67+
68+
public function getOldValueForApplicationTransactions() {
69+
return $this->getValue();
70+
}
71+
72+
public function getNewValueForApplicationTransactions() {
73+
return $this->getValue();
74+
}
75+
76+
public function shouldAppearInEditView() {
77+
return true;
78+
}
79+
80+
public function renderEditControl(array $handles) {
81+
return id(new AphrontFormTextControl())
82+
->setName($this->getFieldKey())
83+
->setValue($this->getValue())
84+
->setLabel($this->getFieldName());
85+
}
86+
87+
public function readValueFromRequest(AphrontRequest $request) {
88+
$this->setValue($request->getStr($this->getFieldKey()));
89+
}
90+
91+
public function getApplicationTransactionTitle(
92+
PhabricatorApplicationTransaction $xaction) {
93+
$author_phid = $xaction->getAuthorPHID();
94+
$old = $xaction->getOldValue();
95+
$new = $xaction->getNewValue();
96+
97+
return pht(
98+
'%s edited the AYX Jira issues: "%s" became "%s".',
99+
$xaction->renderHandleLink($author_phid),
100+
$old,
101+
$new);
102+
}
103+
104+
public function getApplicationTransactionTitleForFeed(
105+
PhabricatorApplicationTransaction $xaction) {
106+
107+
$object_phid = $xaction->getObjectPHID();
108+
$author_phid = $xaction->getAuthorPHID();
109+
$old = $xaction->getOldValue();
110+
$new = $xaction->getNewValue();
111+
112+
return pht(
113+
'%s edited the AYX Jira issues for %s: "%s" became "%s".',
114+
$xaction->renderHandleLink($author_phid),
115+
$xaction->renderHandleLink($object_phid),
116+
$old,
117+
$new);
118+
}
119+
120+
public function shouldAppearInConduitDictionary() {
121+
return true;
122+
}
123+
124+
public function shouldAppearInConduitTransactions() {
125+
return true;
126+
}
127+
128+
protected function newConduitEditParameterType() {
129+
return new ConduitStringParameterType();
130+
}
131+
132+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
final class DifferentialAYXJiraMessageField
4+
extends DifferentialCommitMessageCustomField {
5+
6+
const FIELDKEY = 'trifacta:ayx-jira';
7+
8+
public function getFieldName() {
9+
return pht('AYX Jira Issues');
10+
}
11+
12+
public function getCustomFieldKey() {
13+
return 'trifacta:ayx-jira';
14+
}
15+
16+
public function getFieldOrder() {
17+
return 1000000;
18+
}
19+
20+
public function isFieldEditable() {
21+
return true;
22+
}
23+
24+
public function isTemplateField() {
25+
return true;
26+
}
27+
28+
public function renderFieldValue($value) {
29+
return $value;
30+
}
31+
}

0 commit comments

Comments
 (0)