mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-03 20:22:46 +01:00
cebf4bbec6
Summary: Fixes T11386. Ref T4788. - Apparently fix weird strikethrough effect? Spooky! - Provide a little icon hint in the left column about which tasks are direct parents/children, vs just reachable somehow. I don't think this is super useful/important, but seems maybe nice? Test Plan: {F1740779} Reviewers: chad Reviewed By: chad Maniphest Tasks: T4788, T11386 Differential Revision: https://secure.phabricator.com/D16342
151 lines
3.5 KiB
PHP
151 lines
3.5 KiB
PHP
<?php
|
|
|
|
final class ManiphestTaskGraph
|
|
extends PhabricatorObjectGraph {
|
|
|
|
private $seedMaps = array();
|
|
|
|
protected function getEdgeTypes() {
|
|
return array(
|
|
ManiphestTaskDependedOnByTaskEdgeType::EDGECONST,
|
|
ManiphestTaskDependsOnTaskEdgeType::EDGECONST,
|
|
);
|
|
}
|
|
|
|
protected function getParentEdgeType() {
|
|
return ManiphestTaskDependsOnTaskEdgeType::EDGECONST;
|
|
}
|
|
|
|
protected function newQuery() {
|
|
return new ManiphestTaskQuery();
|
|
}
|
|
|
|
protected function isClosed($object) {
|
|
return $object->isClosed();
|
|
}
|
|
|
|
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);
|
|
|
|
$priority_color = ManiphestTaskPriority::getTaskPriorityColor($priority);
|
|
if ($object->isClosed()) {
|
|
$priority_color = 'grey';
|
|
}
|
|
|
|
$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(),
|
|
),
|
|
$object->getTitle());
|
|
|
|
$link = array(
|
|
phutil_tag(
|
|
'span',
|
|
array(
|
|
'class' => 'object-name',
|
|
),
|
|
$object->getMonogram()),
|
|
' ',
|
|
$link,
|
|
);
|
|
} else {
|
|
$status = null;
|
|
$assigned = null;
|
|
$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);
|
|
|
|
return array(
|
|
$marker,
|
|
$trace,
|
|
$status,
|
|
$assigned,
|
|
$link,
|
|
);
|
|
}
|
|
|
|
protected function newTable(AphrontTableView $table) {
|
|
return $table
|
|
->setHeaders(
|
|
array(
|
|
null,
|
|
null,
|
|
pht('Status'),
|
|
pht('Assigned'),
|
|
pht('Task'),
|
|
))
|
|
->setColumnClasses(
|
|
array(
|
|
'nudgeright',
|
|
'threads',
|
|
'graph-status',
|
|
null,
|
|
'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];
|
|
}
|
|
}
|