|
| 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 | +} |
0 commit comments