mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 06:42:42 +01:00
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
This commit is contained in:
parent
c03cdbe9a9
commit
377742c23a
4 changed files with 54 additions and 2 deletions
|
@ -44,6 +44,28 @@ final class HarbormasterBuildableListController
|
|||
}
|
||||
|
||||
$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;
|
||||
|
|
|
@ -10,6 +10,7 @@ final class HarbormasterBuildableQuery
|
|||
|
||||
private $needContainerObjects;
|
||||
private $needBuildableHandles;
|
||||
private $needBuilds;
|
||||
|
||||
public function withIDs(array $ids) {
|
||||
$this->ids = $ids;
|
||||
|
@ -41,6 +42,11 @@ final class HarbormasterBuildableQuery
|
|||
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 @@ final class HarbormasterBuildableQuery
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,9 @@ final class HarbormasterBuildableSearchEngine
|
|||
}
|
||||
|
||||
public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
|
||||
$query = id(new HarbormasterBuildableQuery());
|
||||
$query->needBuildableHandles(true);
|
||||
$query = id(new HarbormasterBuildableQuery())
|
||||
->needBuildableHandles(true)
|
||||
->needBuilds(true);
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ final class HarbormasterBuildable extends HarbormasterDAO
|
|||
private $buildableObject = self::ATTACHABLE;
|
||||
private $containerObject = self::ATTACHABLE;
|
||||
private $buildableHandle = self::ATTACHABLE;
|
||||
private $builds = self::ATTACHABLE;
|
||||
|
||||
const STATUS_WHATEVER = 'whatever';
|
||||
|
||||
|
@ -58,6 +59,16 @@ final class HarbormasterBuildable extends HarbormasterDAO
|
|||
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 )----------------------------------------- */
|
||||
|
||||
|
|
Loading…
Reference in a new issue