1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 12:52:42 +01:00

[Redesign] PhabricatorApplicationSearchResultView

Summary: Ref T8099. This adds a new class which all search engines return for layout. I thought about this a number of ways, and I think this is the cleanest path. Each Engine can return whatever UI bits they needs, and AppSearch or Dashboard picks and lays the bits out as needed. In the AppSearch case, interfaces like Notifications, Calendar, Legalpad all need more custom layouts. I think this also leaves a resonable path forward for NUX as well. Also, not sure I implemented the class correctly, but assume thats easy to fix?

Test Plan: Review and do a search in each application changed. Grep for all call sites.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T8099

Differential Revision: https://secure.phabricator.com/D13332
This commit is contained in:
Chad Little 2015-06-19 11:46:20 +01:00
parent 29ac80be5c
commit 801607381d
63 changed files with 451 additions and 117 deletions

View file

@ -7,7 +7,7 @@
*/ */
return array( return array(
'names' => array( 'names' => array(
'core.pkg.css' => 'df3a0e9c', 'core.pkg.css' => '96a7378c',
'core.pkg.js' => '41f5edc5', 'core.pkg.js' => '41f5edc5',
'darkconsole.pkg.js' => 'e7393ebb', 'darkconsole.pkg.js' => 'e7393ebb',
'differential.pkg.css' => 'fe951924', 'differential.pkg.css' => 'fe951924',
@ -25,7 +25,7 @@ return array(
'rsrc/css/aphront/notification.css' => '9c279160', 'rsrc/css/aphront/notification.css' => '9c279160',
'rsrc/css/aphront/panel-view.css' => '8427b78d', 'rsrc/css/aphront/panel-view.css' => '8427b78d',
'rsrc/css/aphront/phabricator-nav-view.css' => '0ecd30a1', 'rsrc/css/aphront/phabricator-nav-view.css' => '0ecd30a1',
'rsrc/css/aphront/table-view.css' => '4f2ed0bf', 'rsrc/css/aphront/table-view.css' => 'e3632cc9',
'rsrc/css/aphront/tokenizer.css' => '04875312', 'rsrc/css/aphront/tokenizer.css' => '04875312',
'rsrc/css/aphront/tooltip.css' => '7672b60f', 'rsrc/css/aphront/tooltip.css' => '7672b60f',
'rsrc/css/aphront/two-column.css' => '16ab3ad2', 'rsrc/css/aphront/two-column.css' => '16ab3ad2',
@ -34,7 +34,7 @@ return array(
'rsrc/css/application/almanac/almanac.css' => 'dbb9b3af', 'rsrc/css/application/almanac/almanac.css' => 'dbb9b3af',
'rsrc/css/application/auth/auth.css' => '44975d4b', 'rsrc/css/application/auth/auth.css' => '44975d4b',
'rsrc/css/application/base/main-menu-view.css' => '44b4a289', 'rsrc/css/application/base/main-menu-view.css' => '44b4a289',
'rsrc/css/application/base/notification-menu.css' => '713df25a', 'rsrc/css/application/base/notification-menu.css' => 'f31c0bde',
'rsrc/css/application/base/phabricator-application-launch-view.css' => '9a233ed6', 'rsrc/css/application/base/phabricator-application-launch-view.css' => '9a233ed6',
'rsrc/css/application/base/phui-theme.css' => '1ccdcc84', 'rsrc/css/application/base/phui-theme.css' => '1ccdcc84',
'rsrc/css/application/base/standard-page-view.css' => '43045fb4', 'rsrc/css/application/base/standard-page-view.css' => '43045fb4',
@ -488,7 +488,7 @@ return array(
'aphront-list-filter-view-css' => 'aa5ffcb9', 'aphront-list-filter-view-css' => 'aa5ffcb9',
'aphront-multi-column-view-css' => 'fd18389d', 'aphront-multi-column-view-css' => 'fd18389d',
'aphront-panel-view-css' => '8427b78d', 'aphront-panel-view-css' => '8427b78d',
'aphront-table-view-css' => '4f2ed0bf', 'aphront-table-view-css' => 'e3632cc9',
'aphront-tokenizer-control-css' => '04875312', 'aphront-tokenizer-control-css' => '04875312',
'aphront-tooltip-css' => '7672b60f', 'aphront-tooltip-css' => '7672b60f',
'aphront-two-column-view-css' => '16ab3ad2', 'aphront-two-column-view-css' => '16ab3ad2',
@ -726,7 +726,7 @@ return array(
'phabricator-nav-view-css' => '0ecd30a1', 'phabricator-nav-view-css' => '0ecd30a1',
'phabricator-notification' => '0c6946e7', 'phabricator-notification' => '0c6946e7',
'phabricator-notification-css' => '9c279160', 'phabricator-notification-css' => '9c279160',
'phabricator-notification-menu-css' => '713df25a', 'phabricator-notification-menu-css' => 'f31c0bde',
'phabricator-object-selector-css' => '029a133d', 'phabricator-object-selector-css' => '029a133d',
'phabricator-phtize' => 'd254d646', 'phabricator-phtize' => 'd254d646',
'phabricator-prefab' => '6920d200', 'phabricator-prefab' => '6920d200',

View file

@ -1340,6 +1340,7 @@ phutil_register_library_map(array(
'PhabricatorApplicationSearchController' => 'applications/search/controller/PhabricatorApplicationSearchController.php', 'PhabricatorApplicationSearchController' => 'applications/search/controller/PhabricatorApplicationSearchController.php',
'PhabricatorApplicationSearchEngine' => 'applications/search/engine/PhabricatorApplicationSearchEngine.php', 'PhabricatorApplicationSearchEngine' => 'applications/search/engine/PhabricatorApplicationSearchEngine.php',
'PhabricatorApplicationSearchEngineTestCase' => 'applications/search/engine/__tests__/PhabricatorApplicationSearchEngineTestCase.php', 'PhabricatorApplicationSearchEngineTestCase' => 'applications/search/engine/__tests__/PhabricatorApplicationSearchEngineTestCase.php',
'PhabricatorApplicationSearchResultView' => 'applications/search/view/PhabricatorApplicationSearchResultView.php',
'PhabricatorApplicationSearchResultsControllerInterface' => 'applications/search/interface/PhabricatorApplicationSearchResultsControllerInterface.php', 'PhabricatorApplicationSearchResultsControllerInterface' => 'applications/search/interface/PhabricatorApplicationSearchResultsControllerInterface.php',
'PhabricatorApplicationStatusView' => 'applications/meta/view/PhabricatorApplicationStatusView.php', 'PhabricatorApplicationStatusView' => 'applications/meta/view/PhabricatorApplicationStatusView.php',
'PhabricatorApplicationTestCase' => 'applications/base/__tests__/PhabricatorApplicationTestCase.php', 'PhabricatorApplicationTestCase' => 'applications/base/__tests__/PhabricatorApplicationTestCase.php',
@ -4845,6 +4846,7 @@ phutil_register_library_map(array(
'PhabricatorApplicationSearchController' => 'PhabricatorSearchBaseController', 'PhabricatorApplicationSearchController' => 'PhabricatorSearchBaseController',
'PhabricatorApplicationSearchEngine' => 'Phobject', 'PhabricatorApplicationSearchEngine' => 'Phobject',
'PhabricatorApplicationSearchEngineTestCase' => 'PhabricatorTestCase', 'PhabricatorApplicationSearchEngineTestCase' => 'PhabricatorTestCase',
'PhabricatorApplicationSearchResultView' => 'Phobject',
'PhabricatorApplicationStatusView' => 'AphrontView', 'PhabricatorApplicationStatusView' => 'AphrontView',
'PhabricatorApplicationTestCase' => 'PhabricatorTestCase', 'PhabricatorApplicationTestCase' => 'PhabricatorTestCase',
'PhabricatorApplicationTransaction' => array( 'PhabricatorApplicationTransaction' => array(

View file

@ -78,7 +78,11 @@ final class AlmanacDeviceSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No Almanac Devices found.'));
return $result;
} }
} }

View file

@ -80,6 +80,10 @@ final class AlmanacNetworkSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No Almanac Networks found.'));
return $result;
} }
} }

View file

@ -90,6 +90,10 @@ final class AlmanacServiceSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No Almanac Services found.'));
return $result;
} }
} }

View file

@ -206,8 +206,12 @@ final class PhabricatorCommitSearchEngine
} }
$view->setHandles($handles); $view->setHandles($handles);
$list = $view->buildList();
return $view->buildList(); $result = new PhabricatorApplicationSearchResultView();
$result->setContent($list);
return $result;
} }
} }

View file

@ -102,8 +102,9 @@ final class PhabricatorAuthInviteSearchEngine
'right', 'right',
)); ));
return id(new PHUIObjectBoxView()) $result = new PhabricatorApplicationSearchResultView();
->setHeaderText(pht('Email Invitations')) $result->setTable($table);
->setTable($table);
return $result;
} }
} }

View file

@ -328,7 +328,11 @@ final class PhabricatorCalendarEventSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No events found.'));
return $result;
} }
private function buildCalendarView( private function buildCalendarView(
@ -385,7 +389,11 @@ final class PhabricatorCalendarEventSearchEngine
$month_view->setBrowseURI( $month_view->setBrowseURI(
$this->getURI('query/'.$query->getQueryKey().'/')); $this->getURI('query/'.$query->getQueryKey().'/'));
return $month_view; // TODO redesign-2015 : Move buttons out of PHUICalendarView?
$result = new PhabricatorApplicationSearchResultView();
$result->setContent($month_view);
return $result;
} }
private function buildCalendarDayView( private function buildCalendarDayView(
@ -436,7 +444,10 @@ final class PhabricatorCalendarEventSearchEngine
$day_view->setBrowseURI( $day_view->setBrowseURI(
$this->getURI('query/'.$query->getQueryKey().'/')); $this->getURI('query/'.$query->getQueryKey().'/'));
return $day_view; $result = new PhabricatorApplicationSearchResultView();
$result->setContent($day_view);
return $result;
} }
private function getDisplayYearAndMonthAndDay( private function getDisplayYearAndMonthAndDay(

View file

@ -196,7 +196,10 @@ final class PhabricatorConduitSearchEngine
$out[] = $list; $out[] = $list;
} }
return $out; $result = new PhabricatorApplicationSearchResultView();
$result->setContent($out);
return $result;
} }
} }

