diff --git a/src/applications/harbormaster/event/HarbormasterUIEventListener.php b/src/applications/harbormaster/event/HarbormasterUIEventListener.php index e965e67fb6..d0a79f4b12 100644 --- a/src/applications/harbormaster/event/HarbormasterUIEventListener.php +++ b/src/applications/harbormaster/event/HarbormasterUIEventListener.php @@ -51,22 +51,17 @@ final class HarbormasterUIEventListener return; } - $buildables = id(new HarbormasterBuildableQuery()) + $buildable = id(new HarbormasterBuildableQuery()) ->setViewer($user) ->withManualBuildables(false) ->withBuildablePHIDs(array($buildable_phid)) - ->execute(); - if (!$buildables) { + ->needBuilds(true) + ->executeOne(); + if (!$buildable) { return; } - $builds = id(new HarbormasterBuildQuery()) - ->setViewer($user) - ->withBuildablePHIDs(mpull($buildables, 'getPHID')) - ->execute(); - if (!$builds) { - return; - } + $builds = $buildable->getBuilds(); $build_handles = id(new PhabricatorHandleQuery()) ->setViewer($user) @@ -75,6 +70,29 @@ final class HarbormasterUIEventListener $status_view = new PHUIStatusListView(); + $buildable_status = $buildable->getBuildableStatus(); + $buildable_icon = HarbormasterBuildable::getBuildableStatusIcon( + $buildable_status); + $buildable_color = HarbormasterBuildable::getBuildableStatusColor( + $buildable_status); + $buildable_name = HarbormasterBuildable::getBuildableStatusName( + $buildable_status); + + $target = phutil_tag( + 'a', + array( + 'href' => '/'.$buildable->getMonogram(), + ), + pht('Buildable %d', $buildable->getID())); + + $target = phutil_tag('strong', array(), $target); + + $status_view + ->addItem( + id(new PHUIStatusItemView()) + ->setIcon($buildable_icon, $buildable_color, $buildable_name) + ->setTarget($target)); + foreach ($builds as $build) { $item = new PHUIStatusItemView(); $item->setTarget($build_handles[$build->getPHID()]->renderLink());