Page MenuHomePhabricator

D7512.diff
No OneTemporary

D7512.diff

Index: src/applications/harbormaster/controller/HarbormasterBuildableListController.php
===================================================================
--- src/applications/harbormaster/controller/HarbormasterBuildableListController.php
+++ src/applications/harbormaster/controller/HarbormasterBuildableListController.php
@@ -44,6 +44,28 @@
}
$list->addItem($item);
+
+ // TODO: This is proof-of-concept for getting meaningful status
+ // information into this list, and should get an improvement pass
+ // once we're a little farther along.
+
+ $all_pass = true;
+ $any_fail = false;
+ foreach ($buildable->getBuilds() as $build) {
+ if ($build->getBuildStatus() != HarbormasterBuild::STATUS_PASSED) {
+ $all_pass = false;
+ }
+ if ($build->getBuildStatus() == HarbormasterBuild::STATUS_FAILED ||
+ $build->getBuildStatus() == HarbormasterBuild::STATUS_ERROR) {
+ $any_fail = true;
+ }
+ }
+
+ if ($any_fail) {
+ $item->setBarColor('red');
+ } else if ($all_pass) {
+ $item->setBarColor('green');
+ }
}
return $list;
Index: src/applications/harbormaster/query/HarbormasterBuildableQuery.php
===================================================================
--- src/applications/harbormaster/query/HarbormasterBuildableQuery.php
+++ src/applications/harbormaster/query/HarbormasterBuildableQuery.php
@@ -10,6 +10,7 @@
private $needContainerObjects;
private $needBuildableHandles;
+ private $needBuilds;
public function withIDs(array $ids) {
$this->ids = $ids;
@@ -41,6 +42,11 @@
return $this;
}
+ public function needBuilds($need) {
+ $this->needBuilds = $need;
+ return $this;
+ }
+
protected function loadPage() {
$table = new HarbormasterBuildable();
$conn_r = $table->establishConnection('r');
@@ -119,6 +125,18 @@
}
}
+ if ($this->needBuilds) {
+ $builds = id(new HarbormasterBuildQuery())
+ ->setViewer($this->getViewer())
+ ->setParentQuery($this)
+ ->withBuildablePHIDs(mpull($page, 'getPHID'))
+ ->execute();
+ $builds = mgroup($builds, 'getBuildablePHID');
+ foreach ($page as $key => $buildable) {
+ $buildable->attachBuilds(idx($builds, $buildable->getPHID(), array()));
+ }
+ }
+
return $page;
}
Index: src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php
===================================================================
--- src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php
+++ src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php
@@ -10,8 +10,9 @@
}
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
- $query = id(new HarbormasterBuildableQuery());
- $query->needBuildableHandles(true);
+ $query = id(new HarbormasterBuildableQuery())
+ ->needBuildableHandles(true)
+ ->needBuilds(true);
return $query;
}
Index: src/applications/harbormaster/storage/HarbormasterBuildable.php
===================================================================
--- src/applications/harbormaster/storage/HarbormasterBuildable.php
+++ src/applications/harbormaster/storage/HarbormasterBuildable.php
@@ -11,6 +11,7 @@
private $buildableObject = self::ATTACHABLE;
private $containerObject = self::ATTACHABLE;
private $buildableHandle = self::ATTACHABLE;
+ private $builds = self::ATTACHABLE;
const STATUS_WHATEVER = 'whatever';
@@ -58,6 +59,16 @@
return $this->assertAttached($this->buildableHandle);
}
+ public function attachBuilds(array $builds) {
+ assert_instances_of($builds, 'HarbormasterBuild');
+ $this->builds = $builds;
+ return $this;
+ }
+
+ public function getBuilds() {
+ return $this->assertAttached($this->builds);
+ }
+
/* -( PhabricatorPolicyInterface )----------------------------------------- */

File Metadata

Mime Type
text/plain
Expires
May 18 2024, 4:36 AM (4 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6286449
Default Alt Text
D7512.diff (3 KB)

Event Timeline