Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/graph/ManiphestTaskGraph.php
<?php | <?php | ||||
final class ManiphestTaskGraph | final class ManiphestTaskGraph | ||||
extends PhabricatorObjectGraph { | extends PhabricatorObjectGraph { | ||||
private $seedMaps = array(); | |||||
protected function getEdgeTypes() { | protected function getEdgeTypes() { | ||||
return array( | return array( | ||||
ManiphestTaskDependedOnByTaskEdgeType::EDGECONST, | ManiphestTaskDependedOnByTaskEdgeType::EDGECONST, | ||||
ManiphestTaskDependsOnTaskEdgeType::EDGECONST, | ManiphestTaskDependsOnTaskEdgeType::EDGECONST, | ||||
); | ); | ||||
} | } | ||||
protected function getParentEdgeType() { | protected function getParentEdgeType() { | ||||
Show All 38 Lines | if ($object) { | ||||
$link = phutil_tag( | $link = phutil_tag( | ||||
'a', | 'a', | ||||
array( | array( | ||||
'href' => $object->getURI(), | 'href' => $object->getURI(), | ||||
), | ), | ||||
$object->getTitle()); | $object->getTitle()); | ||||
$link = array( | $link = array( | ||||
$object->getMonogram(), | phutil_tag( | ||||
'span', | |||||
array( | |||||
'class' => 'object-name', | |||||
), | |||||
$object->getMonogram()), | |||||
' ', | ' ', | ||||
$link, | $link, | ||||
); | ); | ||||
} else { | } else { | ||||
$status = null; | $status = null; | ||||
$assigned = null; | $assigned = null; | ||||
$link = $viewer->renderHandle($phid); | $link = $viewer->renderHandle($phid); | ||||
} | } | ||||
if ($this->isParentTask($object)) { | |||||
$marker = 'fa-chevron-circle-up bluegrey'; | |||||
$marker_tip = pht('Direct Parent'); | |||||
} else if ($this->isChildTask($object)) { | |||||
$marker = 'fa-chevron-circle-down bluegrey'; | |||||
$marker_tip = pht('Direct Subtask'); | |||||
} else { | |||||
$marker = null; | |||||
} | |||||
if ($marker) { | |||||
$marker = id(new PHUIIconView()) | |||||
->setIcon($marker) | |||||
->addSigil('has-tooltip') | |||||
->setMetadata( | |||||
array( | |||||
'tip' => $marker_tip, | |||||
'align' => 'E', | |||||
)); | |||||
} | |||||
$link = AphrontTableView::renderSingleDisplayLine($link); | $link = AphrontTableView::renderSingleDisplayLine($link); | ||||
return array( | return array( | ||||
$marker, | |||||
$trace, | $trace, | ||||
$status, | $status, | ||||
$assigned, | $assigned, | ||||
$link, | $link, | ||||
); | ); | ||||
} | } | ||||
protected function newTable(AphrontTableView $table) { | protected function newTable(AphrontTableView $table) { | ||||
return $table | return $table | ||||
->setHeaders( | ->setHeaders( | ||||
array( | array( | ||||
null, | null, | ||||
null, | |||||
pht('Status'), | pht('Status'), | ||||
pht('Assigned'), | pht('Assigned'), | ||||
pht('Task'), | pht('Task'), | ||||
)) | )) | ||||
->setColumnClasses( | ->setColumnClasses( | ||||
array( | array( | ||||
'nudgeright', | |||||
'threads', | 'threads', | ||||
'graph-status', | 'graph-status', | ||||
null, | null, | ||||
'wide pri object-link', | 'wide pri object-link', | ||||
)); | )); | ||||
} | } | ||||
private function isParentTask(ManiphestTask $task) { | |||||
$map = $this->getSeedMap(ManiphestTaskDependedOnByTaskEdgeType::EDGECONST); | |||||
return isset($map[$task->getPHID()]); | |||||
} | |||||
private function isChildTask(ManiphestTask $task) { | |||||
$map = $this->getSeedMap(ManiphestTaskDependsOnTaskEdgeType::EDGECONST); | |||||
return isset($map[$task->getPHID()]); | |||||
} | |||||
private function getSeedMap($type) { | |||||
if (!isset($this->seedMaps[$type])) { | |||||
$maps = $this->getEdges($type); | |||||
$phids = idx($maps, $this->getSeedPHID(), array()); | |||||
$phids = array_fuse($phids); | |||||
$this->seedMaps[$type] = $phids; | |||||
} | |||||
return $this->seedMaps[$type]; | |||||
} | |||||
} | } |