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

Get some level of meaningful status information into Harbormaster buildable list

Summary: Ref T1049. Nothing fancy, but shows red for fail/error and green for pass. See discussion in D7502.

Test Plan: {F78839}

Reviewers: hach-que, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1049

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

+54 -2
+22
src/applications/harbormaster/controller/HarbormasterBuildableListController.php
··· 44 44 } 45 45 46 46 $list->addItem($item); 47 + 48 + // TODO: This is proof-of-concept for getting meaningful status 49 + // information into this list, and should get an improvement pass 50 + // once we're a little farther along. 51 + 52 + $all_pass = true; 53 + $any_fail = false; 54 + foreach ($buildable->getBuilds() as $build) { 55 + if ($build->getBuildStatus() != HarbormasterBuild::STATUS_PASSED) { 56 + $all_pass = false; 57 + } 58 + if ($build->getBuildStatus() == HarbormasterBuild::STATUS_FAILED || 59 + $build->getBuildStatus() == HarbormasterBuild::STATUS_ERROR) { 60 + $any_fail = true; 61 + } 62 + } 63 + 64 + if ($any_fail) { 65 + $item->setBarColor('red'); 66 + } else if ($all_pass) { 67 + $item->setBarColor('green'); 68 + } 47 69 } 48 70 49 71 return $list;
+18
src/applications/harbormaster/query/HarbormasterBuildableQuery.php
··· 10 10 11 11 private $needContainerObjects; 12 12 private $needBuildableHandles; 13 + private $needBuilds; 13 14 14 15 public function withIDs(array $ids) { 15 16 $this->ids = $ids; ··· 38 39 39 40 public function needBuildableHandles($need) { 40 41 $this->needBuildableHandles = $need; 42 + return $this; 43 + } 44 + 45 + public function needBuilds($need) { 46 + $this->needBuilds = $need; 41 47 return $this; 42 48 } 43 49 ··· 116 122 foreach ($page as $key => $buildable) { 117 123 $handle_phid = $buildable->getBuildablePHID(); 118 124 $buildable->attachBuildableHandle(idx($handles, $handle_phid)); 125 + } 126 + } 127 + 128 + if ($this->needBuilds) { 129 + $builds = id(new HarbormasterBuildQuery()) 130 + ->setViewer($this->getViewer()) 131 + ->setParentQuery($this) 132 + ->withBuildablePHIDs(mpull($page, 'getPHID')) 133 + ->execute(); 134 + $builds = mgroup($builds, 'getBuildablePHID'); 135 + foreach ($page as $key => $buildable) { 136 + $buildable->attachBuilds(idx($builds, $buildable->getPHID(), array())); 119 137 } 120 138 } 121 139
+3 -2
src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php
··· 10 10 } 11 11 12 12 public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) { 13 - $query = id(new HarbormasterBuildableQuery()); 14 - $query->needBuildableHandles(true); 13 + $query = id(new HarbormasterBuildableQuery()) 14 + ->needBuildableHandles(true) 15 + ->needBuilds(true); 15 16 16 17 return $query; 17 18 }
+11
src/applications/harbormaster/storage/HarbormasterBuildable.php
··· 11 11 private $buildableObject = self::ATTACHABLE; 12 12 private $containerObject = self::ATTACHABLE; 13 13 private $buildableHandle = self::ATTACHABLE; 14 + private $builds = self::ATTACHABLE; 14 15 15 16 const STATUS_WHATEVER = 'whatever'; 16 17 ··· 56 57 57 58 public function getBuildableHandle() { 58 59 return $this->assertAttached($this->buildableHandle); 60 + } 61 + 62 + public function attachBuilds(array $builds) { 63 + assert_instances_of($builds, 'HarbormasterBuild'); 64 + $this->builds = $builds; 65 + return $this; 66 + } 67 + 68 + public function getBuilds() { 69 + return $this->assertAttached($this->builds); 59 70 } 60 71 61 72