Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2895098
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/applications/harbormaster/event/HarbormasterUIEventListener.php b/src/applications/harbormaster/event/HarbormasterUIEventListener.php
index d49fed5a73..bec5b723b6 100644
--- a/src/applications/harbormaster/event/HarbormasterUIEventListener.php
+++ b/src/applications/harbormaster/event/HarbormasterUIEventListener.php
@@ -1,113 +1,113 @@
<?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 HarbormasterBuildableInterface)) {
return;
}
- $buildable_phid = $object->getBuildablePHID();
+ $buildable_phid = $object->getHarbormasterBuildablePHID();
if (!$buildable_phid) {
return;
}
if (!$this->canUseApplication($ui_event->getUser())) {
return;
}
$buildables = id(new HarbormasterBuildableQuery())
->setViewer($user)
->withManualBuildables(false)
->withBuildablePHIDs(array($buildable_phid))
->execute();
if (!$buildables) {
return;
}
$builds = id(new HarbormasterBuildQuery())
->setViewer($user)
->withBuildablePHIDs(mpull($buildables, 'getPHID'))
->execute();
if (!$builds) {
return;
}
$build_handles = id(new PhabricatorHandleQuery())
->setViewer($user)
->withPHIDs(mpull($builds, 'getPHID'))
->execute();
$status_view = new PHUIStatusListView();
foreach ($builds as $build) {
$item = new PHUIStatusItemView();
$item->setTarget($build_handles[$build->getPHID()]->renderLink());
switch ($build->getBuildStatus()) {
case HarbormasterBuild::STATUS_INACTIVE:
$item->setIcon('open-dark', pht('Inactive'));
break;
case HarbormasterBuild::STATUS_PENDING:
$item->setIcon('open-blue', pht('Pending'));
break;
case HarbormasterBuild::STATUS_WAITING:
$item->setIcon('up-blue', pht('Waiting on Resource'));
break;
case HarbormasterBuild::STATUS_BUILDING:
$item->setIcon('right-blue', pht('Building'));
break;
case HarbormasterBuild::STATUS_PASSED:
$item->setIcon('accept-green', pht('Passed'));
break;
case HarbormasterBuild::STATUS_FAILED:
$item->setIcon('reject-red', pht('Failed'));
break;
case HarbormasterBuild::STATUS_ERROR:
$item->setIcon('minus-red', pht('Unexpected Error'));
break;
case HarbormasterBuild::STATUS_CANCELLED:
$item->setIcon('minus-dark', pht('Cancelled'));
break;
default:
$item->setIcon('question', pht('Unknown'));
break;
}
$status_view->addItem($item);
}
$view = $ui_event->getValue('view');
$view->addProperty(pht('Build Status'), $status_view);
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Jan 19 2025, 20:56 (6 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128667
Default Alt Text
(3 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment