Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/maniphest/controller/ManiphestTaskGraphController.php b/src/applications/maniphest/controller/ManiphestTaskGraphController.php
index 2f342a2d0f..f4655d1835 100644
--- a/src/applications/maniphest/controller/ManiphestTaskGraphController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskGraphController.php
@@ -1,125 +1,126 @@
<?php
final class ManiphestTaskGraphController
extends ManiphestController {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
$id = $request->getURIData('id');
$task = id(new ManiphestTaskQuery())
->setViewer($viewer)
->withIDs(array($id))
->executeOne();
if (!$task) {
return new Aphront404Response();
}
$crumbs = $this->buildApplicationCrumbs()
->addTextCrumb($task->getMonogram(), $task->getURI())
->addTextCrumb(pht('Graph'))
->setBorder(true);
$graph_limit = 2000;
$overflow_message = null;
$task_graph = id(new ManiphestTaskGraph())
->setViewer($viewer)
->setSeedPHID($task->getPHID())
->setLimit($graph_limit)
+ ->setIsStandalone(true)
->loadGraph();
if (!$task_graph->isEmpty()) {
$parent_type = ManiphestTaskDependedOnByTaskEdgeType::EDGECONST;
$subtask_type = ManiphestTaskDependsOnTaskEdgeType::EDGECONST;
$parent_map = $task_graph->getEdges($parent_type);
$subtask_map = $task_graph->getEdges($subtask_type);
$parent_list = idx($parent_map, $task->getPHID(), array());
$subtask_list = idx($subtask_map, $task->getPHID(), array());
$has_parents = (bool)$parent_list;
$has_subtasks = (bool)$subtask_list;
// First, get a count of direct parent tasks and subtasks. If there
// are too many of these, we just don't draw anything. You can use
// the search button to browse tasks with the search UI instead.
$direct_count = count($parent_list) + count($subtask_list);
if ($direct_count > $graph_limit) {
$overflow_message = pht(
'This task is directly connected to more than %s other tasks, '.
'which is too many tasks to display. Use %s to browse parents '.
'or subtasks.',
new PhutilNumber($graph_limit),
phutil_tag('strong', array(), pht('Search...')));
$graph_table = null;
} else {
// If there aren't too many direct tasks, but there are too many total
// tasks, we'll only render directly connected tasks.
if ($task_graph->isOverLimit()) {
$task_graph->setRenderOnlyAdjacentNodes(true);
$overflow_message = pht(
'This task is connected to more than %s other tasks. '.
'Only direct parents and subtasks are shown here.',
new PhutilNumber($graph_limit));
}
$graph_table = $task_graph->newGraphTable();
}
$graph_menu = $this->newTaskGraphDropdownMenu(
$task,
$has_parents,
$has_subtasks,
false);
} else {
$graph_menu = null;
$graph_table = null;
$overflow_message = pht(
'This task has no parent tasks and no subtasks, so there is no '.
'graph to draw.');
}
if ($overflow_message) {
$overflow_view = $this->newTaskGraphOverflowView(
$task,
$overflow_message,
false);
$graph_table = array(
$overflow_view,
$graph_table,
);
}
$header = id(new PHUIHeaderView())
->setHeader(pht('Task Graph'));
if ($graph_menu) {
$header->addActionLink($graph_menu);
}
$tab_view = id(new PHUIObjectBoxView())
->setHeader($header)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->appendChild($graph_table);
$view = id(new PHUITwoColumnView())
->setFooter($tab_view);
return $this->newPage()
->setTitle(
array(
$task->getMonogram(),
pht('Graph'),
))
->setCrumbs($crumbs)
->appendChild($view);
}
}
diff --git a/src/infrastructure/graph/ManiphestTaskGraph.php b/src/infrastructure/graph/ManiphestTaskGraph.php
index 99191760dd..74a1fe8701 100644
--- a/src/infrastructure/graph/ManiphestTaskGraph.php
+++ b/src/infrastructure/graph/ManiphestTaskGraph.php
@@ -1,170 +1,188 @@
<?php
final class ManiphestTaskGraph
extends PhabricatorObjectGraph {
private $seedMaps = array();
+ private $isStandalone;
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();
}
+ public function setIsStandalone($is_standalone) {
+ $this->isStandalone = $is_standalone;
+ return $this;
+ }
+
+ public function getIsStandalone() {
+ return $this->isStandalone;
+ }
+
protected function newTableRow($phid, $object, $trace) {
$viewer = $this->getViewer();
Javelin::initBehavior('phui-hovercards');
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 = javelin_tag(
'a',
array(
'href' => $object->getURI(),
'sigil' => 'hovercard',
'meta' => array(
'hoverPHID' => $object->getPHID(),
),
),
$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($phid)) {
$marker = 'fa-chevron-circle-up bluegrey';
$marker_tip = pht('Direct Parent');
} else if ($this->isChildTask($phid)) {
$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',
));
}
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',
))
->setColumnVisibility(
array(
true,
!$this->getRenderOnlyAdjacentNodes(),
+ ))
+ ->setDeviceVisibility(
+ array(
+ true,
+
+ // On mobile, we only show the actual graph drawing if we're on the
+ // standalone page, since it can take over the screen otherwise.
+ $this->getIsStandalone(),
));
}
private function isParentTask($task_phid) {
$map = $this->getSeedMap(ManiphestTaskDependedOnByTaskEdgeType::EDGECONST);
return isset($map[$task_phid]);
}
private function isChildTask($task_phid) {
$map = $this->getSeedMap(ManiphestTaskDependsOnTaskEdgeType::EDGECONST);
return isset($map[$task_phid]);
}
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];
}
protected function newEllipsisRow() {
return array(
null,
null,
null,
null,
pht("\xC2\xB7 \xC2\xB7 \xC2\xB7"),
);
}
}

File Metadata

Mime Type
text/x-diff
Expires
Thu, Feb 6, 6:46 PM (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34039
Default Alt Text
(8 KB)

Event Timeline