From 73feac47c708db45b6fe5322b0dc9c7ddd0a2140 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 27 Mar 2019 10:40:23 -0700 Subject: [PATCH] When query panels have more results, show a "View All Results" button at the bottom Summary: Depends on D20335. Ref T13263. Ref T13272. See PHI854. Ref T9903. Currently, we don't provide a clear indicator that a query panel is showing a partial result set (UI looks the same whether there are more results or not). We also don't provide any way to get to the full result set (regardless of whether it is the same as the visible set or not) on tab panels, since they don't inherit the header buttons. To (mostly) fix these problems, add a "View All Results" button at the bottom of the list if the panel shows only a subset of results. Test Plan: {F6314560} {F6314562} {F6314564} Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13272, T13263, T9903 Differential Revision: https://secure.phabricator.com/D20336 --- .../PhabricatorDashboardQueryPanelType.php | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php b/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php index 3c77da48dc..a71263b27e 100644 --- a/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php +++ b/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php @@ -136,6 +136,33 @@ final class PhabricatorDashboardQueryPanelType $results_view->setContent($content); } + if ($pager->getHasMoreResults()) { + $item_list = $results_view->getObjectList(); + + $more_href = $engine->getQueryResultsPageURI($key); + if ($item_list) { + $item_list->newTailButton() + ->setHref($more_href); + } else { + // For search engines that do not return an object list, add a fake + // one to the end so we can render a "View All Results" button that + // looks like it does in normal applications. At time of writing, + // several major applications like Maniphest (which has group headers) + // and Feed (which uses custom rendering) don't return simple lists. + + $content = $results_view->getContent(); + + $more_list = id(new PHUIObjectItemListView()) + ->setAllowEmptyList(true); + + $more_list->newTailButton() + ->setHref($more_href); + + $content = array($content, $more_list); + $results_view->setContent($content); + } + } + return $results_view; }