1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 12:52:42 +01:00

Group and order Herald fields

Summary:
Ref T8726. Some adapters now have a large number of fields, and we lost the sort-of-human-readable implicit ordering when fields were modularized.

Instead, group and sort fields.

Test Plan: {F603066}

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T8726

Differential Revision: https://secure.phabricator.com/D13619
This commit is contained in:
epriestley 2015-07-16 14:13:13 -07:00
parent 97ccd93670
commit 0306eb70ed
69 changed files with 546 additions and 19 deletions

View file

@ -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' => '6c2dffcc',
'rsrc/js/application/herald/HeraldRuleEditor.js' => '52684226',
'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' => '6c2dffcc',
'herald-rule-editor' => '52684226',
'herald-test-css' => '778b008e',
'inline-comment-summary-css' => '51efda3a',
'javelin-aphlict' => '5359e785',
@ -1172,6 +1172,15 @@ return array(
'javelin-dom',
'javelin-reactor-dom',
),
52684226 => array(
'multirow-row-manager',
'javelin-install',
'javelin-util',
'javelin-dom',
'javelin-stratcom',
'javelin-json',
'phabricator-prefab',
),
'5359e785' => array(
'javelin-install',
'javelin-util',
@ -1338,15 +1347,6 @@ 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',

View file

@ -304,6 +304,7 @@ phutil_register_library_map(array(
'DifferentialAuthorField' => 'applications/differential/customfield/DifferentialAuthorField.php',
'DifferentialBlameRevisionField' => 'applications/differential/customfield/DifferentialBlameRevisionField.php',
'DifferentialBranchField' => 'applications/differential/customfield/DifferentialBranchField.php',
'DifferentialChangeHeraldFieldGroup' => 'applications/differential/herald/DifferentialChangeHeraldFieldGroup.php',
'DifferentialChangeType' => 'applications/differential/constants/DifferentialChangeType.php',
'DifferentialChangesSinceLastUpdateField' => 'applications/differential/customfield/DifferentialChangesSinceLastUpdateField.php',
'DifferentialChangeset' => 'applications/differential/storage/DifferentialChangeset.php',
@ -359,6 +360,7 @@ phutil_register_library_map(array(
'DifferentialDiffCreateController' => 'applications/differential/controller/DifferentialDiffCreateController.php',
'DifferentialDiffEditor' => 'applications/differential/editor/DifferentialDiffEditor.php',
'DifferentialDiffHeraldField' => 'applications/differential/herald/DifferentialDiffHeraldField.php',
'DifferentialDiffHeraldFieldGroup' => 'applications/differential/herald/DifferentialDiffHeraldFieldGroup.php',
'DifferentialDiffInlineCommentQuery' => 'applications/differential/query/DifferentialDiffInlineCommentQuery.php',
'DifferentialDiffPHIDType' => 'applications/differential/phid/DifferentialDiffPHIDType.php',
'DifferentialDiffProperty' => 'applications/differential/storage/DifferentialDiffProperty.php',
@ -452,6 +454,7 @@ phutil_register_library_map(array(
'DifferentialRevisionHasReviewerEdgeType' => 'applications/differential/edge/DifferentialRevisionHasReviewerEdgeType.php',
'DifferentialRevisionHasTaskEdgeType' => 'applications/differential/edge/DifferentialRevisionHasTaskEdgeType.php',
'DifferentialRevisionHeraldField' => 'applications/differential/herald/DifferentialRevisionHeraldField.php',
'DifferentialRevisionHeraldFieldGroup' => 'applications/differential/herald/DifferentialRevisionHeraldFieldGroup.php',
'DifferentialRevisionIDField' => 'applications/differential/customfield/DifferentialRevisionIDField.php',
'DifferentialRevisionLandController' => 'applications/differential/controller/DifferentialRevisionLandController.php',
'DifferentialRevisionListController' => 'applications/differential/controller/DifferentialRevisionListController.php',
@ -503,6 +506,7 @@ phutil_register_library_map(array(
'DiffusionBrowseTableView' => 'applications/diffusion/view/DiffusionBrowseTableView.php',
'DiffusionCachedResolveRefsQuery' => 'applications/diffusion/query/DiffusionCachedResolveRefsQuery.php',
'DiffusionChangeController' => 'applications/diffusion/controller/DiffusionChangeController.php',
'DiffusionChangeHeraldFieldGroup' => 'applications/diffusion/herald/DiffusionChangeHeraldFieldGroup.php',
'DiffusionCommitAffectedFilesHeraldField' => 'applications/diffusion/herald/DiffusionCommitAffectedFilesHeraldField.php',
'DiffusionCommitAuthorHeraldField' => 'applications/diffusion/herald/DiffusionCommitAuthorHeraldField.php',
'DiffusionCommitAutocloseHeraldField' => 'applications/diffusion/herald/DiffusionCommitAutocloseHeraldField.php',
@ -520,6 +524,7 @@ phutil_register_library_map(array(
'DiffusionCommitHasTaskEdgeType' => 'applications/diffusion/edge/DiffusionCommitHasTaskEdgeType.php',
'DiffusionCommitHash' => 'applications/diffusion/data/DiffusionCommitHash.php',
'DiffusionCommitHeraldField' => 'applications/diffusion/herald/DiffusionCommitHeraldField.php',
'DiffusionCommitHeraldFieldGroup' => 'applications/diffusion/herald/DiffusionCommitHeraldFieldGroup.php',
'DiffusionCommitHookEngine' => 'applications/diffusion/engine/DiffusionCommitHookEngine.php',
'DiffusionCommitHookRejectException' => 'applications/diffusion/exception/DiffusionCommitHookRejectException.php',
'DiffusionCommitMessageHeraldField' => 'applications/diffusion/herald/DiffusionCommitMessageHeraldField.php',
@ -640,6 +645,7 @@ phutil_register_library_map(array(
'DiffusionPreCommitContentRevisionSubscribersHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitContentRevisionSubscribersHeraldField.php',
'DiffusionPreCommitRefChangeHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitRefChangeHeraldField.php',
'DiffusionPreCommitRefHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitRefHeraldField.php',
'DiffusionPreCommitRefHeraldFieldGroup' => 'applications/diffusion/herald/DiffusionPreCommitRefHeraldFieldGroup.php',
'DiffusionPreCommitRefNameHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitRefNameHeraldField.php',
'DiffusionPreCommitRefPusherHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitRefPusherHeraldField.php',
'DiffusionPreCommitRefPusherProjectsHeraldField' => 'applications/diffusion/herald/DiffusionPreCommitRefPusherProjectsHeraldField.php',
@ -1006,6 +1012,7 @@ phutil_register_library_map(array(
'HeraldAlwaysField' => 'applications/herald/field/HeraldAlwaysField.php',
'HeraldAnotherRuleField' => 'applications/herald/field/HeraldAnotherRuleField.php',
'HeraldApplyTranscript' => 'applications/herald/storage/transcript/HeraldApplyTranscript.php',
'HeraldBasicFieldGroup' => 'applications/herald/field/HeraldBasicFieldGroup.php',
'HeraldCommitAdapter' => 'applications/diffusion/herald/HeraldCommitAdapter.php',
'HeraldCondition' => 'applications/herald/storage/HeraldCondition.php',
'HeraldConditionTranscript' => 'applications/herald/storage/transcript/HeraldConditionTranscript.php',
@ -1017,10 +1024,12 @@ phutil_register_library_map(array(
'HeraldDifferentialDiffAdapter' => 'applications/differential/herald/HeraldDifferentialDiffAdapter.php',
'HeraldDifferentialRevisionAdapter' => 'applications/differential/herald/HeraldDifferentialRevisionAdapter.php',
'HeraldDisableController' => 'applications/herald/controller/HeraldDisableController.php',
'HeraldEditFieldGroup' => 'applications/herald/field/HeraldEditFieldGroup.php',
'HeraldEffect' => 'applications/herald/engine/HeraldEffect.php',
'HeraldEmptyFieldValue' => 'applications/herald/value/HeraldEmptyFieldValue.php',
'HeraldEngine' => 'applications/herald/engine/HeraldEngine.php',
'HeraldField' => 'applications/herald/field/HeraldField.php',
'HeraldFieldGroup' => 'applications/herald/field/HeraldFieldGroup.php',
'HeraldFieldTestCase' => 'applications/herald/field/__tests__/HeraldFieldTestCase.php',
'HeraldFieldValue' => 'applications/herald/value/HeraldFieldValue.php',
'HeraldInvalidActionException' => 'applications/herald/engine/exception/HeraldInvalidActionException.php',
@ -1036,6 +1045,7 @@ phutil_register_library_map(array(
'HeraldPreCommitRefAdapter' => 'applications/diffusion/herald/HeraldPreCommitRefAdapter.php',
'HeraldProjectsField' => 'applications/project/herald/HeraldProjectsField.php',
'HeraldRecursiveConditionsException' => 'applications/herald/engine/exception/HeraldRecursiveConditionsException.php',
'HeraldRelatedFieldGroup' => 'applications/herald/field/HeraldRelatedFieldGroup.php',
'HeraldRemarkupRule' => 'applications/herald/remarkup/HeraldRemarkupRule.php',
'HeraldRepetitionPolicyConfig' => 'applications/herald/config/HeraldRepetitionPolicyConfig.php',
'HeraldRule' => 'applications/herald/storage/HeraldRule.php',
@ -1055,6 +1065,7 @@ phutil_register_library_map(array(
'HeraldSelectFieldValue' => 'applications/herald/value/HeraldSelectFieldValue.php',
'HeraldSpaceField' => 'applications/spaces/herald/HeraldSpaceField.php',
'HeraldSubscribersField' => 'applications/subscriptions/herald/HeraldSubscribersField.php',
'HeraldSupportFieldGroup' => 'applications/herald/field/HeraldSupportFieldGroup.php',
'HeraldTestConsoleController' => 'applications/herald/controller/HeraldTestConsoleController.php',
'HeraldTextFieldValue' => 'applications/herald/value/HeraldTextFieldValue.php',
'HeraldTokenizerFieldValue' => 'applications/herald/value/HeraldTokenizerFieldValue.php',
@ -1181,6 +1192,7 @@ phutil_register_library_map(array(
'ManiphestTaskHasMockEdgeType' => 'applications/maniphest/edge/ManiphestTaskHasMockEdgeType.php',
'ManiphestTaskHasRevisionEdgeType' => 'applications/maniphest/edge/ManiphestTaskHasRevisionEdgeType.php',
'ManiphestTaskHeraldField' => 'applications/maniphest/herald/ManiphestTaskHeraldField.php',
'ManiphestTaskHeraldFieldGroup' => 'applications/maniphest/herald/ManiphestTaskHeraldFieldGroup.php',
'ManiphestTaskListController' => 'applications/maniphest/controller/ManiphestTaskListController.php',
'ManiphestTaskListView' => 'applications/maniphest/view/ManiphestTaskListView.php',
'ManiphestTaskMailReceiver' => 'applications/maniphest/mail/ManiphestTaskMailReceiver.php',
@ -1799,6 +1811,7 @@ phutil_register_library_map(array(
'PhabricatorCustomFieldConfigOptionType' => 'infrastructure/customfield/config/PhabricatorCustomFieldConfigOptionType.php',
'PhabricatorCustomFieldDataNotAvailableException' => 'infrastructure/customfield/exception/PhabricatorCustomFieldDataNotAvailableException.php',
'PhabricatorCustomFieldHeraldField' => 'infrastructure/customfield/herald/PhabricatorCustomFieldHeraldField.php',
'PhabricatorCustomFieldHeraldFieldGroup' => 'infrastructure/customfield/herald/PhabricatorCustomFieldHeraldFieldGroup.php',
'PhabricatorCustomFieldImplementationIncompleteException' => 'infrastructure/customfield/exception/PhabricatorCustomFieldImplementationIncompleteException.php',
'PhabricatorCustomFieldIndexStorage' => 'infrastructure/customfield/storage/PhabricatorCustomFieldIndexStorage.php',
'PhabricatorCustomFieldInterface' => 'infrastructure/customfield/interface/PhabricatorCustomFieldInterface.php',
@ -3059,6 +3072,7 @@ phutil_register_library_map(array(
'PholioMockEmbedView' => 'applications/pholio/view/PholioMockEmbedView.php',
'PholioMockHasTaskEdgeType' => 'applications/pholio/edge/PholioMockHasTaskEdgeType.php',
'PholioMockHeraldField' => 'applications/pholio/herald/PholioMockHeraldField.php',
'PholioMockHeraldFieldGroup' => 'applications/pholio/herald/PholioMockHeraldFieldGroup.php',
'PholioMockImagesView' => 'applications/pholio/view/PholioMockImagesView.php',
'PholioMockListController' => 'applications/pholio/controller/PholioMockListController.php',
'PholioMockMailReceiver' => 'applications/pholio/mail/PholioMockMailReceiver.php',
@ -3246,6 +3260,7 @@ phutil_register_library_map(array(
'PhrictionDocumentController' => 'applications/phriction/controller/PhrictionDocumentController.php',
'PhrictionDocumentHeraldAdapter' => 'applications/phriction/herald/PhrictionDocumentHeraldAdapter.php',
'PhrictionDocumentHeraldField' => 'applications/phriction/herald/PhrictionDocumentHeraldField.php',
'PhrictionDocumentHeraldFieldGroup' => 'applications/phriction/herald/PhrictionDocumentHeraldFieldGroup.php',
'PhrictionDocumentPHIDType' => 'applications/phriction/phid/PhrictionDocumentPHIDType.php',
'PhrictionDocumentPathHeraldField' => 'applications/phriction/herald/PhrictionDocumentPathHeraldField.php',
'PhrictionDocumentQuery' => 'applications/phriction/query/PhrictionDocumentQuery.php',
@ -3800,6 +3815,7 @@ phutil_register_library_map(array(
'DifferentialAuthorField' => 'DifferentialCustomField',
'DifferentialBlameRevisionField' => 'DifferentialStoredCustomField',
'DifferentialBranchField' => 'DifferentialCustomField',
'DifferentialChangeHeraldFieldGroup' => 'HeraldFieldGroup',
'DifferentialChangeType' => 'Phobject',
'DifferentialChangesSinceLastUpdateField' => 'DifferentialCustomField',
'DifferentialChangeset' => array(
@ -3864,6 +3880,7 @@ phutil_register_library_map(array(
'DifferentialDiffCreateController' => 'DifferentialController',
'DifferentialDiffEditor' => 'PhabricatorApplicationTransactionEditor',
'DifferentialDiffHeraldField' => 'HeraldField',
'DifferentialDiffHeraldFieldGroup' => 'HeraldFieldGroup',
'DifferentialDiffInlineCommentQuery' => 'PhabricatorDiffInlineCommentQuery',
'DifferentialDiffPHIDType' => 'PhabricatorPHIDType',
'DifferentialDiffProperty' => 'DifferentialDAO',
@ -3977,6 +3994,7 @@ phutil_register_library_map(array(
'DifferentialRevisionHasReviewerEdgeType' => 'PhabricatorEdgeType',
'DifferentialRevisionHasTaskEdgeType' => 'PhabricatorEdgeType',
'DifferentialRevisionHeraldField' => 'HeraldField',
'DifferentialRevisionHeraldFieldGroup' => 'HeraldFieldGroup',
'DifferentialRevisionIDField' => 'DifferentialCustomField',
'DifferentialRevisionLandController' => 'DifferentialController',
'DifferentialRevisionListController' => 'DifferentialController',
@ -4028,6 +4046,7 @@ phutil_register_library_map(array(
'DiffusionBrowseTableView' => 'DiffusionView',
'DiffusionCachedResolveRefsQuery' => 'DiffusionLowLevelQuery',
'DiffusionChangeController' => 'DiffusionController',
'DiffusionChangeHeraldFieldGroup' => 'HeraldFieldGroup',
'DiffusionCommitAffectedFilesHeraldField' => 'DiffusionCommitHeraldField',
'DiffusionCommitAuthorHeraldField' => 'DiffusionCommitHeraldField',
'DiffusionCommitAutocloseHeraldField' => 'DiffusionCommitHeraldField',
@ -4045,6 +4064,7 @@ phutil_register_library_map(array(
'DiffusionCommitHasTaskEdgeType' => 'PhabricatorEdgeType',
'DiffusionCommitHash' => 'Phobject',
'DiffusionCommitHeraldField' => 'HeraldField',
'DiffusionCommitHeraldFieldGroup' => 'HeraldFieldGroup',
'DiffusionCommitHookEngine' => 'Phobject',
'DiffusionCommitHookRejectException' => 'Exception',
'DiffusionCommitMessageHeraldField' => 'DiffusionCommitHeraldField',
@ -4165,6 +4185,7 @@ phutil_register_library_map(array(
'DiffusionPreCommitContentRevisionSubscribersHeraldField' => 'DiffusionPreCommitContentHeraldField',
'DiffusionPreCommitRefChangeHeraldField' => 'DiffusionPreCommitRefHeraldField',
'DiffusionPreCommitRefHeraldField' => 'HeraldField',
'DiffusionPreCommitRefHeraldFieldGroup' => 'HeraldFieldGroup',
'DiffusionPreCommitRefNameHeraldField' => 'DiffusionPreCommitRefHeraldField',
'DiffusionPreCommitRefPusherHeraldField' => 'DiffusionPreCommitRefHeraldField',
'DiffusionPreCommitRefPusherProjectsHeraldField' => 'DiffusionPreCommitRefHeraldField',
@ -4609,6 +4630,7 @@ phutil_register_library_map(array(
'HeraldAlwaysField' => 'HeraldField',
'HeraldAnotherRuleField' => 'HeraldField',
'HeraldApplyTranscript' => 'Phobject',
'HeraldBasicFieldGroup' => 'HeraldFieldGroup',
'HeraldCommitAdapter' => 'HeraldAdapter',
'HeraldCondition' => 'HeraldDAO',
'HeraldConditionTranscript' => 'Phobject',
@ -4620,10 +4642,12 @@ phutil_register_library_map(array(
'HeraldDifferentialDiffAdapter' => 'HeraldDifferentialAdapter',
'HeraldDifferentialRevisionAdapter' => 'HeraldDifferentialAdapter',
'HeraldDisableController' => 'HeraldController',
'HeraldEditFieldGroup' => 'HeraldFieldGroup',
'HeraldEffect' => 'Phobject',
'HeraldEmptyFieldValue' => 'HeraldFieldValue',
'HeraldEngine' => 'Phobject',
'HeraldField' => 'Phobject',
'HeraldFieldGroup' => 'Phobject',
'HeraldFieldTestCase' => 'PhutilTestCase',
'HeraldFieldValue' => 'Phobject',
'HeraldInvalidActionException' => 'Exception',
@ -4639,6 +4663,7 @@ phutil_register_library_map(array(
'HeraldPreCommitRefAdapter' => 'HeraldPreCommitAdapter',
'HeraldProjectsField' => 'HeraldField',
'HeraldRecursiveConditionsException' => 'Exception',
'HeraldRelatedFieldGroup' => 'HeraldFieldGroup',
'HeraldRemarkupRule' => 'PhabricatorObjectRemarkupRule',
'HeraldRepetitionPolicyConfig' => 'Phobject',
'HeraldRule' => array(
@ -4664,6 +4689,7 @@ phutil_register_library_map(array(
'HeraldSelectFieldValue' => 'HeraldFieldValue',
'HeraldSpaceField' => 'HeraldField',
'HeraldSubscribersField' => 'HeraldField',
'HeraldSupportFieldGroup' => 'HeraldFieldGroup',
'HeraldTestConsoleController' => 'HeraldController',
'HeraldTextFieldValue' => 'HeraldFieldValue',
'HeraldTokenizerFieldValue' => 'HeraldFieldValue',
@ -4823,6 +4849,7 @@ phutil_register_library_map(array(
'ManiphestTaskHasMockEdgeType' => 'PhabricatorEdgeType',
'ManiphestTaskHasRevisionEdgeType' => 'PhabricatorEdgeType',
'ManiphestTaskHeraldField' => 'HeraldField',
'ManiphestTaskHeraldFieldGroup' => 'HeraldFieldGroup',
'ManiphestTaskListController' => 'ManiphestController',
'ManiphestTaskListView' => 'ManiphestView',
'ManiphestTaskMailReceiver' => 'PhabricatorObjectMailReceiver',
@ -5531,6 +5558,7 @@ phutil_register_library_map(array(
'PhabricatorCustomFieldConfigOptionType' => 'PhabricatorConfigOptionType',
'PhabricatorCustomFieldDataNotAvailableException' => 'Exception',
'PhabricatorCustomFieldHeraldField' => 'HeraldField',
'PhabricatorCustomFieldHeraldFieldGroup' => 'HeraldFieldGroup',
'PhabricatorCustomFieldImplementationIncompleteException' => 'Exception',
'PhabricatorCustomFieldIndexStorage' => 'PhabricatorLiskDAO',
'PhabricatorCustomFieldList' => 'Phobject',
@ -7021,6 +7049,7 @@ phutil_register_library_map(array(
'PholioMockEmbedView' => 'AphrontView',
'PholioMockHasTaskEdgeType' => 'PhabricatorEdgeType',
'PholioMockHeraldField' => 'HeraldField',
'PholioMockHeraldFieldGroup' => 'HeraldFieldGroup',
'PholioMockImagesView' => 'AphrontView',
'PholioMockListController' => 'PholioController',
'PholioMockMailReceiver' => 'PhabricatorObjectMailReceiver',
@ -7263,6 +7292,7 @@ phutil_register_library_map(array(
'PhrictionDocumentController' => 'PhrictionController',
'PhrictionDocumentHeraldAdapter' => 'HeraldAdapter',
'PhrictionDocumentHeraldField' => 'HeraldField',
'PhrictionDocumentHeraldFieldGroup' => 'HeraldFieldGroup',
'PhrictionDocumentPHIDType' => 'PhabricatorPHIDType',
'PhrictionDocumentPathHeraldField' => 'PhrictionDocumentHeraldField',
'PhrictionDocumentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',

View file

@ -0,0 +1,15 @@
<?php
final class DifferentialChangeHeraldFieldGroup extends HeraldFieldGroup {
const FIELDGROUPKEY = 'differential.change';
public function getGroupLabel() {
return pht('Change Details');
}
protected function getGroupOrder() {
return 1500;
}
}

View file

@ -9,6 +9,10 @@ final class DifferentialDiffAffectedFilesHeraldField
return pht('Affected files');
}
public function getFieldGroupKey() {
return DifferentialChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->loadAffectedPaths();
}

View file

@ -9,6 +9,10 @@ final class DifferentialDiffContentAddedHeraldField
return pht('Added file content');
}
public function getFieldGroupKey() {
return DifferentialChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->loadAddedContentDictionary();
}

View file

@ -9,6 +9,10 @@ final class DifferentialDiffContentHeraldField
return pht('Changed file content');
}
public function getFieldGroupKey() {
return DifferentialChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->loadContentDictionary();
}

View file

@ -9,6 +9,10 @@ final class DifferentialDiffContentRemovedHeraldField
return pht('Removed file content');
}
public function getFieldGroupKey() {
return DifferentialChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->loadRemovedContentDictionary();
}

View file

@ -6,4 +6,8 @@ abstract class DifferentialDiffHeraldField extends HeraldField {
return ($object instanceof DifferentialDiff);
}
public function getFieldGroupKey() {
return DifferentialDiffHeraldFieldGroup::FIELDGROUPKEY;
}
}

View file

@ -0,0 +1,15 @@
<?php
final class DifferentialDiffHeraldFieldGroup extends HeraldFieldGroup {
const FIELDGROUPKEY = 'differential.diff';
public function getGroupLabel() {
return pht('Diff Fields');
}
protected function getGroupOrder() {
return 1000;
}
}

View file

@ -9,6 +9,10 @@ final class DifferentialRevisionAffectedFilesHeraldField
return pht('Affected files');
}
public function getFieldGroupKey() {
return DifferentialChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->loadAffectedPaths();
}

View file

@ -9,6 +9,10 @@ final class DifferentialRevisionContentAddedHeraldField
return pht('Added file content');
}
public function getFieldGroupKey() {
return DifferentialChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->loadAddedContentDictionary();
}

View file

@ -9,6 +9,10 @@ final class DifferentialRevisionContentHeraldField
return pht('Changed file content');
}
public function getFieldGroupKey() {
return DifferentialChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->loadContentDictionary();
}

View file

@ -9,6 +9,10 @@ final class DifferentialRevisionContentRemovedHeraldField
return pht('Removed file content');
}
public function getFieldGroupKey() {
return DifferentialChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->loadRemovedContentDictionary();
}

View file

@ -6,4 +6,8 @@ abstract class DifferentialRevisionHeraldField extends HeraldField {
return ($object instanceof DifferentialRevision);
}
public function getFieldGroupKey() {
return DifferentialRevisionHeraldFieldGroup::FIELDGROUPKEY;
}
}

View file

@ -0,0 +1,15 @@
<?php
final class DifferentialRevisionHeraldFieldGroup extends HeraldFieldGroup {
const FIELDGROUPKEY = 'differential.revision';
public function getGroupLabel() {
return pht('Revision Fields');
}
protected function getGroupOrder() {
return 1000;
}
}

View file

@ -9,6 +9,10 @@ final class DifferentialRevisionPackageHeraldField
return pht('Affected packages');
}
public function getFieldGroupKey() {
return HeraldRelatedFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
$packages = $this->getAdapter()->loadAffectedPackages();
return mpull($packages, 'getPHID');

View file

@ -9,6 +9,10 @@ final class DifferentialRevisionPackageOwnerHeraldField
return pht('Affected package owners');
}
public function getFieldGroupKey() {
return HeraldRelatedFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
$packages = $this->getAdapter()->loadAffectedPackages();
if (!$packages) {

View file

@ -0,0 +1,15 @@
<?php
final class DiffusionChangeHeraldFieldGroup extends HeraldFieldGroup {
const FIELDGROUPKEY = 'diffusion.change';
public function getGroupLabel() {
return pht('Change Details');
}
protected function getGroupOrder() {
return 1500;
}
}

View file

@ -9,6 +9,10 @@ final class DiffusionCommitAffectedFilesHeraldField
return pht('Affected files');
}
public function getFieldGroupKey() {
return DiffusionChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->loadAffectedPaths();
}

View file

@ -9,6 +9,10 @@ final class DiffusionCommitDiffContentAddedHeraldField
return pht('Diff content added');
}
public function getFieldGroupKey() {
return DiffusionChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->loadDiffContent('+');
}

View file

@ -9,6 +9,10 @@ final class DiffusionCommitDiffContentHeraldField
return pht('Diff content');
}
public function getFieldGroupKey() {
return DiffusionChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->loadDiffContent('*');
}

View file

@ -9,6 +9,10 @@ final class DiffusionCommitDiffContentRemovedHeraldField
return pht('Diff content removed');
}
public function getFieldGroupKey() {
return DiffusionChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->loadDiffContent('-');
}

View file

@ -9,6 +9,10 @@ final class DiffusionCommitDiffEnormousHeraldField
return pht('Change is enormous');
}
public function getFieldGroupKey() {
return DiffusionChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->isDiffEnormous();
}

View file

@ -6,4 +6,8 @@ abstract class DiffusionCommitHeraldField extends HeraldField {
return ($object instanceof PhabricatorRepositoryCommit);
}
public function getFieldGroupKey() {
return DiffusionCommitHeraldFieldGroup::FIELDGROUPKEY;
}
}

View file

@ -0,0 +1,15 @@
<?php
final class DiffusionCommitHeraldFieldGroup extends HeraldFieldGroup {
const FIELDGROUPKEY = 'diffusion.commit';
public function getGroupLabel() {
return pht('Commit Fields');
}
protected function getGroupOrder() {
return 1000;
}
}

View file

@ -9,6 +9,10 @@ final class DiffusionCommitPackageAuditHeraldField
return pht('Affected packages that need audit');
}
public function getFieldGroupKey() {
return HeraldRelatedFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
$packages = $this->getAdapter()->loadAuditNeededPackages();
if (!$packages) {

View file

@ -9,6 +9,10 @@ final class DiffusionCommitPackageHeraldField
return pht('Affected packages');
}
public function getFieldGroupKey() {
return HeraldRelatedFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
$packages = $this->getAdapter()->loadAffectedPackages();
return mpull($packages, 'getPHID');

View file

@ -9,6 +9,10 @@ final class DiffusionCommitPackageOwnerHeraldField
return pht('Affected package owners');
}
public function getFieldGroupKey() {
return HeraldRelatedFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
$packages = $this->getAdapter()->loadAffectedPackages();
if (!$packages) {

View file

@ -9,6 +9,10 @@ final class DiffusionCommitRevisionAcceptedHeraldField
return pht('Accepted Differential revision');
}
public function getFieldGroupKey() {
return HeraldRelatedFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
$revision = $this->getAdapter()->loadDifferentialRevision();
if (!$revision) {

View file

@ -9,6 +9,10 @@ final class DiffusionCommitRevisionHeraldField
return pht('Differential revision');
}
public function getFieldGroupKey() {
return HeraldRelatedFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
$revision = $this->getAdapter()->loadDifferentialRevision();

View file

@ -9,6 +9,10 @@ final class DiffusionCommitRevisionReviewersHeraldField
return pht('Differential reviewers');
}
public function getFieldGroupKey() {
return HeraldRelatedFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
$revision = $this->getAdapter()->loadDifferentialRevision();

View file

@ -9,6 +9,10 @@ final class DiffusionCommitRevisionSubscribersHeraldField
return pht('Differential subscribers');
}
public function getFieldGroupKey() {
return HeraldRelatedFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
$revision = $this->getAdapter()->loadDifferentialRevision();

View file

@ -9,6 +9,10 @@ final class DiffusionPreCommitContentAffectedFilesHeraldField
return pht('Affected files');
}
public function getFieldGroupKey() {
return DiffusionChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->getDiffContent('name');
}

View file

@ -9,6 +9,10 @@ final class DiffusionPreCommitContentDiffContentAddedHeraldField
return pht('Added diff content');
}
public function getFieldGroupKey() {
return DiffusionChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->getDiffContent('+');
}

View file

@ -9,6 +9,10 @@ final class DiffusionPreCommitContentDiffContentHeraldField
return pht('Diff content');
}
public function getFieldGroupKey() {
return DiffusionChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->getDiffContent('*');
}

View file

@ -9,6 +9,10 @@ final class DiffusionPreCommitContentDiffContentRemovedHeraldField
return pht('Removed diff content');
}
public function getFieldGroupKey() {
return DiffusionChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->getDiffContent('-');
}

View file

@ -9,6 +9,10 @@ final class DiffusionPreCommitContentDiffEnormousHeraldField
return pht('Diff is enormous');
}
public function getFieldGroupKey() {
return DiffusionChangeHeraldFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->isDiffEnormous();
}

View file

@ -14,4 +14,8 @@ abstract class DiffusionPreCommitContentHeraldField extends HeraldField {
return true;
}
public function getFieldGroupKey() {
return DiffusionCommitHeraldFieldGroup::FIELDGROUPKEY;
}
}

View file

@ -9,6 +9,10 @@ final class DiffusionPreCommitContentRevisionAcceptedHeraldField
return pht('Accepted Differential revision');
}
public function getFieldGroupKey() {
return HeraldRelatedFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
$revision = $this->getAdapter()->getRevision();

View file

@ -9,6 +9,10 @@ final class DiffusionPreCommitContentRevisionHeraldField
return pht('Differential revision');
}
public function getFieldGroupKey() {
return HeraldRelatedFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
$revision = $this->getAdapter()->getRevision();

View file

@ -9,6 +9,10 @@ final class DiffusionPreCommitContentRevisionReviewersHeraldField
return pht('Differential reviewers');
}
public function getFieldGroupKey() {
return HeraldRelatedFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
$revision = $this->getAdapter()->getRevision();

View file

@ -9,6 +9,10 @@ final class DiffusionPreCommitContentRevisionSubscribersHeraldField
return pht('Differential subscribers');
}
public function getFieldGroupKey() {
return HeraldRelatedFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
$revision = $this->getAdapter()->getRevision();

View file

@ -14,4 +14,8 @@ abstract class DiffusionPreCommitRefHeraldField extends HeraldField {
return true;
}
public function getFieldGroupKey() {
return DiffusionPreCommitRefHeraldFieldGroup::FIELDGROUPKEY;
}
}

View file

@ -0,0 +1,15 @@
<?php
final class DiffusionPreCommitRefHeraldFieldGroup extends HeraldFieldGroup {
const FIELDGROUPKEY = 'diffusion.ref';
public function getGroupLabel() {
return pht('Ref Fields');
}
protected function getGroupOrder() {
return 1000;
}
}

View file

@ -312,6 +312,16 @@ abstract class HeraldAdapter extends Phobject {
return mpull($this->getFieldImplementationMap(), 'getHeraldFieldName');
}
public function getFieldGroupKey($field_key) {
$field = $this->getFieldImplementation($field_key);
if (!$field) {
return null;
}
return $field->getFieldGroupKey();
}
/* -( Conditions )--------------------------------------------------------- */

View file

@ -435,14 +435,43 @@ final class HeraldRuleController extends HeraldController {
}
}
$group_map = array();
foreach ($field_map as $field_key => $field_name) {
$group_key = $adapter->getFieldGroupKey($field_key);
$group_map[$group_key][$field_key] = $field_name;
}
$field_groups = HeraldFieldGroup::getAllFieldGroups();
$groups = array();
foreach ($group_map as $group_key => $options) {
asort($options);
$field_group = idx($field_groups, $group_key);
if ($field_group) {
$group_label = $field_group->getGroupLabel();
$group_order = $field_group->getSortKey();
} else {
$group_label = nonempty($group_key, pht('Other'));
$group_order = 'Z';
}
$groups[] = array(
'label' => $group_label,
'options' => $options,
'order' => $group_order,
);
}
$groups = array_values(isort($groups, 'order'));
$config_info = array();
$config_info['fields'] = $field_map;
$config_info['fields'] = $groups;
$config_info['conditions'] = $all_conditions;
$config_info['actions'] = $action_map;
$config_info['valueMap'] = array();
foreach ($config_info['fields'] as $field => $name) {
foreach ($field_map as $field => $name) {
try {
$field_conditions = $adapter->getConditionsForField($field);
} catch (Exception $ex) {
@ -451,7 +480,7 @@ final class HeraldRuleController extends HeraldController {
$config_info['conditionMap'][$field] = $field_conditions;
}
foreach ($config_info['fields'] as $field => $fname) {
foreach ($field_map as $field => $fname) {
foreach ($config_info['conditionMap'][$field] as $condition) {
$value_key = $adapter->getValueTypeForFieldAndCondition(
$field,

View file

@ -8,6 +8,10 @@ final class HeraldAlwaysField extends HeraldField {
return pht('Always');
}
public function getFieldGroupKey() {
return HeraldBasicFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return true;
}

View file

@ -8,6 +8,10 @@ final class HeraldAnotherRuleField extends HeraldField {
return pht('Another Herald rule');
}
public function getFieldGroupKey() {
return HeraldBasicFieldGroup::FIELDGROUPKEY;
}
public function supportsObject($object) {
return true;
}

View file

@ -0,0 +1,15 @@
<?php
final class HeraldBasicFieldGroup extends HeraldFieldGroup {
const FIELDGROUPKEY = 'herald';
public function getGroupLabel() {
return pht('Herald');
}
protected function getGroupOrder() {
return 10000;
}
}

View file

@ -8,6 +8,10 @@ final class HeraldContentSourceField extends HeraldField {
return pht('Content source');
}
public function getFieldGroupKey() {
return HeraldEditFieldGroup::FIELDGROUPKEY;
}
public function getHeraldFieldValue($object) {
return $this->getAdapter()->getContentSource()->getSource();
}

View file

@ -0,0 +1,15 @@
<?php
final class HeraldEditFieldGroup extends HeraldFieldGroup {
const FIELDGROUPKEY = 'edit';
public function getGroupLabel() {
return pht('Edit Attributes');
}
protected function getGroupOrder() {
return 4000;
}
}

View file

@ -16,6 +16,10 @@ abstract class HeraldField extends Phobject {
abstract public function getHeraldFieldName();
abstract public function getHeraldFieldValue($object);
public function getFieldGroupKey() {
return null;
}
protected function getHeraldFieldStandardType() {
throw new PhutilMethodNotImplementedException();
}

View file

@ -0,0 +1,38 @@
<?php
abstract class HeraldFieldGroup extends Phobject {
abstract public function getGroupLabel();
protected function getGroupOrder() {
return 1000;
}
final public function getGroupKey() {
$class = new ReflectionClass($this);
$const = $class->getConstant('FIELDGROUPKEY');
if ($const === false) {
throw new Exception(
pht(
'"%s" class "%s" must define a "%s" property.',
__CLASS__,
get_class($this),
'FIELDCONST'));
}
return $const;
}
public function getSortKey() {
return sprintf('A%08d%s', $this->getGroupOrder(), $this->getGroupLabel());
}
final public static function getAllFieldGroups() {
return id(new PhutilClassMapQuery())
->setAncestorClass(__CLASS__)
->setUniqueMethod('getGroupKey')
->setSortMethod('getSortKey')
->execute();
}
}

View file

@ -8,6 +8,10 @@ final class HeraldNewObjectField extends HeraldField {
return pht('Is newly created');
}
public function getFieldGroupKey() {
return HeraldEditFieldGroup::FIELDGROUPKEY;
}
public function supportsObject($object) {
return !$this->getAdapter()->isSingleEventAdapter();
}

View file

@ -0,0 +1,15 @@
<?php
final class HeraldRelatedFieldGroup extends HeraldFieldGroup {
const FIELDGROUPKEY = 'related';
public function getGroupLabel() {
return pht('Related Fields');
}
protected function getGroupOrder() {
return 2000;
}
}

View file

@ -0,0 +1,15 @@
<?php
final class HeraldSupportFieldGroup extends HeraldFieldGroup {
const FIELDGROUPKEY = 'support';
public function getGroupLabel() {
return pht('Supporting Applications');
}
protected function getGroupOrder() {
return 3000;
}
}

View file

@ -2,6 +2,10 @@
abstract class ManiphestTaskHeraldField extends HeraldField {
public function getFieldGroupKey() {
return ManiphestTaskHeraldFieldGroup::FIELDGROUPKEY;
}
public function supportsObject($object) {
return ($object instanceof ManiphestTask);
}

View file

@ -0,0 +1,15 @@
<?php
final class ManiphestTaskHeraldFieldGroup extends HeraldFieldGroup {
const FIELDGROUPKEY = 'maniphest.task';
public function getGroupLabel() {
return pht('Task Fields');
}
protected function getGroupOrder() {
return 500;
}
}

View file

@ -6,7 +6,11 @@ final class PhabricatorMetaMTAApplicationEmailHeraldField
const FIELDCONST = 'application-email';
public function getHeraldFieldName() {
return pht('Receiving email address');
return pht('Receiving email addresses');
}
public function getFieldGroupKey() {
return HeraldEditFieldGroup::FIELDGROUPKEY;
}
public function supportsObject($object) {

View file

@ -6,4 +6,8 @@ abstract class PholioMockHeraldField extends HeraldField {
return ($object instanceof PholioMock);
}
public function getFieldGroupKey() {
return PholioMockHeraldFieldGroup::FIELDGROUPKEY;
}
}

View file

@ -0,0 +1,15 @@
<?php
final class PholioMockHeraldFieldGroup extends HeraldFieldGroup {
const FIELDGROUPKEY = 'pholio.mock';
public function getGroupLabel() {
return pht('Mock Fields');
}
protected function getGroupOrder() {
return 1000;
}
}

View file

@ -6,4 +6,7 @@ abstract class PhrictionDocumentHeraldField extends HeraldField {
return ($object instanceof PhrictionDocument);
}
public function getFieldGroupKey() {
return PhrictionDocumentHeraldFieldGroup::FIELDGROUPKEY;
}
}

View file

@ -0,0 +1,15 @@
<?php
final class PhrictionDocumentHeraldFieldGroup extends HeraldFieldGroup {
const FIELDGROUPKEY = 'phriction.document';
public function getGroupLabel() {
return pht('Document Fields');
}
protected function getGroupOrder() {
return 1000;
}
}

View file

@ -8,6 +8,10 @@ final class HeraldProjectsField extends HeraldField {
return pht('Projects');
}
public function getFieldGroupKey() {
return HeraldSupportFieldGroup::FIELDGROUPKEY;
}
public function supportsObject($object) {
return ($object instanceof PhabricatorProjectInterface);
}

View file

@ -8,6 +8,10 @@ final class HeraldSpaceField extends HeraldField {
return pht('Space');
}
public function getFieldGroupKey() {
return HeraldSupportFieldGroup::FIELDGROUPKEY;
}
public function supportsObject($object) {
return ($object instanceof PhabricatorSpacesInterface);
}

View file

@ -8,6 +8,10 @@ final class HeraldSubscribersField extends HeraldField {
return pht('Subscribers');
}
public function getFieldGroupKey() {
return HeraldSupportFieldGroup::FIELDGROUPKEY;
}
public function supportsObject($object) {
return ($object instanceof PhabricatorSubscribableInterface);
}

View file

@ -15,6 +15,10 @@ final class PhabricatorCustomFieldHeraldField extends HeraldField {
return $this->customField;
}
public function getFieldGroupKey() {
return PhabricatorCustomFieldHeraldFieldGroup::FIELDGROUPKEY;
}
public function supportsObject($object) {
return ($object instanceof PhabricatorCustomFieldInterface);
}

View file

@ -0,0 +1,15 @@
<?php
final class PhabricatorCustomFieldHeraldFieldGroup extends HeraldFieldGroup {
const FIELDGROUPKEY = 'customfield';
public function getGroupLabel() {
return pht('Custom Fields');
}
protected function getGroupOrder() {
return 2000;
}
}

View file

@ -320,10 +320,25 @@ JX.install('HeraldRuleEditor', {
this._onfieldchange(r);
},
_renderCondition : function(row_id) {
var field_select = this._renderSelect(
this._config.info.fields,
this._config.conditions[row_id][0],
'field-select');
var groups = this._config.info.fields;
var optgroups = [];
for (var ii = 0; ii < groups.length; ii++) {
var group = groups[ii];
var options = [];
for (var k in group.options) {
options.push(JX.$N('option', {value: k}, group.options[k]));
}
optgroups.push(JX.$N('optgroup', {label: group.label}, options));
}
var attrs = {
sigil: 'field-select'
};
var field_select = JX.$N('select', attrs, optgroups);
field_select.value = this._config.conditions[row_id][0];
var field_cell = JX.$N('td', {sigil: 'field-cell'}, field_select);
var condition_cell = JX.$N('td', {sigil: 'condition-cell'});