Page MenuHomestyx hydra

No OneTemporary

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
@@ -1,97 +1,115 @@
<?php
final class HarbormasterUIEventListener
extends PhabricatorEventListener {
public function register() {
$this->listen(PhabricatorEventType::TYPE_UI_WILLRENDERPROPERTIES);
}
public function handleEvent(PhutilEvent $event) {
switch ($event->getType()) {
case PhabricatorEventType::TYPE_UI_WILLRENDERPROPERTIES:
$this->handlePropertyEvent($event);
break;
}
}
private function handlePropertyEvent($ui_event) {
$user = $ui_event->getUser();
$object = $ui_event->getValue('object');
if (!$object || !$object->getPHID()) {
// No object, or the object has no PHID yet..
return;
}
if ($object instanceof HarbormasterBuildable) {
// Although HarbormasterBuildable implements the correct interface, it
// does not make sense to show a build's build status. In the best case
// it is meaningless, and in the worst case it's confusing.
return;
}
if ($object instanceof DifferentialRevision) {
// TODO: This is a bit hacky and we could probably find a cleaner fix
// eventually, but we show build status on each diff, immediately below
// this property list, so it's redundant to show it on the revision view.
return;
}
if (!($object instanceof HarbormasterBuildableInterface)) {
return;
}
$buildable_phid = $object->getHarbormasterBuildablePHID();
if (!$buildable_phid) {
return;
}
if (!$this->canUseApplication($ui_event->getUser())) {
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)
->withPHIDs(mpull($builds, 'getPHID'))
->execute();
$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());
$status = $build->getBuildStatus();
$status_name = HarbormasterBuild::getBuildStatusName($status);
$icon = HarbormasterBuild::getBuildStatusIcon($status);
$color = HarbormasterBuild::getBuildStatusColor($status);
$item->setIcon($icon, $color, $status_name);
$status_view->addItem($item);
}
$view = $ui_event->getValue('view');
$view->addProperty(pht('Build Status'), $status_view);
}
}

File Metadata

Mime Type
text/x-diff
Expires
Tue, Jun 10, 3:17 PM (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
140443
Default Alt Text
(4 KB)

Event Timeline