View file

@ -253,7 +253,11 @@ final class ConpherenceThreadSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No threads found.'));
return $result;
} }
private function getTypeOptions() { private function getTypeOptions() {

View file

@ -140,7 +140,11 @@ final class PhabricatorCountdownSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No countdowns found.'));
return $result;
} }
} }

View file

@ -185,9 +185,25 @@ final class PhabricatorDashboardPanelRenderingEngine extends Phobject {
if (!$id) { if (!$id) {
$id = celerity_generate_unique_node_id(); $id = celerity_generate_unique_node_id();
} }
$box = id(new PHUIObjectBoxView())
->setHeader($header) $box = new PHUIObjectBoxView();
->appendChild($content)
$interface = 'PhabricatorApplicationSearchResultView';
if ($content instanceof $interface) {
if ($content->getObjectList()) {
$box->setObjectList($content->getObjectList());
}
if ($content->getTable()) {
$box->setTable($content->getTable());
}
if ($content->getContent()) {
$box->appendChild($content->getContent());
}
} else {
$box->appendChild($content);
}
$box->setHeader($header)
->setID($id) ->setID($id)
->addSigil('dashboard-panel') ->addSigil('dashboard-panel')
->setMetadata(array('objectPHID' => $panel->getPHID())); ->setMetadata(array('objectPHID' => $panel->getPHID()));

View file

@ -132,7 +132,11 @@ final class PhabricatorDashboardPanelSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No panels found.'));
return $result;
} }
} }

View file

