mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Fully modularize Herald field values
Summary: Ref T8726. This gets rid of all the `VALUE_*` constants and lets Fields provide arbitrary typeaheads without upstream/JS changes. Test Plan: Used all tokenizers. Used "Another Herald Rule". Grepped for all removed constants. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8726 Differential Revision: https://secure.phabricator.com/D13616
This commit is contained in:
parent
ed3dfd491f
commit
715233fb61
58 changed files with 261 additions and 401 deletions
|
@ -382,7 +382,7 @@ return array(
|
|||
'rsrc/js/application/doorkeeper/behavior-doorkeeper-tag.js' => 'e5822781',
|
||||
'rsrc/js/application/files/behavior-icon-composer.js' => '8ef9ab58',
|
||||
'rsrc/js/application/files/behavior-launch-icon-composer.js' => '48086888',
|
||||
'rsrc/js/application/herald/HeraldRuleEditor.js' => '797e4876',
|
||||
'rsrc/js/application/herald/HeraldRuleEditor.js' => '6c2dffcc',
|
||||
'rsrc/js/application/herald/PathTypeahead.js' => 'f7fc67ec',
|
||||
'rsrc/js/application/herald/herald-rule-editor.js' => '7ebaeed3',
|
||||
'rsrc/js/application/maniphest/behavior-batch-editor.js' => '782ab6e7',
|
||||
|
@ -538,7 +538,7 @@ return array(
|
|||
'global-drag-and-drop-css' => '697324ad',
|
||||
'harbormaster-css' => '49d64eb4',
|
||||
'herald-css' => '826075fa',
|
||||
'herald-rule-editor' => '797e4876',
|
||||
'herald-rule-editor' => '6c2dffcc',
|
||||
'herald-test-css' => '778b008e',
|
||||
'inline-comment-summary-css' => '51efda3a',
|
||||
'javelin-aphlict' => '5359e785',
|
||||
|
@ -1338,6 +1338,15 @@ return array(
|
|||
'javelin-install',
|
||||
'javelin-util',
|
||||
),
|
||||
'6c2dffcc' => array(
|
||||
'multirow-row-manager',
|
||||
'javelin-install',
|
||||
'javelin-util',
|
||||
'javelin-dom',
|
||||
'javelin-stratcom',
|
||||
'javelin-json',
|
||||
'phabricator-prefab',
|
||||
),
|
||||
'6c53634d' => array(
|
||||
'javelin-install',
|
||||
'javelin-event',
|
||||
|
@ -1416,15 +1425,6 @@ return array(
|
|||
'javelin-behavior',
|
||||
'javelin-quicksand',
|
||||
),
|
||||
'797e4876' => array(
|
||||
'multirow-row-manager',
|
||||
'javelin-install',
|
||||
'javelin-util',
|
||||
'javelin-dom',
|
||||
'javelin-stratcom',
|
||||
'javelin-json',
|
||||
'phabricator-prefab',
|
||||
),
|
||||
'7a68dda3' => array(
|
||||
'owners-path-editor',
|
||||
'javelin-behavior',
|
||||
|
|
|
@ -1057,6 +1057,7 @@ phutil_register_library_map(array(
|
|||
'HeraldSubscribersField' => 'applications/subscriptions/herald/HeraldSubscribersField.php',
|
||||
'HeraldTestConsoleController' => 'applications/herald/controller/HeraldTestConsoleController.php',
|
||||
'HeraldTextFieldValue' => 'applications/herald/value/HeraldTextFieldValue.php',
|
||||
'HeraldTokenizerFieldValue' => 'applications/herald/value/HeraldTokenizerFieldValue.php',
|
||||
'HeraldTransactionQuery' => 'applications/herald/query/HeraldTransactionQuery.php',
|
||||
'HeraldTranscript' => 'applications/herald/storage/transcript/HeraldTranscript.php',
|
||||
'HeraldTranscriptController' => 'applications/herald/controller/HeraldTranscriptController.php',
|
||||
|
@ -4664,6 +4665,7 @@ phutil_register_library_map(array(
|
|||
'HeraldSubscribersField' => 'HeraldField',
|
||||
'HeraldTestConsoleController' => 'HeraldController',
|
||||
'HeraldTextFieldValue' => 'HeraldFieldValue',
|
||||
'HeraldTokenizerFieldValue' => 'HeraldFieldValue',
|
||||
'HeraldTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
||||
'HeraldTranscript' => array(
|
||||
'HeraldDAO',
|
||||
|
|
|
@ -17,8 +17,8 @@ final class DifferentialDiffAuthorHeraldField
|
|||
return self::STANDARD_PHID;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
return HeraldAdapter::VALUE_USER;
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorPeopleDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,14 +19,8 @@ final class DifferentialDiffAuthorProjectsHeraldField
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectOrUserDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,14 +23,8 @@ final class DifferentialDiffRepositoryHeraldField
|
|||
return self::STANDARD_PHID_NULLABLE;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_REPOSITORY;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new DiffusionRepositoryDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,14 +24,8 @@ final class DifferentialDiffRepositoryProjectsHeraldField
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ final class DifferentialRevisionAuthorHeraldField
|
|||
return self::STANDARD_PHID;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
return HeraldAdapter::VALUE_USER;
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorPeopleDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,14 +19,8 @@ final class DifferentialRevisionAuthorProjectsHeraldField
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,14 +18,8 @@ final class DifferentialRevisionPackageHeraldField
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_OWNERS_PACKAGE;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorOwnersPackageDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,14 +23,8 @@ final class DifferentialRevisionPackageOwnerHeraldField
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_USER_OR_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectOrUserDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,14 +23,8 @@ final class DifferentialRevisionRepositoryHeraldField
|
|||
return self::STANDARD_PHID_NULLABLE;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_REPOSITORY;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new DiffusionRepositoryDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,14 +24,8 @@ final class DifferentialRevisionRepositoryProjectsHeraldField
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,14 +17,8 @@ final class DifferentialRevisionReviewersHeraldField
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_USER_OR_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectOrUserDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,14 +17,8 @@ final class DiffusionCommitAuthorHeraldField
|
|||
return self::STANDARD_PHID_NULLABLE;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_USER;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorPeopleDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ final class DiffusionCommitAutocloseHeraldField
|
|||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
return new HeraldEmptyFieldValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,14 +17,8 @@ final class DiffusionCommitCommitterHeraldField
|
|||
return self::STANDARD_PHID_NULLABLE;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_USER;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorPeopleDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,14 +22,8 @@ final class DiffusionCommitPackageAuditHeraldField
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_OWNERS_PACKAGE;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorOwnersPackageDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,14 +18,8 @@ final class DiffusionCommitPackageHeraldField
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_OWNERS_PACKAGE;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorOwnersPackageDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,14 +24,8 @@ final class DiffusionCommitPackageOwnerHeraldField
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_USER_OR_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectOrUserDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ final class DiffusionCommitRepositoryHeraldField
|
|||
return self::STANDARD_PHID;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
return HeraldAdapter::VALUE_REPOSITORY;
|
||||
protected function getDatasource() {
|
||||
return new DiffusionRepositoryDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,14 +19,8 @@ final class DiffusionCommitRepositoryProjectsHeraldField
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,14 +17,8 @@ final class DiffusionCommitReviewerHeraldField
|
|||
return self::STANDARD_PHID_NULLABLE;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_USER;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorPeopleDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,14 +23,8 @@ final class DiffusionCommitRevisionReviewersHeraldField
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_USER_OR_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectOrUserDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,14 +24,8 @@ final class DiffusionCommitRevisionSubscribersHeraldField
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_USER_OR_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectOrUserDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,14 +17,8 @@ final class DiffusionPreCommitContentAuthorHeraldField
|
|||
return self::STANDARD_PHID_NULLABLE;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_USER;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorPeopleDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,14 +17,8 @@ final class DiffusionPreCommitContentCommitterHeraldField
|
|||
return self::STANDARD_PHID_NULLABLE;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_USER;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorPeopleDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ final class DiffusionPreCommitContentPusherHeraldField
|
|||
return HeraldField::STANDARD_PHID;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
return HeraldAdapter::VALUE_USER;
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorPeopleDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,13 +19,8 @@ final class DiffusionPreCommitContentPusherProjectsHeraldField
|
|||
return HeraldField::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ final class DiffusionPreCommitContentRepositoryHeraldField
|
|||
return HeraldField::STANDARD_PHID;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
return HeraldAdapter::VALUE_REPOSITORY;
|
||||
protected function getDatasource() {
|
||||
return new DiffusionRepositoryDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,14 +19,8 @@ final class DiffusionPreCommitContentRepositoryProjectsHeraldField
|
|||
return HeraldField::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,14 +23,8 @@ final class DiffusionPreCommitContentRevisionReviewersHeraldField
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_USER_OR_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectOrUserDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,14 +24,8 @@ final class DiffusionPreCommitContentRevisionSubscribersHeraldField
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_USER_OR_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectOrUserDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ final class DiffusionPreCommitRefPusherHeraldField
|
|||
return HeraldField::STANDARD_PHID;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
return HeraldAdapter::VALUE_USER;
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorPeopleDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,13 +19,8 @@ final class DiffusionPreCommitRefPusherProjectsHeraldField
|
|||
return HeraldField::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ final class DiffusionPreCommitRefRepositoryHeraldField
|
|||
return HeraldField::STANDARD_PHID;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
return HeraldAdapter::VALUE_REPOSITORY;
|
||||
protected function getDatasource() {
|
||||
return new DiffusionRepositoryDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,14 +19,8 @@ final class DiffusionPreCommitRefRepositoryProjectsHeraldField
|
|||
return HeraldField::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,21 +41,6 @@ abstract class HeraldAdapter extends Phobject {
|
|||
const ACTION_BLOCK = 'block';
|
||||
const ACTION_REQUIRE_SIGNATURE = 'signature';
|
||||
|
||||
const VALUE_NONE = 'none';
|
||||
const VALUE_EMAIL = 'email';
|
||||
const VALUE_USER = 'user';
|
||||
const VALUE_RULE = 'rule';
|
||||
const VALUE_REPOSITORY = 'repository';
|
||||
const VALUE_OWNERS_PACKAGE = 'package';
|
||||
const VALUE_PROJECT = 'project';
|
||||
const VALUE_USER_OR_PROJECT = 'userorproject';
|
||||
const VALUE_BUILD_PLAN = 'buildplan';
|
||||
const VALUE_TASK_PRIORITY = 'taskpriority';
|
||||
const VALUE_TASK_STATUS = 'taskstatus';
|
||||
const VALUE_LEGAL_DOCUMENTS = 'legaldocuments';
|
||||
const VALUE_APPLICATION_EMAIL = 'applicationemail';
|
||||
const VALUE_SPACE = 'space';
|
||||
|
||||
private $contentSource;
|
||||
private $isNewObject;
|
||||
private $applicationEmail;
|
||||
|
@ -761,36 +746,43 @@ abstract class HeraldAdapter extends Phobject {
|
|||
case self::ACTION_ASSIGN_TASK:
|
||||
case self::ACTION_ADD_REVIEWERS:
|
||||
case self::ACTION_ADD_BLOCKING_REVIEWERS:
|
||||
return self::VALUE_NONE;
|
||||
return new HeraldEmptyFieldValue();
|
||||
case self::ACTION_FLAG:
|
||||
return $this->buildFlagColorFieldValue();
|
||||
case self::ACTION_ADD_PROJECTS:
|
||||
case self::ACTION_REMOVE_PROJECTS:
|
||||
return self::VALUE_PROJECT;
|
||||
return $this->buildTokenizerFieldValue(
|
||||
new PhabricatorProjectDatasource());
|
||||
}
|
||||
} else {
|
||||
switch ($action) {
|
||||
case self::ACTION_ADD_CC:
|
||||
case self::ACTION_REMOVE_CC:
|
||||
case self::ACTION_EMAIL:
|
||||
return self::VALUE_EMAIL;
|
||||
return $this->buildTokenizerFieldValue(
|
||||
new PhabricatorMetaMTAMailableDatasource());
|
||||
case self::ACTION_NOTHING:
|
||||
return self::VALUE_NONE;
|
||||
return new HeraldEmptyFieldValue();
|
||||
case self::ACTION_ADD_PROJECTS:
|
||||
case self::ACTION_REMOVE_PROJECTS:
|
||||
return self::VALUE_PROJECT;
|
||||
return $this->buildTokenizerFieldValue(
|
||||
new PhabricatorProjectDatasource());
|
||||
case self::ACTION_FLAG:
|
||||
return $this->buildFlagColorFieldValue();
|
||||
case self::ACTION_ASSIGN_TASK:
|
||||
return self::VALUE_USER;
|
||||
return $this->buildTokenizerFieldValue(
|
||||
new PhabricatorPeopleDatasource());
|
||||
case self::ACTION_AUDIT:
|
||||
case self::ACTION_ADD_REVIEWERS:
|
||||
case self::ACTION_ADD_BLOCKING_REVIEWERS:
|
||||
return self::VALUE_USER_OR_PROJECT;
|
||||
return $this->buildTokenizerFieldValue(
|
||||
new PhabricatorProjectOrUserDatasource());
|
||||
case self::ACTION_APPLY_BUILD_PLANS:
|
||||
return self::VALUE_BUILD_PLAN;
|
||||
return $this->buildTokenizerFieldValue(
|
||||
new HarbormasterBuildPlanDatasource());
|
||||
case self::ACTION_REQUIRE_SIGNATURE:
|
||||
return self::VALUE_LEGAL_DOCUMENTS;
|
||||
return $this->buildTokenizerFieldValue(
|
||||
new LegalpadDocumentDatasource());
|
||||
case self::ACTION_BLOCK:
|
||||
return new HeraldTextFieldValue();
|
||||
}
|
||||
|
@ -811,6 +803,16 @@ abstract class HeraldAdapter extends Phobject {
|
|||
->setDefault(PhabricatorFlagColor::COLOR_BLUE);
|
||||
}
|
||||
|
||||
private function buildTokenizerFieldValue(
|
||||
PhabricatorTypeaheadDatasource $datasource) {
|
||||
|
||||
$key = 'action.'.get_class($datasource);
|
||||
|
||||
return id(new HeraldTokenizerFieldValue())
|
||||
->setKey($key)
|
||||
->setDatasource($datasource);
|
||||
}
|
||||
|
||||
/* -( Repetition )--------------------------------------------------------- */
|
||||
|
||||
|
||||
|
|
|
@ -458,6 +458,8 @@ final class HeraldRuleController extends HeraldController {
|
|||
$condition);
|
||||
|
||||
if ($value_key instanceof HeraldFieldValue) {
|
||||
$value_key->setViewer($this->getViewer());
|
||||
|
||||
$spec = $value_key->getControlSpecificationDictionary();
|
||||
$value_key = $value_key->getFieldValueKey();
|
||||
$config_info['valueMap'][$value_key] = $spec;
|
||||
|
@ -479,6 +481,8 @@ final class HeraldRuleController extends HeraldController {
|
|||
}
|
||||
|
||||
if ($value_key instanceof HeraldFieldValue) {
|
||||
$value_key->setViewer($this->getViewer());
|
||||
|
||||
$spec = $value_key->getControlSpecificationDictionary();
|
||||
$value_key = $value_key->getFieldValueKey();
|
||||
$config_info['valueMap'][$value_key] = $spec;
|
||||
|
@ -493,7 +497,7 @@ final class HeraldRuleController extends HeraldController {
|
|||
'root' => 'herald-rule-edit-form',
|
||||
'conditions' => (object)$serial_conditions,
|
||||
'actions' => (object)$serial_actions,
|
||||
'template' => $this->buildTokenizerTemplates($handles) + array(
|
||||
'template' => $this->buildTokenizerTemplates() + array(
|
||||
'rules' => $all_rules,
|
||||
),
|
||||
'info' => $config_info,
|
||||
|
@ -576,39 +580,10 @@ final class HeraldRuleController extends HeraldController {
|
|||
}
|
||||
|
||||
|
||||
protected function buildTokenizerTemplates(array $handles) {
|
||||
protected function buildTokenizerTemplates() {
|
||||
$template = new AphrontTokenizerTemplateView();
|
||||
$template = $template->render();
|
||||
|
||||
$sources = array(
|
||||
'repository' => new DiffusionRepositoryDatasource(),
|
||||
'legaldocuments' => new LegalpadDocumentDatasource(),
|
||||
'taskpriority' => new ManiphestTaskPriorityDatasource(),
|
||||
'taskstatus' => new ManiphestTaskStatusDatasource(),
|
||||
'buildplan' => new HarbormasterBuildPlanDatasource(),
|
||||
'package' => new PhabricatorOwnersPackageDatasource(),
|
||||
'project' => new PhabricatorProjectDatasource(),
|
||||
'user' => new PhabricatorPeopleDatasource(),
|
||||
'email' => new PhabricatorMetaMTAMailableDatasource(),
|
||||
'userorproject' => new PhabricatorProjectOrUserDatasource(),
|
||||
'applicationemail' => new PhabricatorMetaMTAApplicationEmailDatasource(),
|
||||
'space' => new PhabricatorSpacesNamespaceDatasource(),
|
||||
);
|
||||
|
||||
foreach ($sources as $key => $source) {
|
||||
$source->setViewer($this->getViewer());
|
||||
|
||||
$sources[$key] = array(
|
||||
'uri' => $source->getDatasourceURI(),
|
||||
'placeholder' => $source->getPlaceholderText(),
|
||||
'browseURI' => $source->getBrowseURI(),
|
||||
);
|
||||
}
|
||||
|
||||
return array(
|
||||
'source' => $sources,
|
||||
'username' => $this->getRequest()->getUser()->getUserName(),
|
||||
'icons' => mpull($handles, 'getTypeIcon', 'getPHID'),
|
||||
'markup' => $template,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ final class HeraldAlwaysField extends HeraldField {
|
|||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
return new HeraldEmptyFieldValue();
|
||||
}
|
||||
|
||||
public function supportsObject($object) {
|
||||
|
|
|
@ -24,8 +24,11 @@ final class HeraldAnotherRuleField extends HeraldField {
|
|||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
return HeraldAdapter::VALUE_RULE;
|
||||
// NOTE: This is a bit magical because we don't currently have a reasonable
|
||||
// way to populate it from here.
|
||||
return id(new HeraldSelectFieldValue())
|
||||
->setKey(self::FIELDCONST)
|
||||
->setOptions(array());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -20,6 +20,10 @@ abstract class HeraldField extends Phobject {
|
|||
throw new PhutilMethodNotImplementedException();
|
||||
}
|
||||
|
||||
protected function getDatasource() {
|
||||
throw new PhutilMethodNotImplementedException();
|
||||
}
|
||||
|
||||
public function getHeraldFieldConditions() {
|
||||
$standard_type = $this->getHeraldFieldStandardType();
|
||||
switch ($standard_type) {
|
||||
|
@ -91,6 +95,20 @@ abstract class HeraldField extends Phobject {
|
|||
case self::STANDARD_TEXT_LIST:
|
||||
case self::STANDARD_TEXT_MAP:
|
||||
return new HeraldTextFieldValue();
|
||||
case self::STANDARD_PHID:
|
||||
case self::STANDARD_PHID_NULLABLE:
|
||||
case self::STANDARD_PHID_LIST:
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return new HeraldEmptyFieldValue();
|
||||
default:
|
||||
return id(new HeraldTokenizerFieldValue())
|
||||
->setKey($this->getHeraldFieldName())
|
||||
->setDatasource($this->getDatasource());
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
throw new Exception(
|
||||
|
@ -113,7 +131,8 @@ abstract class HeraldField extends Phobject {
|
|||
|
||||
$value_type = $this->getHeraldFieldValueType($condition);
|
||||
if ($value_type instanceof HeraldFieldValue) {
|
||||
return $value_type->renderValue($viewer, $value);
|
||||
$value_type->setViewer($viewer);
|
||||
return $value_type->renderFieldValue($value);
|
||||
}
|
||||
|
||||
// TODO: While this is less of a mess than it used to be, it would still
|
||||
|
|
|
@ -11,7 +11,7 @@ final class HeraldEmptyFieldValue
|
|||
return self::CONTROL_NONE;
|
||||
}
|
||||
|
||||
public function renderValue(PhabricatorUser $viewer, $value) {
|
||||
public function renderFieldValue($value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
abstract class HeraldFieldValue extends Phobject {
|
||||
|
||||
private $viewer;
|
||||
|
||||
const CONTROL_NONE = 'herald.control.none';
|
||||
const CONTROL_TEXT = 'herald.control.text';
|
||||
const CONTROL_SELECT = 'herald.control.select';
|
||||
|
@ -9,10 +11,20 @@ abstract class HeraldFieldValue extends Phobject {
|
|||
|
||||
abstract public function getFieldValueKey();
|
||||
abstract public function getControlType();
|
||||
abstract public function renderValue(PhabricatorUser $viewer, $value);
|
||||
abstract public function renderFieldValue($value);
|
||||
|
||||
public function setViewer(PhabricatorUser $viewer) {
|
||||
$this->viewer = $viewer;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getViewer() {
|
||||
return $this->viewer;
|
||||
}
|
||||
|
||||
final public function getControlSpecificationDictionary() {
|
||||
return array(
|
||||
'key' => $this->getFieldValueKey(),
|
||||
'control' => $this->getControlType(),
|
||||
'template' => $this->getControlTemplate(),
|
||||
);
|
||||
|
|
|
@ -56,7 +56,7 @@ final class HeraldSelectFieldValue
|
|||
);
|
||||
}
|
||||
|
||||
public function renderValue(PhabricatorUser $viewer, $value) {
|
||||
public function renderFieldValue($value) {
|
||||
$options = $this->getOptions();
|
||||
return idx($options, $value, $value);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ final class HeraldTextFieldValue
|
|||
}
|
||||
|
||||
|
||||
public function renderValue(PhabricatorUser $viewer, $value) {
|
||||
public function renderFieldValue($value) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
|
60
src/applications/herald/value/HeraldTokenizerFieldValue.php
Normal file
60
src/applications/herald/value/HeraldTokenizerFieldValue.php
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
final class HeraldTokenizerFieldValue
|
||||
extends HeraldFieldValue {
|
||||
|
||||
private $key;
|
||||
private $datasource;
|
||||
|
||||
public function setKey($key) {
|
||||
$this->key = $key;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getKey() {
|
||||
return $this->key;
|
||||
}
|
||||
|
||||
public function setDatasource(PhabricatorTypeaheadDatasource $datasource) {
|
||||
$this->datasource = $datasource;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDatasource() {
|
||||
return $this->datasource;
|
||||
}
|
||||
|
||||
public function getFieldValueKey() {
|
||||
if ($this->getKey() === null) {
|
||||
throw new PhutilInvalidStateException('setKey');
|
||||
}
|
||||
return 'tokenizer.'.$this->getKey();
|
||||
}
|
||||
|
||||
public function getControlType() {
|
||||
return self::CONTROL_TOKENIZER;
|
||||
}
|
||||
|
||||
protected function getControlTemplate() {
|
||||
if ($this->getDatasource() === null) {
|
||||
throw new PhutilInvalidStateException('setDatasource');
|
||||
}
|
||||
|
||||
$datasource = $this->getDatasource();
|
||||
$datasource->setViewer($this->getViewer());
|
||||
|
||||
return array(
|
||||
'tokenizer' => array(
|
||||
'datasourceURI' => $datasource->getDatasourceURI(),
|
||||
'browseURI' => $datasource->getBrowseURI(),
|
||||
'placeholder' => $datasource->getPlaceholderText(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function renderFieldValue($value) {
|
||||
$viewer = $this->getViewer();
|
||||
return $viewer->renderHandleList((array)$value)->setAsInline(true);
|
||||
}
|
||||
|
||||
}
|
|
@ -17,14 +17,8 @@ final class ManiphestTaskAssigneeHeraldField
|
|||
return self::STANDARD_PHID_NULLABLE;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_USER;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorPeopleDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ final class ManiphestTaskAuthorHeraldField
|
|||
return self::STANDARD_PHID;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
return HeraldAdapter::VALUE_USER;
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorPeopleDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ final class ManiphestTaskPriorityHeraldField
|
|||
return self::STANDARD_PHID;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
return HeraldAdapter::VALUE_TASK_PRIORITY;
|
||||
protected function getDatasource() {
|
||||
return new ManiphestTaskPriorityDatasource();
|
||||
}
|
||||
|
||||
public function renderConditionValue(
|
||||
|
|
|
@ -17,8 +17,8 @@ final class ManiphestTaskStatusHeraldField
|
|||
return self::STANDARD_PHID;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
return HeraldAdapter::VALUE_TASK_STATUS;
|
||||
protected function getDatasource() {
|
||||
return new ManiphestTaskStatusDatasource();
|
||||
}
|
||||
|
||||
public function renderConditionValue(
|
||||
|
|
|
@ -28,14 +28,8 @@ final class PhabricatorMetaMTAApplicationEmailHeraldField
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_APPLICATION_EMAIL;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorMetaMTAApplicationEmailDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ final class PholioMockAuthorHeraldField
|
|||
return self::STANDARD_PHID;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
return HeraldAdapter::VALUE_USER;
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorPeopleDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ final class PhrictionDocumentAuthorHeraldField
|
|||
return self::STANDARD_PHID;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
return HeraldAdapter::VALUE_USER;
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorPeopleDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,14 +22,8 @@ final class HeraldProjectsField extends HeraldField {
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ final class HeraldSpaceField extends HeraldField {
|
|||
return self::STANDARD_PHID;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
return HeraldAdapter::VALUE_SPACE;
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorSpacesNamespaceDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,14 +21,8 @@ final class HeraldSubscribersField extends HeraldField {
|
|||
return self::STANDARD_PHID_LIST;
|
||||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
switch ($condition) {
|
||||
case HeraldAdapter::CONDITION_EXISTS:
|
||||
case HeraldAdapter::CONDITION_NOT_EXISTS:
|
||||
return HeraldAdapter::VALUE_NONE;
|
||||
default:
|
||||
return HeraldAdapter::VALUE_USER_OR_PROJECT;
|
||||
}
|
||||
protected function getDatasource() {
|
||||
return new PhabricatorProjectOrUserDatasource();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,9 @@ final class PhabricatorStandardCustomFieldUsers
|
|||
}
|
||||
|
||||
public function getHeraldFieldValueType($condition) {
|
||||
return HeraldAdapter::VALUE_USER;
|
||||
return id(new HeraldTokenizerFieldValue())
|
||||
->setKey('custom.'.$this->getFieldKey())
|
||||
->setDatasource(new PhabricatorPeopleDatasource());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -200,7 +200,9 @@ JX.install('HeraldRuleEditor', {
|
|||
return node;
|
||||
},
|
||||
|
||||
_buildStandardInput: function(spec) {
|
||||
_buildInput : function(type) {
|
||||
var spec = this._config.info.valueMap[type];
|
||||
|
||||
var input;
|
||||
var get_fn;
|
||||
var set_fn;
|
||||
|
@ -216,7 +218,18 @@ JX.install('HeraldRuleEditor', {
|
|||
set_fn = function(v) { input.value = v; };
|
||||
break;
|
||||
case 'herald.control.select':
|
||||
input = this._renderSelect(spec.template.options);
|
||||
var options;
|
||||
|
||||
// NOTE: This is a hacky special case for "Another Herald Rule",
|
||||
// which we don't currently generate normal options for.
|
||||
|
||||
if (spec.key == 'select.rule') {
|
||||
options = this._config.template.rules;
|
||||
} else {
|
||||
options = spec.template.options;
|
||||
}
|
||||
|
||||
input = this._renderSelect(options);
|
||||
get_fn = function() { return input.value; };
|
||||
set_fn = function(v) { input.value = v; };
|
||||
if (spec.template.default) {
|
||||
|
@ -224,7 +237,7 @@ JX.install('HeraldRuleEditor', {
|
|||
}
|
||||
break;
|
||||
case 'herald.control.tokenizer':
|
||||
var tokenizer = this._newTokenizer(spec.template.tokenizer, true);
|
||||
var tokenizer = this._newTokenizer(spec.template.tokenizer);
|
||||
input = tokenizer[0];
|
||||
get_fn = tokenizer[1];
|
||||
set_fn = tokenizer[2];
|
||||
|
@ -237,48 +250,6 @@ JX.install('HeraldRuleEditor', {
|
|||
return [input, get_fn, set_fn];
|
||||
},
|
||||
|
||||
_buildInput : function(type) {
|
||||
if (this._config.info.valueMap[type]) {
|
||||
return this._buildStandardInput(this._config.info.valueMap[type]);
|
||||
}
|
||||
|
||||
var input;
|
||||
var get_fn;
|
||||
var set_fn;
|
||||
switch (type) {
|
||||
case 'rule':
|
||||
input = this._renderSelect(this._config.template.rules);
|
||||
get_fn = function() { return input.value; };
|
||||
set_fn = function(v) { input.value = v; };
|
||||
break;
|
||||
case 'email':
|
||||
case 'user':
|
||||
case 'repository':
|
||||
case 'tag':
|
||||
case 'package':
|
||||
case 'project':
|
||||
case 'userorproject':
|
||||
case 'buildplan':
|
||||
case 'taskpriority':
|
||||
case 'taskstatus':
|
||||
case 'legaldocuments':
|
||||
case 'applicationemail':
|
||||
case 'space':
|
||||
var tokenizer = this._newTokenizer(type);
|
||||
input = tokenizer[0];
|
||||
get_fn = tokenizer[1];
|
||||
set_fn = tokenizer[2];
|
||||
break;
|
||||
default:
|
||||
input = JX.$N('input', {type: 'text'});
|
||||
get_fn = function() { return input.value; };
|
||||
set_fn = function(v) { input.value = v; };
|
||||
break;
|
||||
}
|
||||
|
||||
return [input, get_fn, set_fn];
|
||||
},
|
||||
|
||||
_renderValueInputForRow : function(row_id) {
|
||||
var cond = this._config.conditions[row_id];
|
||||
var type = this._config.info.values[cond[0]][cond[1]];
|
||||
|
@ -303,20 +274,12 @@ JX.install('HeraldRuleEditor', {
|
|||
return node;
|
||||
},
|
||||
|
||||
_newTokenizer : function(type, is_config) {
|
||||
var tokenizerConfig;
|
||||
|
||||
if (is_config) {
|
||||
tokenizerConfig = type;
|
||||
} else {
|
||||
tokenizerConfig = {
|
||||
src : this._config.template.source[type].uri,
|
||||
placeholder: this._config.template.source[type].placeholder,
|
||||
browseURI: this._config.template.source[type].browseURI,
|
||||
icons : this._config.template.icons,
|
||||
username : this._config.username
|
||||
_newTokenizer : function(spec) {
|
||||
var tokenizerConfig = {
|
||||
src: spec.datasourceURI,
|
||||
placeholder: spec.placeholder,
|
||||
browseURI: spec.browseURI
|
||||
};
|
||||
}
|
||||
|
||||
var build = JX.Prefab.newTokenizerFromTemplate(
|
||||
this._config.template.markup,
|
||||
|
|
Loading…
Reference in a new issue