Page MenuHomePhabricator

D20335.diff
No OneTemporary

D20335.diff

diff --git a/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php b/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php
--- a/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php
+++ b/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php
@@ -106,9 +106,37 @@
}
}
+ $query->setReturnPartialResultsOnOverheat(true);
+
$results = $engine->executeQuery($query, $pager);
+ $results_view = $engine->renderResults($results, $saved);
+
+ $is_overheated = $query->getIsOverheated();
+ $overheated_view = null;
+ if ($is_overheated) {
+ $content = $results_view->getContent();
+
+ $overheated_message =
+ PhabricatorApplicationSearchController::newOverheatedError(
+ (bool)$results);
+
+ $overheated_warning = id(new PHUIInfoView())
+ ->setSeverity(PHUIInfoView::SEVERITY_WARNING)
+ ->setTitle(pht('Query Overheated'))
+ ->setErrors(
+ array(
+ $overheated_message,
+ ));
+
+ $overheated_box = id(new PHUIBoxView())
+ ->addClass('mmt mmb')
+ ->appendChild($overheated_warning);
+
+ $content = array($content, $overheated_box);
+ $results_view->setContent($content);
+ }
- return $engine->renderResults($results, $saved);
+ return $results_view;
}
public function adjustPanelHeader(
diff --git a/src/applications/search/controller/PhabricatorApplicationSearchController.php b/src/applications/search/controller/PhabricatorApplicationSearchController.php
--- a/src/applications/search/controller/PhabricatorApplicationSearchController.php
+++ b/src/applications/search/controller/PhabricatorApplicationSearchController.php
@@ -850,19 +850,31 @@
));
}
- private function newOverheatedView(array $results) {
- if ($results) {
+ public static function newOverheatedError($has_results) {
+ $overheated_link = phutil_tag(
+ 'a',
+ array(
+ 'href' => 'https://phurl.io/u/overheated',
+ 'target' => '_blank',
+ ),
+ pht('Learn More'));
+
+ if ($has_results) {
$message = pht(
- 'Most objects matching your query are not visible to you, so '.
- 'filtering results is taking a long time. Only some results are '.
- 'shown. Refine your query to find results more quickly.');
+ 'This query took too long, so only some results are shown. %s',
+ $overheated_link);
} else {
$message = pht(
- 'Most objects matching your query are not visible to you, so '.
- 'filtering results is taking a long time. Refine your query to '.
- 'find results more quickly.');
+ 'This query took too long. %s',
+ $overheated_link);
}
+ return $message;
+ }
+
+ private function newOverheatedView(array $results) {
+ $message = self::newOverheatedError((bool)$results);
+
return id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_WARNING)
->setFlush(true)

File Metadata

Mime Type
text/plain
Expires
Mar 15 2025, 3:48 AM (5 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7682320
Default Alt Text
D20335.diff (2 KB)

Event Timeline