@ -104,7 +104,12 @@ final class PhabricatorDashboardSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No dashboards found.'));
return $result;
} }
} }

View file

@ -323,10 +323,15 @@ final class DifferentialRevisionSearchEngine
if (count($views) == 1) { if (count($views) == 1) {
// Reduce this to a PHUIObjectItemListView so we can get the free // Reduce this to a PHUIObjectItemListView so we can get the free
// support from ApplicationSearch. // support from ApplicationSearch.
return head($views)->render(); $list = head($views)->render();
} else { } else {
return $views; $list = $views;
} }
$result = new PhabricatorApplicationSearchResultView();
$result->setContent($list);
return $result;
} }
} }

View file

@ -116,7 +116,11 @@ final class DivinerAtomSearchEngine extends PhabricatorApplicationSearchEngine {
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No books found.'));
return $result;
} }
} }

View file

@ -69,7 +69,11 @@ final class DrydockBlueprintSearchEngine
$view->addItem($item); $view->addItem($item);
} }
return $view; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($view);
$result->setNoDataString(pht('No blueprints found.'));
return $result;
} }
} }

View file

@ -89,10 +89,14 @@ final class DrydockLeaseSearchEngine
PhabricatorSavedQuery $saved, PhabricatorSavedQuery $saved,
array $handles) { array $handles) {
return id(new DrydockLeaseListView()) $list = id(new DrydockLeaseListView())
->setUser($this->requireViewer()) ->setUser($this->requireViewer())
->setLeases($leases) ->setLeases($leases);
->render();
$result = new PhabricatorApplicationSearchResultView();
$result->setTable($list);
return $result;
} }
} }

View file

@ -49,10 +49,14 @@ final class DrydockLogSearchEngine extends PhabricatorApplicationSearchEngine {
PhabricatorSavedQuery $query, PhabricatorSavedQuery $query,
array $handles) { array $handles) {
return id(new DrydockLogListView()) $list = id(new DrydockLogListView())
->setUser($this->requireViewer()) ->setUser($this->requireViewer())
->setLogs($logs) ->setLogs($logs);
->render();
$result = new PhabricatorApplicationSearchResultView();
$result->setTable($list);
return $result;
} }
} }

View file

@ -87,10 +87,14 @@ final class DrydockResourceSearchEngine
PhabricatorSavedQuery $query, PhabricatorSavedQuery $query,
array $handles) { array $handles) {
return id(new DrydockResourceListView()) $list = id(new DrydockResourceListView())
->setUser($this->requireViewer()) ->setUser($this->requireViewer())
->setResources($resources) ->setResources($resources);
->render();
$result = new PhabricatorApplicationSearchResultView();
$result->setTable($list);
return $result;
} }
} }

View file

@ -139,7 +139,12 @@ final class PhabricatorFeedSearchEngine
$builder->setUser($this->requireViewer()); $builder->setUser($this->requireViewer());
$view = $builder->buildView(); $view = $builder->buildView();
return phutil_tag_div('phabricator-feed-frame', $view); $list = phutil_tag_div('phabricator-feed-frame', $view);
$result = new PhabricatorApplicationSearchResultView();
$result->setContent($list);
return $result;
} }
} }

View file

@ -171,7 +171,11 @@ final class PhabricatorFileSearchEngine
$list_view->appendChild(id(new PhabricatorGlobalUploadTargetView()) $list_view->appendChild(id(new PhabricatorGlobalUploadTargetView())
->setUser($viewer)); ->setUser($viewer));
return $list_view;
$result = new PhabricatorApplicationSearchResultView();
$result->setContent($list_view);
return $result;
} }
} }

View file

@ -180,7 +180,12 @@ final class PhabricatorFlagSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No flags found.'));
return $result;
} }

View file

@ -141,7 +141,10 @@ final class FundBackerSearchEngine
'right', 'right',
)); ));
return $table; $result = new PhabricatorApplicationSearchResultView();
$result->setTable($table);
return $result;
} }
} }

View file

