1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Show rest of task page when graph errors out

Summary: T15772.

Test Plan: Add a `throw` statement in graph calculation, load a task that has a graph, see message.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25570
This commit is contained in:
Aviv Eyal 2024-04-05 10:28:42 +03:00
parent 644f179dd2
commit ecbef3fdf4

View file

@ -81,7 +81,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
$graph_menu = null; $graph_menu = null;
$graph_limit = 200; $graph_limit = 200;
$overflow_message = null; $graph_error_message = null;
$task_graph = id(new ManiphestTaskGraph()) $task_graph = id(new ManiphestTaskGraph())
->setViewer($viewer) ->setViewer($viewer)
->setSeedPHID($task->getPHID()) ->setSeedPHID($task->getPHID())
@ -102,8 +102,9 @@ final class ManiphestTaskDetailController extends ManiphestController {
// the search button to browse tasks with the search UI instead. // the search button to browse tasks with the search UI instead.
$direct_count = count($parent_list) + count($subtask_list); $direct_count = count($parent_list) + count($subtask_list);
$graph_table = null;
if ($direct_count > $graph_limit) { if ($direct_count > $graph_limit) {
$overflow_message = pht( $graph_error_message = pht(
'This task is directly connected to more than %s other tasks. '. 'This task is directly connected to more than %s other tasks. '.
'Use %s to browse parents or subtasks, or %s to show more of the '. 'Use %s to browse parents or subtasks, or %s to show more of the '.
'graph.', 'graph.',
@ -111,14 +112,13 @@ final class ManiphestTaskDetailController extends ManiphestController {
phutil_tag('strong', array(), pht('Search...')), phutil_tag('strong', array(), pht('Search...')),
phutil_tag('strong', array(), pht('View Standalone Graph'))); phutil_tag('strong', array(), pht('View Standalone Graph')));
$graph_table = null;
} else { } else {
// If there aren't too many direct tasks, but there are too many total // If there aren't too many direct tasks, but there are too many total
// tasks, we'll only render directly connected tasks. // tasks, we'll only render directly connected tasks.
if ($task_graph->isOverLimit()) { if ($task_graph->isOverLimit()) {
$task_graph->setRenderOnlyAdjacentNodes(true); $task_graph->setRenderOnlyAdjacentNodes(true);
$overflow_message = pht( $graph_error_message = pht(
'This task is connected to more than %s other tasks. '. 'This task is connected to more than %s other tasks. '.
'Only direct parents and subtasks are shown here. Use '. 'Only direct parents and subtasks are shown here. Use '.
'%s to show more of the graph.', '%s to show more of the graph.',
@ -126,13 +126,22 @@ final class ManiphestTaskDetailController extends ManiphestController {
phutil_tag('strong', array(), pht('View Standalone Graph'))); phutil_tag('strong', array(), pht('View Standalone Graph')));
} }
try {
$graph_table = $task_graph->newGraphTable(); $graph_table = $task_graph->newGraphTable();
} catch (Throwable $ex) {
phlog($ex);
$graph_error_message = pht(
'There was an unexpected error displaying the task graph. '.
'Use %s to browse parents or subtasks, or %s to show the graph.',
phutil_tag('strong', array(), pht('Search...')),
phutil_tag('strong', array(), pht('View Standalone Graph')));
}
} }
if ($overflow_message) { if ($graph_error_message) {
$overflow_view = $this->newTaskGraphOverflowView( $overflow_view = $this->newTaskGraphOverflowView(
$task, $task,
$overflow_message, $graph_error_message,
true); true);
$graph_table = array( $graph_table = array(