diff --git a/src/applications/differential/phid/DifferentialRevisionPHIDType.php b/src/applications/differential/phid/DifferentialRevisionPHIDType.php --- a/src/applications/differential/phid/DifferentialRevisionPHIDType.php +++ b/src/applications/differential/phid/DifferentialRevisionPHIDType.php @@ -33,16 +33,30 @@ $revision = $objects[$phid]; $title = $revision->getTitle(); - $id = $revision->getID(); $status = $revision->getStatus(); + $monogram = $revision->getMonogram(); + $uri = $revision->getURI(); - $handle->setName("D{$id}"); - $handle->setURI("/D{$id}"); - $handle->setFullName("D{$id}: {$title}"); + $handle + ->setName($monogram) + ->setURI($uri) + ->setFullName("{$monogram}: {$title}"); if ($revision->isClosed()) { $handle->setStatus(PhabricatorObjectHandle::STATUS_CLOSED); } + + $status = $revision->getStatus(); + + $icon = DifferentialRevisionStatus::getRevisionStatusIcon($status); + $color = DifferentialRevisionStatus::getRevisionStatusColor($status); + $name = ArcanistDifferentialRevisionStatus::getNameForRevisionStatus( + $status); + + $handle + ->setStateIcon($icon) + ->setStateColor($color) + ->setStateName($name); } } diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -397,7 +397,8 @@ foreach ($commit_phids as $phid) { $revisions_commits[$phid] = $handles->renderHandle($phid) - ->setShowHovercard(true); + ->setShowHovercard(true) + ->setShowStateIcon(true); $revision_phid = key($drev_edges[$phid][$commit_drev]); $revision_handle = $handles->getHandleIfExists($revision_phid); if ($revision_handle) { @@ -412,12 +413,16 @@ } foreach ($edge_types as $edge_type => $edge_name) { - if ($edges[$edge_type]) { - $edge_handles = $viewer->loadHandles(array_keys($edges[$edge_type])); - $view->addProperty( - $edge_name, - $edge_handles->renderList()); + if (!$edges[$edge_type]) { + continue; } + + $edge_handles = $viewer->loadHandles(array_keys($edges[$edge_type])); + + $edge_list = $edge_handles->renderList() + ->setShowStateIcons(true); + + $view->addProperty($edge_name, $edge_list); } if ($revisions_commits) { diff --git a/src/applications/phid/PhabricatorObjectHandle.php b/src/applications/phid/PhabricatorObjectHandle.php --- a/src/applications/phid/PhabricatorObjectHandle.php +++ b/src/applications/phid/PhabricatorObjectHandle.php @@ -31,6 +31,10 @@ private $tokenIcon; private $commandLineObjectName; + private $stateIcon; + private $stateColor; + private $stateName; + public function setIcon($icon) { $this->icon = $icon; return $this; @@ -284,6 +288,54 @@ return $this->complete; } + public function setStateIcon($state_icon) { + $this->stateIcon = $state_icon; + return $this; + } + + public function getStateIcon() { + return $this->stateIcon; + } + + public function setStateColor($state_color) { + $this->stateColor = $state_color; + return $this; + } + + public function getStateColor() { + return $this->stateColor; + } + + public function setStateName($state_name) { + $this->stateName = $state_name; + return $this; + } + + public function getStateName() { + return $this->stateName; + } + + public function renderStateIcon() { + $icon = $this->getStateIcon(); + if ($icon === null) { + $icon = 'fa-question-circle-o'; + } + + $color = $this->getStateColor(); + + $name = $this->getStateName(); + if ($name === null) { + $name = pht('Unknown'); + } + + return id(new PHUIIconView()) + ->setIcon($icon, $color) + ->addSigil('has-tooltip') + ->setMetadata( + array( + 'tip' => $name, + )); + } public function renderLink($name = null) { return $this->renderLinkWithAttributes($name, array()); diff --git a/src/applications/phid/view/PHUIHandleListView.php b/src/applications/phid/view/PHUIHandleListView.php --- a/src/applications/phid/view/PHUIHandleListView.php +++ b/src/applications/phid/view/PHUIHandleListView.php @@ -13,6 +13,7 @@ private $handleList; private $asInline; private $asText; + private $showStateIcons; public function setHandleList(PhabricatorHandleList $list) { $this->handleList = $list; @@ -37,6 +38,15 @@ return $this->asText; } + public function setShowStateIcons($show_state_icons) { + $this->showStateIcons = $show_state_icons; + return $this; + } + + public function getShowStateIcons() { + return $this->showStateIcons; + } + protected function getTagName() { if ($this->getAsText()) { return null; @@ -49,12 +59,19 @@ protected function getTagContent() { $list = $this->handleList; + + $show_state_icons = $this->getShowStateIcons(); + $items = array(); foreach ($list as $handle) { $view = $list->renderHandle($handle->getPHID()) ->setShowHovercard(true) ->setAsText($this->getAsText()); + if ($show_state_icons) { + $view->setShowStateIcon(true); + } + $items[] = $view; } diff --git a/src/applications/phid/view/PHUIHandleView.php b/src/applications/phid/view/PHUIHandleView.php --- a/src/applications/phid/view/PHUIHandleView.php +++ b/src/applications/phid/view/PHUIHandleView.php @@ -17,6 +17,7 @@ private $asText; private $useShortName; private $showHovercard; + private $showStateIcon; public function setHandleList(PhabricatorHandleList $list) { $this->handleList = $list; @@ -48,6 +49,15 @@ return $this; } + public function setShowStateIcon($show_state_icon) { + $this->showStateIcon = $show_state_icon; + return $this; + } + + public function getShowStateIcon() { + return $this->showStateIcon; + } + public function render() { $handle = $this->handleList[$this->handlePHID]; @@ -77,6 +87,11 @@ $link = $handle->renderLink($name); } + if ($this->showStateIcon) { + $icon = $handle->renderStateIcon(); + $link = array($icon, ' ', $link); + } + return $link; } diff --git a/src/applications/repository/phid/PhabricatorRepositoryCommitPHIDType.php b/src/applications/repository/phid/PhabricatorRepositoryCommitPHIDType.php --- a/src/applications/repository/phid/PhabricatorRepositoryCommitPHIDType.php +++ b/src/applications/repository/phid/PhabricatorRepositoryCommitPHIDType.php @@ -81,6 +81,16 @@ $handle->setFullName($full_name); $handle->setURI($commit->getURI()); $handle->setTimestamp($commit->getEpoch()); + + $status = $commit->getAuditStatus(); + $icon = PhabricatorAuditCommitStatusConstants::getStatusIcon($status); + $color = PhabricatorAuditCommitStatusConstants::getStatusColor($status); + $name = PhabricatorAuditCommitStatusConstants::getStatusName($status); + + $handle + ->setStateIcon($icon) + ->setStateColor($color) + ->setStateName($name); } }