@ -163,6 +163,12 @@ final class FundInitiativeSearchEngine
$list->addItem($item); $list->addItem($item);
} }
$result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No initiatives found.'));
return $result;
return $list; return $list;
} }

View file

@ -93,7 +93,12 @@ final class HarbormasterBuildPlanSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No build plans found.'));
return $result;
} }
} }

View file

@ -216,7 +216,11 @@ final class HarbormasterBuildableSearchEngine
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No buildables found.'));
return $result;
} }
} }

View file

@ -209,7 +209,12 @@ final class HeraldRuleSearchEngine extends PhabricatorApplicationSearchEngine {
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No rules found.'));
return $result;
} }
} }

View file

@ -133,7 +133,11 @@ final class HeraldTranscriptSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No transcripts found.'));
return $result;
} }
} }

View file

@ -209,7 +209,11 @@ final class LegalpadDocumentSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No documents found.'));
return $result;
} }
} }

View file

@ -267,18 +267,17 @@ final class LegalpadDocumentSignatureSearchEngine
'right', 'right',
)); ));
// TODO redesign-2015 : Talk to epriestley about 'correct' way to implelment $button = null;
/* if ($this->document) { if ($this->document) {
$document_id = $this->document->getID(); $document_id = $this->document->getID();
$header->addActionLink( $button = id(new PHUIButtonView())
id(new PHUIButtonView()) ->setText(pht('Add Exemption'))
->setText(pht('Add Signature Exemption'))
->setTag('a') ->setTag('a')
->setHref($this->getApplicationURI('addsignature/'.$document_id.'/')) ->setHref($this->getApplicationURI('addsignature/'.$document_id.'/'))
->setWorkflow(true) ->setWorkflow(true)
->setIcon(id(new PHUIIconView())->setIconFont('fa-pencil'))); ->setIcon(id(new PHUIIconView())->setIconFont('fa-pencil'));
}*/ }
if (!$this->document) { if (!$this->document) {
$table->setNotice( $table->setNotice(
@ -286,7 +285,14 @@ final class LegalpadDocumentSignatureSearchEngine
'documents you have permission to edit.')); 'documents you have permission to edit.'));
} }
return $table; $result = new PhabricatorApplicationSearchResultView();
$result->setTable($table);
if ($button) {
$result->addAction($button);
}
return $result;
} }
private function renderIcon($icon, $color, $title) { private function renderIcon($icon, $color, $title) {

View file

@ -181,7 +181,10 @@ final class PhabricatorMacroSearchEngine
$pinboard->addItem($item); $pinboard->addItem($item);
} }
return $pinboard; $result = new PhabricatorApplicationSearchResultView();
$result->setContent($pinboard);
return $result;
} }
} }

View file

@ -316,13 +316,18 @@ final class ManiphestTaskSearchEngine
ManiphestBulkEditCapability::CAPABILITY); ManiphestBulkEditCapability::CAPABILITY);
} }
return id(new ManiphestTaskResultListView()) $list = id(new ManiphestTaskResultListView())
->setUser($viewer) ->setUser($viewer)
->setTasks($tasks) ->setTasks($tasks)
->setSavedQuery($saved) ->setSavedQuery($saved)
->setCanEditPriority($can_edit_priority) ->setCanEditPriority($can_edit_priority)
->setCanBatchEdit($can_bulk_edit) ->setCanBatchEdit($can_bulk_edit)
->setShowBatchControls($this->showBatchControls); ->setShowBatchControls($this->showBatchControls);
$result = new PhabricatorApplicationSearchResultView();
$result->setContent($list);
return $result;
} }
protected function willUseSavedQuery(PhabricatorSavedQuery $saved) { protected function willUseSavedQuery(PhabricatorSavedQuery $saved) {

View file

@ -267,7 +267,10 @@ final class PhabricatorAppSearchEngine
$results[] = $list; $results[] = $list;
} }
return $results; $result = new PhabricatorApplicationSearchResultView();
$result->setContent($results);
return $result;
} }
} }

View file

