Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13967507
D16295.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D16295.diff
View Options
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
@@ -87,12 +87,25 @@
->addPropertySection(pht('Description'), $description)
->addPropertySection(pht('Details'), $details);
+ $graph_limit = 100;
$task_graph = id(new ManiphestTaskGraph())
->setViewer($viewer)
->setSeedPHID($task->getPHID())
+ ->setLimit($graph_limit)
->loadGraph();
if (!$task_graph->isEmpty()) {
- $graph_table = $task_graph->newGraphTable();
+ if ($task_graph->isOverLimit()) {
+ $message = pht(
+ 'Task graph too large to display (this task is connected to '.
+ 'more than %s other tasks).',
+ $graph_limit);
+ $message = phutil_tag('em', array(), $message);
+ $graph_table = id(new PHUIPropertyListView())
+ ->addTextContent($message);
+ } else {
+ $graph_table = $task_graph->newGraphTable();
+ }
+
$view->addPropertySection(pht('Task Graph'), $graph_table);
}
diff --git a/src/infrastructure/graph/PhabricatorObjectGraph.php b/src/infrastructure/graph/PhabricatorObjectGraph.php
--- a/src/infrastructure/graph/PhabricatorObjectGraph.php
+++ b/src/infrastructure/graph/PhabricatorObjectGraph.php
@@ -9,6 +9,7 @@
private $seedPHID;
private $objects;
private $loadEntireGraph = false;
+ private $limit;
public function setViewer(PhabricatorUser $viewer) {
$this->viewer = $viewer;
@@ -23,6 +24,15 @@
return $this->viewer;
}
+ public function setLimit($limit) {
+ $this->limit = $limit;
+ return $this;
+ }
+
+ public function getLimit() {
+ return $this->limit;
+ }
+
abstract protected function getEdgeTypes();
abstract protected function getParentEdgeType();
abstract protected function newQuery();
@@ -44,6 +54,16 @@
return (count($this->getNodes()) <= 2);
}
+ final public function isOverLimit() {
+ $limit = $this->getLimit();
+
+ if (!$limit) {
+ return false;
+ }
+
+ return (count($this->edgeReach) > $limit);
+ }
+
final public function getEdges($type) {
$edges = idx($this->edges, $type, array());
@@ -72,6 +92,10 @@
}
final protected function loadEdges(array $nodes) {
+ if ($this->isOverLimit()) {
+ return array_fill_keys($nodes, array());
+ }
+
$edge_types = $this->getEdgeTypes();
$query = id(new PhabricatorEdgeQuery())
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 17 2024, 2:03 PM (4 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6710291
Default Alt Text
D16295.diff (2 KB)
Attached To
Mode
D16295: For now, hard limit task graph at 100 nodes
Attached
Detach File
Event Timeline
Log In to Comment