@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.

Slightly improve Buildable list in Harbormaster

Summary:
Ref T10457. This makes diffs/revisions show the revision as the buildable title, and commits show the commit as the title.

Previously, the title was "Buildable X".

Also makes icons/colors/labels more consitent.

Test Plan: {F1131885}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10457

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

+55 -9
+9
src/applications/differential/storage/DifferentialDiff.php
··· 429 429 /* -( HarbormasterBuildableInterface )------------------------------------- */ 430 430 431 431 432 + public function getHarbormasterBuildableDisplayPHID() { 433 + $container_phid = $this->getHarbormasterContainerPHID(); 434 + if ($container_phid) { 435 + return $container_phid; 436 + } 437 + 438 + return $this->getHarbormasterBuildablePHID(); 439 + } 440 + 432 441 public function getHarbormasterBuildablePHID() { 433 442 return $this->getPHID(); 434 443 }
+4
src/applications/differential/storage/DifferentialRevision.php
··· 432 432 /* -( HarbormasterBuildableInterface )------------------------------------- */ 433 433 434 434 435 + public function getHarbormasterBuildableDisplayPHID() { 436 + return $this->getHarbormasterContainerPHID(); 437 + } 438 + 435 439 public function getHarbormasterBuildablePHID() { 436 440 return $this->loadActiveDiff()->getPHID(); 437 441 }
+13
src/applications/harbormaster/interface/HarbormasterBuildableInterface.php
··· 2 2 3 3 interface HarbormasterBuildableInterface { 4 4 5 + /** 6 + * Get the object PHID which best identifies this buildable to humans. 7 + * 8 + * This object is the primary object associated with the buildable in the 9 + * UI. The most human-readable object for a buildable varies: for example, 10 + * for diffs the container (the revision) is more meaningful than the 11 + * buildable (the diff), but for commits the buildable (the commit) is more 12 + * meaningful than the container (the repository). 13 + * 14 + * @return phid Related object PHID most meaningful for human viewers. 15 + */ 16 + public function getHarbormasterBuildableDisplayPHID(); 17 + 5 18 public function getHarbormasterBuildablePHID(); 6 19 public function getHarbormasterContainerPHID(); 7 20
+21 -9
src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php
··· 185 185 186 186 $phids = array(); 187 187 foreach ($buildables as $buildable) { 188 + $phids[] = $buildable->getBuildableObject() 189 + ->getHarbormasterBuildableDisplayPHID(); 190 + 188 191 $phids[] = $buildable->getContainerPHID(); 189 192 $phids[] = $buildable->getBuildablePHID(); 190 193 } ··· 195 198 foreach ($buildables as $buildable) { 196 199 $id = $buildable->getID(); 197 200 201 + $display_phid = $buildable->getBuildableObject() 202 + ->getHarbormasterBuildableDisplayPHID(); 203 + 198 204 $container_phid = $buildable->getContainerPHID(); 199 205 $buildable_phid = $buildable->getBuildablePHID(); 200 206 201 207 $item = id(new PHUIObjectItemView()) 202 - ->setHeader(pht('Buildable %d', $buildable->getID())); 208 + ->setObjectName(pht('Buildable %d', $buildable->getID())); 209 + 210 + if ($display_phid) { 211 + $handle = $handles[$display_phid]; 212 + $item->setHeader($handle->getFullName()); 213 + } 203 214 204 - if ($container_phid) { 215 + if ($container_phid && ($container_phid != $display_phid)) { 205 216 $handle = $handles[$container_phid]; 206 217 $item->addAttribute($handle->getName()); 207 218 } 208 219 209 - if ($buildable_phid) { 220 + if ($buildable_phid && ($buildable_phid != $display_phid)) { 210 221 $handle = $handles[$buildable_phid]; 211 222 $item->addAttribute($handle->getFullName()); 212 223 } ··· 217 228 $item->addIcon('fa-wrench grey', pht('Manual')); 218 229 } 219 230 220 - $item->setStatusIcon('fa-wrench '. 221 - HarbormasterBuildable::getBuildableStatusColor( 222 - $buildable->getBuildableStatus())); 223 - $item->addByline(HarbormasterBuildable::getBuildableStatusName( 224 - $buildable->getBuildableStatus())); 231 + $status = $buildable->getBuildableStatus(); 232 + 233 + $status_icon = HarbormasterBuildable::getBuildableStatusIcon($status); 234 + $status_color = HarbormasterBuildable::getBuildableStatusColor($status); 235 + $status_label = HarbormasterBuildable::getBuildableStatusName($status); 236 + 237 + $item->setStatusIcon("{$status_icon} {$status_color}", $status_label); 225 238 226 239 $list->addItem($item); 227 - 228 240 } 229 241 230 242 $result = new PhabricatorApplicationSearchResultView();
+4
src/applications/harbormaster/storage/HarbormasterBuildable.php
··· 302 302 /* -( HarbormasterBuildableInterface )------------------------------------- */ 303 303 304 304 305 + public function getHarbormasterBuildableDisplayPHID() { 306 + return $this->getBuildableObject()->getHarbormasterBuildableDisplayPHID(); 307 + } 308 + 305 309 public function getHarbormasterBuildablePHID() { 306 310 // NOTE: This is essentially just for convenience, as it allows you create 307 311 // a copy of a buildable by specifying `B123` without bothering to go
+4
src/applications/repository/storage/PhabricatorRepositoryCommit.php
··· 370 370 /* -( HarbormasterBuildableInterface )------------------------------------- */ 371 371 372 372 373 + public function getHarbormasterBuildableDisplayPHID() { 374 + return $this->getHarbormasterBuildablePHID(); 375 + } 376 + 373 377 public function getHarbormasterBuildablePHID() { 374 378 return $this->getPHID(); 375 379 }