@ -127,13 +127,11 @@ final class PhabricatorNotificationSearchEngine
->addClass('phabricator-notification-list') ->addClass('phabricator-notification-list')
->appendChild($view); ->appendChild($view);
$notif_header = id(new PHUIHeaderView()) $result = new PhabricatorApplicationSearchResultView();
->setHeader($header) $result->addAction($button);
->addActionLink($button); $result->setContent($view);
return id(new PHUIObjectBoxView()) return $result;
->setHeader($notif_header)
->appendChild($view);
} }
public function shouldUseOffsetPaging() { public function shouldUseOffsetPaging() {

View file

@ -69,7 +69,11 @@ final class NuanceQueueSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No queues found.'));
return $result;
} }
} }

View file

@ -72,7 +72,11 @@ final class NuanceSourceSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No sources found.'));
return $result;
} }
} }

View file

@ -108,7 +108,11 @@ final class PhabricatorOAuthServerClientSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No clients found.'));
return $result;
} }
} }

View file

@ -123,7 +123,11 @@ final class PassphraseCredentialSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No credentials found.'));
return $result;
} }
} }

View file

@ -160,6 +160,10 @@ final class PhabricatorPasteSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No pastes found.'));
return $result;
} }
} }

View file

@ -186,6 +186,9 @@ final class PhabricatorPeopleLogSearchEngine
$table->setSearchBaseURI($this->getApplicationURI('logs/')); $table->setSearchBaseURI($this->getApplicationURI('logs/'));
} }
return $table; $result = new PhabricatorApplicationSearchResultView();
$result->setTable($table);
return $result;
} }
} }

View file

@ -247,7 +247,11 @@ final class PhabricatorPeopleSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No accounts found.'));
return $result;
} }
} }

View file

@ -124,7 +124,10 @@ final class PholioMockSearchEngine extends PhabricatorApplicationSearchEngine {
$board->addItem($item); $board->addItem($item);
} }
return $board; $result = new PhabricatorApplicationSearchResultView();
$result->setContent($board);
return $result;
} }
} }

View file

@ -30,7 +30,6 @@ final class PhortuneMerchantViewController
$merchant->getName()); $merchant->getName());
$header = id(new PHUIHeaderView()) $header = id(new PHUIHeaderView())
->setObjectName(pht('Merchant %d', $merchant->getID()))
->setHeader($merchant->getName()) ->setHeader($merchant->getName())
->setUser($viewer) ->setUser($viewer)
->setPolicyObject($merchant); ->setPolicyObject($merchant);

View file

@ -228,6 +228,9 @@ final class PhortuneCartSearchEngine
} }
$table->setNotice($notice); $table->setNotice($notice);
return $table; $result = new PhabricatorApplicationSearchResultView();
$result->setTable($table);
return $result;
} }
} }

View file

@ -127,8 +127,9 @@ final class PhortuneChargeSearchEngine
->setCharges($charges) ->setCharges($charges)
->setHandles($handles); ->setHandles($handles);
return id(new PHUIObjectBoxView()) $result = new PhabricatorApplicationSearchResultView();
->setHeaderText(pht('Charges')) $result->setTable($table);
->setTable($table);
return $table;
} }
} }

View file

@ -78,6 +78,10 @@ final class PhortuneMerchantSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No merchants found.'));
return $result;
} }
} }

View file

@ -158,8 +158,11 @@ final class PhortuneSubscriptionSearchEngine
$header = pht('Your Subscriptions'); $header = pht('Your Subscriptions');
} }
return id(new PHUIObjectBoxView()) $table->setNotice($header);
->setHeaderText($header)
->setTable($table); $result = new PhabricatorApplicationSearchResultView();
$result->setTable($table);
return $result;
} }
} }

View file

