mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Slightly improve Buildable list in Harbormaster
Summary: Ref T10457. This makes diffs/revisions show the revision as the buildable title, and commits show the commit as the title. Previously, the title was "Buildable X". Also makes icons/colors/labels more consitent. Test Plan: {F1131885} Reviewers: chad Reviewed By: chad Maniphest Tasks: T10457 Differential Revision: https://secure.phabricator.com/D15355
This commit is contained in:
parent
220ac48801
commit
fdca684814
6 changed files with 55 additions and 9 deletions
|
@ -429,6 +429,15 @@ final class DifferentialDiff
|
||||||
/* -( HarbormasterBuildableInterface )------------------------------------- */
|
/* -( HarbormasterBuildableInterface )------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
public function getHarbormasterBuildableDisplayPHID() {
|
||||||
|
$container_phid = $this->getHarbormasterContainerPHID();
|
||||||
|
if ($container_phid) {
|
||||||
|
return $container_phid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->getHarbormasterBuildablePHID();
|
||||||
|
}
|
||||||
|
|
||||||
public function getHarbormasterBuildablePHID() {
|
public function getHarbormasterBuildablePHID() {
|
||||||
return $this->getPHID();
|
return $this->getPHID();
|
||||||
}
|
}
|
||||||
|
|
|
@ -432,6 +432,10 @@ final class DifferentialRevision extends DifferentialDAO
|
||||||
/* -( HarbormasterBuildableInterface )------------------------------------- */
|
/* -( HarbormasterBuildableInterface )------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
public function getHarbormasterBuildableDisplayPHID() {
|
||||||
|
return $this->getHarbormasterContainerPHID();
|
||||||
|
}
|
||||||
|
|
||||||
public function getHarbormasterBuildablePHID() {
|
public function getHarbormasterBuildablePHID() {
|
||||||
return $this->loadActiveDiff()->getPHID();
|
return $this->loadActiveDiff()->getPHID();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,19 @@
|
||||||
|
|
||||||
interface HarbormasterBuildableInterface {
|
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 getHarbormasterBuildablePHID();
|
||||||
public function getHarbormasterContainerPHID();
|
public function getHarbormasterContainerPHID();
|
||||||
|
|
||||||
|
|
|
@ -185,6 +185,9 @@ final class HarbormasterBuildableSearchEngine
|
||||||
|
|
||||||
$phids = array();
|
$phids = array();
|
||||||
foreach ($buildables as $buildable) {
|
foreach ($buildables as $buildable) {
|
||||||
|
$phids[] = $buildable->getBuildableObject()
|
||||||
|
->getHarbormasterBuildableDisplayPHID();
|
||||||
|
|
||||||
$phids[] = $buildable->getContainerPHID();
|
$phids[] = $buildable->getContainerPHID();
|
||||||
$phids[] = $buildable->getBuildablePHID();
|
$phids[] = $buildable->getBuildablePHID();
|
||||||
}
|
}
|
||||||
|
@ -195,18 +198,26 @@ final class HarbormasterBuildableSearchEngine
|
||||||
foreach ($buildables as $buildable) {
|
foreach ($buildables as $buildable) {
|
||||||
$id = $buildable->getID();
|
$id = $buildable->getID();
|
||||||
|
|
||||||
|
$display_phid = $buildable->getBuildableObject()
|
||||||
|
->getHarbormasterBuildableDisplayPHID();
|
||||||
|
|
||||||
$container_phid = $buildable->getContainerPHID();
|
$container_phid = $buildable->getContainerPHID();
|
||||||
$buildable_phid = $buildable->getBuildablePHID();
|
$buildable_phid = $buildable->getBuildablePHID();
|
||||||
|
|
||||||
$item = id(new PHUIObjectItemView())
|
$item = id(new PHUIObjectItemView())
|
||||||
->setHeader(pht('Buildable %d', $buildable->getID()));
|
->setObjectName(pht('Buildable %d', $buildable->getID()));
|
||||||
|
|
||||||
if ($container_phid) {
|
if ($display_phid) {
|
||||||
|
$handle = $handles[$display_phid];
|
||||||
|
$item->setHeader($handle->getFullName());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($container_phid && ($container_phid != $display_phid)) {
|
||||||
$handle = $handles[$container_phid];
|
$handle = $handles[$container_phid];
|
||||||
$item->addAttribute($handle->getName());
|
$item->addAttribute($handle->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($buildable_phid) {
|
if ($buildable_phid && ($buildable_phid != $display_phid)) {
|
||||||
$handle = $handles[$buildable_phid];
|
$handle = $handles[$buildable_phid];
|
||||||
$item->addAttribute($handle->getFullName());
|
$item->addAttribute($handle->getFullName());
|
||||||
}
|
}
|
||||||
|
@ -217,14 +228,15 @@ final class HarbormasterBuildableSearchEngine
|
||||||
$item->addIcon('fa-wrench grey', pht('Manual'));
|
$item->addIcon('fa-wrench grey', pht('Manual'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$item->setStatusIcon('fa-wrench '.
|
$status = $buildable->getBuildableStatus();
|
||||||
HarbormasterBuildable::getBuildableStatusColor(
|
|
||||||
$buildable->getBuildableStatus()));
|
$status_icon = HarbormasterBuildable::getBuildableStatusIcon($status);
|
||||||
$item->addByline(HarbormasterBuildable::getBuildableStatusName(
|
$status_color = HarbormasterBuildable::getBuildableStatusColor($status);
|
||||||
$buildable->getBuildableStatus()));
|
$status_label = HarbormasterBuildable::getBuildableStatusName($status);
|
||||||
|
|
||||||
|
$item->setStatusIcon("{$status_icon} {$status_color}", $status_label);
|
||||||
|
|
||||||
$list->addItem($item);
|
$list->addItem($item);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = new PhabricatorApplicationSearchResultView();
|
$result = new PhabricatorApplicationSearchResultView();
|
||||||
|
|
|
@ -302,6 +302,10 @@ final class HarbormasterBuildable extends HarbormasterDAO
|
||||||
/* -( HarbormasterBuildableInterface )------------------------------------- */
|
/* -( HarbormasterBuildableInterface )------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
public function getHarbormasterBuildableDisplayPHID() {
|
||||||
|
return $this->getBuildableObject()->getHarbormasterBuildableDisplayPHID();
|
||||||
|
}
|
||||||
|
|
||||||
public function getHarbormasterBuildablePHID() {
|
public function getHarbormasterBuildablePHID() {
|
||||||
// NOTE: This is essentially just for convenience, as it allows you create
|
// NOTE: This is essentially just for convenience, as it allows you create
|
||||||
// a copy of a buildable by specifying `B123` without bothering to go
|
// a copy of a buildable by specifying `B123` without bothering to go
|
||||||
|
|
|
@ -370,6 +370,10 @@ final class PhabricatorRepositoryCommit
|
||||||
/* -( HarbormasterBuildableInterface )------------------------------------- */
|
/* -( HarbormasterBuildableInterface )------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
|
public function getHarbormasterBuildableDisplayPHID() {
|
||||||
|
return $this->getHarbormasterBuildablePHID();
|
||||||
|
}
|
||||||
|
|
||||||
public function getHarbormasterBuildablePHID() {
|
public function getHarbormasterBuildablePHID() {
|
||||||
return $this->getPHID();
|
return $this->getPHID();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue