@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make the Drydock repository operation page slightly richer

Summary:
Ref T13164. See PHI788. The issue requests a "created" timestamp.

Also add filtering for repository, state, and author.

Test Plan:
Used all filters.

{F5795085}

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam

Maniphest Tasks: T13164

Differential Revision: https://secure.phabricator.com/D19574

+57 -7
+13
src/applications/drydock/query/DrydockRepositoryOperationQuery.php
··· 9 9 private $operationStates; 10 10 private $operationTypes; 11 11 private $isDismissed; 12 + private $authorPHIDs; 12 13 13 14 public function withIDs(array $ids) { 14 15 $this->ids = $ids; ··· 42 43 43 44 public function withIsDismissed($dismissed) { 44 45 $this->isDismissed = $dismissed; 46 + return $this; 47 + } 48 + 49 + public function withAuthorPHIDs(array $phids) { 50 + $this->authorPHIDs = $phids; 45 51 return $this; 46 52 } 47 53 ··· 163 169 $conn, 164 170 'isDismissed = %d', 165 171 (int)$this->isDismissed); 172 + } 173 + 174 + if ($this->authorPHIDs !== null) { 175 + $where[] = qsprintf( 176 + $conn, 177 + 'authorPHID IN (%Ls)', 178 + $this->authorPHIDs); 166 179 } 167 180 168 181 return $where;
+34
src/applications/drydock/query/DrydockRepositoryOperationSearchEngine.php
··· 18 18 protected function buildQueryFromParameters(array $map) { 19 19 $query = $this->newQuery(); 20 20 21 + if ($map['repositoryPHIDs']) { 22 + $query->withRepositoryPHIDs($map['repositoryPHIDs']); 23 + } 24 + 25 + if ($map['authorPHIDs']) { 26 + $query->withAuthorPHIDs($map['authorPHIDs']); 27 + } 28 + 29 + if ($map['states']) { 30 + $query->withOperationStates($map['states']); 31 + } 32 + 21 33 return $query; 22 34 } 23 35 24 36 protected function buildCustomSearchFields() { 25 37 return array( 38 + id(new PhabricatorSearchDatasourceField()) 39 + ->setLabel(pht('Repositories')) 40 + ->setKey('repositoryPHIDs') 41 + ->setAliases(array('repository', 'repositories', 'repositoryPHID')) 42 + ->setDatasource(new DiffusionRepositoryFunctionDatasource()), 43 + 44 + // NOTE: Repository operations aren't necessarily created by a real 45 + // user, but for now they normally are. Just use a user typeahead until 46 + // more use cases arise. 47 + id(new PhabricatorUsersSearchField()) 48 + ->setLabel(pht('Authors')) 49 + ->setKey('authorPHIDs') 50 + ->setAliases(array('author', 'authors', 'authorPHID')), 51 + id(new PhabricatorSearchCheckboxesField()) 52 + ->setLabel(pht('States')) 53 + ->setKey('states') 54 + ->setAliases(array('state')) 55 + ->setOptions(DrydockRepositoryOperation::getOperationStateNameMap()), 26 56 ); 27 57 } 28 58 ··· 71 101 $name = DrydockRepositoryOperation::getOperationStateName($state); 72 102 73 103 $item->setStatusIcon($icon, $name); 104 + 105 + 106 + $created = phabricator_datetime($operation->getDateCreated(), $viewer); 107 + $item->addIcon(null, $created); 74 108 75 109 $item->addByline( 76 110 array(
+10 -7
src/applications/drydock/storage/DrydockRepositoryOperation.php
··· 99 99 return $this; 100 100 } 101 101 102 + public static function getOperationStateNameMap() { 103 + return array( 104 + self::STATE_WAIT => pht('Waiting'), 105 + self::STATE_WORK => pht('Working'), 106 + self::STATE_DONE => pht('Done'), 107 + self::STATE_FAIL => pht('Failed'), 108 + ); 109 + } 110 + 102 111 public static function getOperationStateIcon($state) { 103 112 $map = array( 104 113 self::STATE_WAIT => 'fa-clock-o', ··· 111 120 } 112 121 113 122 public static function getOperationStateName($state) { 114 - $map = array( 115 - self::STATE_WAIT => pht('Waiting'), 116 - self::STATE_WORK => pht('Working'), 117 - self::STATE_DONE => pht('Done'), 118 - self::STATE_FAIL => pht('Failed'), 119 - ); 120 - 123 + $map = self::getOperationStateNameMap(); 121 124 return idx($map, $state, pht('<Unknown: %s>', $state)); 122 125 } 123 126