@ -5,6 +5,7 @@ final class PhortuneSubscriptionTableView extends AphrontView {
private $subscriptions; private $subscriptions;
private $handles; private $handles;
private $isMerchantView; private $isMerchantView;
private $notice;
public function setHandles(array $handles) { public function setHandles(array $handles) {
$this->handles = $handles; $this->handles = $handles;
@ -33,6 +34,11 @@ final class PhortuneSubscriptionTableView extends AphrontView {
return $this->isMerchantView; return $this->isMerchantView;
} }
public function setNotice($notice) {
$this->notice = $notice;
return $this;
}
public function render() { public function render() {
$subscriptions = $this->getSubscriptions(); $subscriptions = $this->getSubscriptions();
$handles = $this->getHandles(); $handles = $this->getHandles();
@ -61,6 +67,7 @@ final class PhortuneSubscriptionTableView extends AphrontView {
} }
$table = id(new AphrontTableView($rows)) $table = id(new AphrontTableView($rows))
->setNotice($this->notice)
->setHeaders( ->setHeaders(
array( array(
pht('ID'), pht('ID'),

View file

@ -189,7 +189,10 @@ final class PhrequentSearchEngine extends PhabricatorApplicationSearchEngine {
$view->addItem($item); $view->addItem($item);
} }
return $view; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($view);
return $result;
} }
} }

View file

@ -178,7 +178,11 @@ final class PhrictionSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No documents found.'));
return $result;
} }
} }

View file

@ -170,7 +170,11 @@ final class PonderQuestionSearchEngine
$view->addItem($item); $view->addItem($item);
} }
return $view; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($view);
$result->setNoDataString(pht('No questions found.'));
return $result;
} }
} }

View file

@ -193,7 +193,12 @@ protected function buildQueryFromParameters(array $map) {
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No projects found.'));
return $result;
} }
} }

View file

@ -121,7 +121,10 @@ final class ReleephProductSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
return $result;
} }
} }

View file

@ -108,11 +108,10 @@ final class PhabricatorRepositoryPushLogSearchEngine
->setHandles($handles) ->setHandles($handles)
->setLogs($logs); ->setLogs($logs);
$box = id(new PHUIBoxView()) $result = new PhabricatorApplicationSearchResultView();
->addMargin(PHUI::MARGIN_LARGE) $result->setTable($table);
->appendChild($table);
return $box; return $result;
} }
} }

View file

