@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

When query panels overheat, degrade them and show a warning

Summary:
Depends on D20334. Ref T13272. After recent changes to make overheating queries throw by default, dashboard panels now fail into an error state when they overheat.

This is a big step up from the hard-coded homepage panels removed by D20333, but can be improved. Let these panels render partial results when they overheat and show a human-readable warning.

Test Plan: {F6314114}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13272

Differential Revision: https://secure.phabricator.com/D20335

+49 -9
+29 -1
src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php
··· 106 106 } 107 107 } 108 108 109 + $query->setReturnPartialResultsOnOverheat(true); 110 + 109 111 $results = $engine->executeQuery($query, $pager); 112 + $results_view = $engine->renderResults($results, $saved); 113 + 114 + $is_overheated = $query->getIsOverheated(); 115 + $overheated_view = null; 116 + if ($is_overheated) { 117 + $content = $results_view->getContent(); 110 118 111 - return $engine->renderResults($results, $saved); 119 + $overheated_message = 120 + PhabricatorApplicationSearchController::newOverheatedError( 121 + (bool)$results); 122 + 123 + $overheated_warning = id(new PHUIInfoView()) 124 + ->setSeverity(PHUIInfoView::SEVERITY_WARNING) 125 + ->setTitle(pht('Query Overheated')) 126 + ->setErrors( 127 + array( 128 + $overheated_message, 129 + )); 130 + 131 + $overheated_box = id(new PHUIBoxView()) 132 + ->addClass('mmt mmb') 133 + ->appendChild($overheated_warning); 134 + 135 + $content = array($content, $overheated_box); 136 + $results_view->setContent($content); 137 + } 138 + 139 + return $results_view; 112 140 } 113 141 114 142 public function adjustPanelHeader(
+20 -8
src/applications/search/controller/PhabricatorApplicationSearchController.php
··· 850 850 )); 851 851 } 852 852 853 - private function newOverheatedView(array $results) { 854 - if ($results) { 853 + public static function newOverheatedError($has_results) { 854 + $overheated_link = phutil_tag( 855 + 'a', 856 + array( 857 + 'href' => 'https://phurl.io/u/overheated', 858 + 'target' => '_blank', 859 + ), 860 + pht('Learn More')); 861 + 862 + if ($has_results) { 855 863 $message = pht( 856 - 'Most objects matching your query are not visible to you, so '. 857 - 'filtering results is taking a long time. Only some results are '. 858 - 'shown. Refine your query to find results more quickly.'); 864 + 'This query took too long, so only some results are shown. %s', 865 + $overheated_link); 859 866 } else { 860 867 $message = pht( 861 - 'Most objects matching your query are not visible to you, so '. 862 - 'filtering results is taking a long time. Refine your query to '. 863 - 'find results more quickly.'); 868 + 'This query took too long. %s', 869 + $overheated_link); 864 870 } 871 + 872 + return $message; 873 + } 874 + 875 + private function newOverheatedView(array $results) { 876 + $message = self::newOverheatedError((bool)$results); 865 877 866 878 return id(new PHUIInfoView()) 867 879 ->setSeverity(PHUIInfoView::SEVERITY_WARNING)