2016-07-01 17:50:16 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class ManiphestTaskGraph
|
|
|
|
extends PhabricatorObjectGraph {
|
|
|
|
|
2016-07-28 20:45:42 +02:00
|
|
|
private $seedMaps = array();
|
|
|
|
|
2016-07-01 17:50:16 +02:00
|
|
|
protected function getEdgeTypes() {
|
|
|
|
return array(
|
|
|
|
ManiphestTaskDependedOnByTaskEdgeType::EDGECONST,
|
|
|
|
ManiphestTaskDependsOnTaskEdgeType::EDGECONST,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getParentEdgeType() {
|
|
|
|
return ManiphestTaskDependsOnTaskEdgeType::EDGECONST;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function newQuery() {
|
|
|
|
return new ManiphestTaskQuery();
|
|
|
|
}
|
|
|
|
|
2016-07-01 21:53:41 +02:00
|
|
|
protected function isClosed($object) {
|
|
|
|
return $object->isClosed();
|
|
|
|
}
|
|
|
|
|
2016-07-01 17:50:16 +02:00
|
|
|
protected function newTableRow($phid, $object, $trace) {
|
|
|
|
$viewer = $this->getViewer();
|
|
|
|
|
|
|
|
if ($object) {
|
|
|
|
$status = $object->getStatus();
|
|
|
|
$priority = $object->getPriority();
|
|
|
|
$status_icon = ManiphestTaskStatus::getStatusIcon($status);
|
|
|
|
$status_name = ManiphestTaskStatus::getTaskStatusName($status);
|
|
|
|
|
2016-07-01 21:59:15 +02:00
|
|
|
$priority_color = ManiphestTaskPriority::getTaskPriorityColor($priority);
|
|
|
|
if ($object->isClosed()) {
|
|
|
|
$priority_color = 'grey';
|
|
|
|
}
|
2016-07-01 17:50:16 +02:00
|
|
|
|
|
|
|
$status = array(
|
|
|
|
id(new PHUIIconView())->setIcon($status_icon, $priority_color),
|
|
|
|
' ',
|
|
|
|
$status_name,
|
|
|
|
);
|
|
|
|
|
|
|
|
$owner_phid = $object->getOwnerPHID();
|
|
|
|
if ($owner_phid) {
|
|
|
|
$assigned = $viewer->renderHandle($owner_phid);
|
|
|
|
} else {
|
|
|
|
$assigned = phutil_tag('em', array(), pht('None'));
|
|
|
|
}
|
|
|
|
|
|
|
|
$link = phutil_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => $object->getURI(),
|
|
|
|
),
|
2016-07-01 22:30:42 +02:00
|
|
|
$object->getTitle());
|
|
|
|
|
|
|
|
$link = array(
|
2016-07-28 20:45:42 +02:00
|
|
|
phutil_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'object-name',
|
|
|
|
),
|
|
|
|
$object->getMonogram()),
|
2016-07-01 22:30:42 +02:00
|
|
|
' ',
|
|
|
|
$link,
|
|
|
|
);
|
2016-07-01 17:50:16 +02:00
|
|
|
} else {
|
|
|
|
$status = null;
|
|
|
|
$assigned = null;
|
|
|
|
$link = $viewer->renderHandle($phid);
|
|
|
|
}
|
|
|
|
|
2016-07-28 20:45:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
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',
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2016-07-05 15:50:40 +02:00
|
|
|
$link = AphrontTableView::renderSingleDisplayLine($link);
|
|
|
|
|
2016-07-01 17:50:16 +02:00
|
|
|
return array(
|
2016-07-28 20:45:42 +02:00
|
|
|
$marker,
|
2016-07-01 17:50:16 +02:00
|
|
|
$trace,
|
|
|
|
$status,
|
|
|
|
$assigned,
|
|
|
|
$link,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function newTable(AphrontTableView $table) {
|
|
|
|
return $table
|
|
|
|
->setHeaders(
|
|
|
|
array(
|
2016-07-28 20:45:42 +02:00
|
|
|
null,
|
2016-07-01 17:50:16 +02:00
|
|
|
null,
|
|
|
|
pht('Status'),
|
|
|
|
pht('Assigned'),
|
|
|
|
pht('Task'),
|
|
|
|
))
|
|
|
|
->setColumnClasses(
|
|
|
|
array(
|
2016-07-28 20:45:42 +02:00
|
|
|
'nudgeright',
|
2016-07-01 17:50:16 +02:00
|
|
|
'threads',
|
2016-07-01 21:53:41 +02:00
|
|
|
'graph-status',
|
2016-07-01 17:50:16 +02:00
|
|
|
null,
|
2016-07-01 22:30:42 +02:00
|
|
|
'wide pri object-link',
|
2016-07-01 17:50:16 +02:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
2016-07-28 20:45:42 +02:00
|
|
|
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];
|
|
|
|
}
|
2016-07-28 22:54:10 +02:00
|
|
|
|
|
|
|
protected function newEllipsisRow() {
|
|
|
|
return array(
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
pht("\xC2\xB7 \xC2\xB7 \xC2\xB7"),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-07-01 17:50:16 +02:00
|
|
|
}
|