Page MenuHomePhabricator

D15355.id.diff
No OneTemporary

D15355.id.diff

diff --git a/src/applications/differential/storage/DifferentialDiff.php b/src/applications/differential/storage/DifferentialDiff.php
--- a/src/applications/differential/storage/DifferentialDiff.php
+++ b/src/applications/differential/storage/DifferentialDiff.php
@@ -429,6 +429,15 @@
/* -( HarbormasterBuildableInterface )------------------------------------- */
+ public function getHarbormasterBuildableDisplayPHID() {
+ $container_phid = $this->getHarbormasterContainerPHID();
+ if ($container_phid) {
+ return $container_phid;
+ }
+
+ return $this->getHarbormasterBuildablePHID();
+ }
+
public function getHarbormasterBuildablePHID() {
return $this->getPHID();
}
diff --git a/src/applications/differential/storage/DifferentialRevision.php b/src/applications/differential/storage/DifferentialRevision.php
--- a/src/applications/differential/storage/DifferentialRevision.php
+++ b/src/applications/differential/storage/DifferentialRevision.php
@@ -432,6 +432,10 @@
/* -( HarbormasterBuildableInterface )------------------------------------- */
+ public function getHarbormasterBuildableDisplayPHID() {
+ return $this->getHarbormasterContainerPHID();
+ }
+
public function getHarbormasterBuildablePHID() {
return $this->loadActiveDiff()->getPHID();
}
diff --git a/src/applications/harbormaster/interface/HarbormasterBuildableInterface.php b/src/applications/harbormaster/interface/HarbormasterBuildableInterface.php
--- a/src/applications/harbormaster/interface/HarbormasterBuildableInterface.php
+++ b/src/applications/harbormaster/interface/HarbormasterBuildableInterface.php
@@ -2,6 +2,19 @@
interface HarbormasterBuildableInterface {
+ /**
+ * Get the object PHID which best identifies this buildable to humans.
+ *
+ * This object is the primary object associated with the buildable in the
+ * UI. The most human-readable object for a buildable varies: for example,
+ * for diffs the container (the revision) is more meaningful than the
+ * buildable (the diff), but for commits the buildable (the commit) is more
+ * meaningful than the container (the repository).
+ *
+ * @return phid Related object PHID most meaningful for human viewers.
+ */
+ public function getHarbormasterBuildableDisplayPHID();
+
public function getHarbormasterBuildablePHID();
public function getHarbormasterContainerPHID();
diff --git a/src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php b/src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php
--- a/src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php
+++ b/src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php
@@ -185,6 +185,9 @@
$phids = array();
foreach ($buildables as $buildable) {
+ $phids[] = $buildable->getBuildableObject()
+ ->getHarbormasterBuildableDisplayPHID();
+
$phids[] = $buildable->getContainerPHID();
$phids[] = $buildable->getBuildablePHID();
}
@@ -195,18 +198,26 @@
foreach ($buildables as $buildable) {
$id = $buildable->getID();
+ $display_phid = $buildable->getBuildableObject()
+ ->getHarbormasterBuildableDisplayPHID();
+
$container_phid = $buildable->getContainerPHID();
$buildable_phid = $buildable->getBuildablePHID();
$item = id(new PHUIObjectItemView())
- ->setHeader(pht('Buildable %d', $buildable->getID()));
+ ->setObjectName(pht('Buildable %d', $buildable->getID()));
+
+ if ($display_phid) {
+ $handle = $handles[$display_phid];
+ $item->setHeader($handle->getFullName());
+ }
- if ($container_phid) {
+ if ($container_phid && ($container_phid != $display_phid)) {
$handle = $handles[$container_phid];
$item->addAttribute($handle->getName());
}
- if ($buildable_phid) {
+ if ($buildable_phid && ($buildable_phid != $display_phid)) {
$handle = $handles[$buildable_phid];
$item->addAttribute($handle->getFullName());
}
@@ -217,14 +228,15 @@
$item->addIcon('fa-wrench grey', pht('Manual'));
}
- $item->setStatusIcon('fa-wrench '.
- HarbormasterBuildable::getBuildableStatusColor(
- $buildable->getBuildableStatus()));
- $item->addByline(HarbormasterBuildable::getBuildableStatusName(
- $buildable->getBuildableStatus()));
+ $status = $buildable->getBuildableStatus();
- $list->addItem($item);
+ $status_icon = HarbormasterBuildable::getBuildableStatusIcon($status);
+ $status_color = HarbormasterBuildable::getBuildableStatusColor($status);
+ $status_label = HarbormasterBuildable::getBuildableStatusName($status);
+
+ $item->setStatusIcon("{$status_icon} {$status_color}", $status_label);
+ $list->addItem($item);
}
$result = new PhabricatorApplicationSearchResultView();
diff --git a/src/applications/harbormaster/storage/HarbormasterBuildable.php b/src/applications/harbormaster/storage/HarbormasterBuildable.php
--- a/src/applications/harbormaster/storage/HarbormasterBuildable.php
+++ b/src/applications/harbormaster/storage/HarbormasterBuildable.php
@@ -302,6 +302,10 @@
/* -( HarbormasterBuildableInterface )------------------------------------- */
+ public function getHarbormasterBuildableDisplayPHID() {
+ return $this->getBuildableObject()->getHarbormasterBuildableDisplayPHID();
+ }
+
public function getHarbormasterBuildablePHID() {
// NOTE: This is essentially just for convenience, as it allows you create
// a copy of a buildable by specifying `B123` without bothering to go
diff --git a/src/applications/repository/storage/PhabricatorRepositoryCommit.php b/src/applications/repository/storage/PhabricatorRepositoryCommit.php
--- a/src/applications/repository/storage/PhabricatorRepositoryCommit.php
+++ b/src/applications/repository/storage/PhabricatorRepositoryCommit.php
@@ -370,6 +370,10 @@
/* -( HarbormasterBuildableInterface )------------------------------------- */
+ public function getHarbormasterBuildableDisplayPHID() {
+ return $this->getHarbormasterBuildablePHID();
+ }
+
public function getHarbormasterBuildablePHID() {
return $this->getPHID();
}

File Metadata

Mime Type
text/plain
Expires
Sun, Oct 27, 11:18 AM (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6740553
Default Alt Text
D15355.id.diff (6 KB)

Event Timeline