@ -209,7 +209,11 @@ final class PhabricatorRepositorySearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No repositories found for this query.'));
return $result;
} }
protected function willUseSavedQuery(PhabricatorSavedQuery $saved) { protected function willUseSavedQuery(PhabricatorSavedQuery $saved) {

View file

@ -185,8 +185,7 @@ final class PhabricatorApplicationSearchController
$title = pht('Advanced Search'); $title = pht('Advanced Search');
} }
$box = id(new PHUIObjectBoxView()) $box = new PHUIObjectBoxView();
->setHeaderText($title);
if ($run_query || $named_query) { if ($run_query || $named_query) {
$box->setShowHide( $box->setShowHide(
@ -228,16 +227,29 @@ final class PhabricatorApplicationSearchController
$saved_query); $saved_query);
} }
if ($list instanceof AphrontTableView) { $header = id(new PHUIHeaderView())
$box->setTable($list); ->setHeader($title);
} else { if ($list->getActions()) {
$box->setObjectList($list); foreach ($list->getActions() as $action) {
$header->addActionLink($action);
}
}
$box->setHeader($header);
if ($list->getObjectList()) {
$box->setObjectList($list->getObjectList());
}
if ($list->getTable()) {
$box->setTable($list->getTable());
}
if ($list->getInfoView()) {
$box->setInfoView($list->getInfoView());
}
if ($list->getContent()) {
$box->appendChild($list->getContent());
} }
// TODO: This is a bit hacky.
if ($list instanceof PHUIObjectItemListView) {
$list->setNoDataString(pht('No results found for this query.'));
} else {
if ($pager->willShowPagingControls()) { if ($pager->willShowPagingControls()) {
$pager_box = id(new PHUIBoxView()) $pager_box = id(new PHUIBoxView())
->addPadding(PHUI::PADDING_MEDIUM) ->addPadding(PHUI::PADDING_MEDIUM)
@ -246,12 +258,14 @@ final class PhabricatorApplicationSearchController
->appendChild($pager); ->appendChild($pager);
$nav->appendChild($pager_box); $nav->appendChild($pager_box);
} }
}
} catch (PhabricatorTypeaheadInvalidTokenException $ex) { } catch (PhabricatorTypeaheadInvalidTokenException $ex) {
$errors[] = pht( $errors[] = pht(
'This query specifies an invalid parameter. Review the '. 'This query specifies an invalid parameter. Review the '.
'query parameters and correct errors.'); 'query parameters and correct errors.');
} }
} else {
$box->setHeaderText($title);
} }
if ($errors) { if ($errors) {

View file

@ -241,7 +241,7 @@ final class PhabricatorSearchApplicationSearchEngine
$viewer = $this->requireViewer(); $viewer = $this->requireViewer();
$list = new PHUIObjectItemListView(); $list = new PHUIObjectItemListView();
$list->setNoDataString(pht('No results returned for that query.')); $list->setNoDataString(pht('No results found.'));
if ($results) { if ($results) {
$objects = id(new PhabricatorObjectQuery()) $objects = id(new PhabricatorObjectQuery())
@ -259,7 +259,10 @@ final class PhabricatorSearchApplicationSearchEngine
} }
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
return $result;
} }
private function readOwnerPHIDs(PhabricatorSavedQuery $saved) { private function readOwnerPHIDs(PhabricatorSavedQuery $saved) {

View file

@ -0,0 +1,86 @@
<?php
final class PhabricatorApplicationSearchResultView extends Phobject {
/**
* Holds bits and pieces of UI information for Search Engine
* and Dashboard Panel rendering, describing the results and
* controls for presentation.
*
*/
private $objectList = null;
private $table = null;
private $content = null;
private $infoView = null;
private $actions = array();
private $collapsed = null;
private $noDataString;
public function setObjectList(PHUIObjectItemListView $list) {
$this->objectList = $list;
return $this;
}
public function getObjectList() {
$list = $this->objectList;
if ($list) {
if ($this->noDataString) {
$list->setNoDataString($this->noDataString);
} else {
$list->setNoDataString(pht('No results found for this query.'));
}
}
return $list;
}
public function setTable(AphrontTableView $table) {
$this->table = $table;
return $this;
}
public function getTable() {
return $this->table;
}
public function setInfoView(PHUIInfoView $infoview) {
$this->infoView = $infoview;
return $this;
}
public function getInfoView() {
return $this->infoView;
}
public function setContent($content) {
$this->content = $content;
}
public function getContent() {
return $this->content;
}
public function addAction(PHUIButtonView $button) {
$this->actions[] = $button;
return $this;
}
public function getActions() {
return $this->actions;
}
public function setCollapsed($collapsed) {
$this->collapsed = $collapsed;
return $this;
}
public function getCollapsed() {
return $this->collapsed;
}
public function setNoDataString($nodata) {
$this->noDataString = $nodata;
return $this;
}
}

View file

@ -167,7 +167,11 @@ final class PhabricatorSlowvoteSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No polls found.'));
return $result;
} }
} }

View file

@ -91,7 +91,11 @@ final class PhabricatorSpacesNamespaceSearchEngine
$list->addItem($item); $list->addItem($item);
} }
return $list; $result = new PhabricatorApplicationSearchResultView();
$result->setObjectList($list);
$result->setNoDataString(pht('No spaces found.'));
return $result;
} }
} }

View file

@ -275,11 +275,6 @@ span.single-display-line-content {
display: none; display: none;
} }
.aphront-table-view-device-ready {
width: 99%;
margin: 8px auto;
}
.aphront-table-view td.link { .aphront-table-view td.link {
padding: 0; padding: 0;
} }

View file

@ -40,6 +40,14 @@
} }
.phabricator-notification-list.pm {
padding: 0;
}
.phabricator-notification-list .phabricator-notification {
padding: 10px 4px;
}
.phabricator-notification { .phabricator-notification {
padding: 6px 8px; padding: 6px 8px;
} }