@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.

[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

+450 -116
+5 -5
resources/celerity/map.php
··· 7 7 */ 8 8 return array( 9 9 'names' => array( 10 - 'core.pkg.css' => 'df3a0e9c', 10 + 'core.pkg.css' => '96a7378c', 11 11 'core.pkg.js' => '41f5edc5', 12 12 'darkconsole.pkg.js' => 'e7393ebb', 13 13 'differential.pkg.css' => 'fe951924', ··· 25 25 'rsrc/css/aphront/notification.css' => '9c279160', 26 26 'rsrc/css/aphront/panel-view.css' => '8427b78d', 27 27 'rsrc/css/aphront/phabricator-nav-view.css' => '0ecd30a1', 28 - 'rsrc/css/aphront/table-view.css' => '4f2ed0bf', 28 + 'rsrc/css/aphront/table-view.css' => 'e3632cc9', 29 29 'rsrc/css/aphront/tokenizer.css' => '04875312', 30 30 'rsrc/css/aphront/tooltip.css' => '7672b60f', 31 31 'rsrc/css/aphront/two-column.css' => '16ab3ad2', ··· 34 34 'rsrc/css/application/almanac/almanac.css' => 'dbb9b3af', 35 35 'rsrc/css/application/auth/auth.css' => '44975d4b', 36 36 'rsrc/css/application/base/main-menu-view.css' => '44b4a289', 37 - 'rsrc/css/application/base/notification-menu.css' => '713df25a', 37 + 'rsrc/css/application/base/notification-menu.css' => 'f31c0bde', 38 38 'rsrc/css/application/base/phabricator-application-launch-view.css' => '9a233ed6', 39 39 'rsrc/css/application/base/phui-theme.css' => '1ccdcc84', 40 40 'rsrc/css/application/base/standard-page-view.css' => '43045fb4', ··· 488 488 'aphront-list-filter-view-css' => 'aa5ffcb9', 489 489 'aphront-multi-column-view-css' => 'fd18389d', 490 490 'aphront-panel-view-css' => '8427b78d', 491 - 'aphront-table-view-css' => '4f2ed0bf', 491 + 'aphront-table-view-css' => 'e3632cc9', 492 492 'aphront-tokenizer-control-css' => '04875312', 493 493 'aphront-tooltip-css' => '7672b60f', 494 494 'aphront-two-column-view-css' => '16ab3ad2', ··· 726 726 'phabricator-nav-view-css' => '0ecd30a1', 727 727 'phabricator-notification' => '0c6946e7', 728 728 'phabricator-notification-css' => '9c279160', 729 - 'phabricator-notification-menu-css' => '713df25a', 729 + 'phabricator-notification-menu-css' => 'f31c0bde', 730 730 'phabricator-object-selector-css' => '029a133d', 731 731 'phabricator-phtize' => 'd254d646', 732 732 'phabricator-prefab' => '6920d200',
+2
src/__phutil_library_map__.php
··· 1340 1340 'PhabricatorApplicationSearchController' => 'applications/search/controller/PhabricatorApplicationSearchController.php', 1341 1341 'PhabricatorApplicationSearchEngine' => 'applications/search/engine/PhabricatorApplicationSearchEngine.php', 1342 1342 'PhabricatorApplicationSearchEngineTestCase' => 'applications/search/engine/__tests__/PhabricatorApplicationSearchEngineTestCase.php', 1343 + 'PhabricatorApplicationSearchResultView' => 'applications/search/view/PhabricatorApplicationSearchResultView.php', 1343 1344 'PhabricatorApplicationSearchResultsControllerInterface' => 'applications/search/interface/PhabricatorApplicationSearchResultsControllerInterface.php', 1344 1345 'PhabricatorApplicationStatusView' => 'applications/meta/view/PhabricatorApplicationStatusView.php', 1345 1346 'PhabricatorApplicationTestCase' => 'applications/base/__tests__/PhabricatorApplicationTestCase.php', ··· 4845 4846 'PhabricatorApplicationSearchController' => 'PhabricatorSearchBaseController', 4846 4847 'PhabricatorApplicationSearchEngine' => 'Phobject', 4847 4848 'PhabricatorApplicationSearchEngineTestCase' => 'PhabricatorTestCase', 4849 + 'PhabricatorApplicationSearchResultView' => 'Phobject', 4848 4850 'PhabricatorApplicationStatusView' => 'AphrontView', 4849 4851 'PhabricatorApplicationTestCase' => 'PhabricatorTestCase', 4850 4852 'PhabricatorApplicationTransaction' => array(
+5 -1
src/applications/almanac/query/AlmanacDeviceSearchEngine.php
··· 78 78 $list->addItem($item); 79 79 } 80 80 81 - return $list; 81 + $result = new PhabricatorApplicationSearchResultView(); 82 + $result->setObjectList($list); 83 + $result->setNoDataString(pht('No Almanac Devices found.')); 84 + 85 + return $result; 82 86 } 83 87 84 88 }
+5 -1
src/applications/almanac/query/AlmanacNetworkSearchEngine.php
··· 80 80 $list->addItem($item); 81 81 } 82 82 83 - return $list; 83 + $result = new PhabricatorApplicationSearchResultView(); 84 + $result->setObjectList($list); 85 + $result->setNoDataString(pht('No Almanac Networks found.')); 86 + 87 + return $result; 84 88 } 85 89 }
+5 -1
src/applications/almanac/query/AlmanacServiceSearchEngine.php
··· 90 90 $list->addItem($item); 91 91 } 92 92 93 - return $list; 93 + $result = new PhabricatorApplicationSearchResultView(); 94 + $result->setObjectList($list); 95 + $result->setNoDataString(pht('No Almanac Services found.')); 96 + 97 + return $result; 94 98 } 95 99 }
+5 -1
src/applications/audit/query/PhabricatorCommitSearchEngine.php
··· 206 206 } 207 207 208 208 $view->setHandles($handles); 209 + $list = $view->buildList(); 209 210 210 - return $view->buildList(); 211 + $result = new PhabricatorApplicationSearchResultView(); 212 + $result->setContent($list); 213 + 214 + return $result; 211 215 } 212 216 213 217 }
+4 -3
src/applications/auth/query/PhabricatorAuthInviteSearchEngine.php
··· 102 102 'right', 103 103 )); 104 104 105 - return id(new PHUIObjectBoxView()) 106 - ->setHeaderText(pht('Email Invitations')) 107 - ->setTable($table); 105 + $result = new PhabricatorApplicationSearchResultView(); 106 + $result->setTable($table); 107 + 108 + return $result; 108 109 } 109 110 }
+14 -3
src/applications/calendar/query/PhabricatorCalendarEventSearchEngine.php
··· 328 328 $list->addItem($item); 329 329 } 330 330 331 - return $list; 331 + $result = new PhabricatorApplicationSearchResultView(); 332 + $result->setObjectList($list); 333 + $result->setNoDataString(pht('No events found.')); 334 + 335 + return $result; 332 336 } 333 337 334 338 private function buildCalendarView( ··· 385 389 $month_view->setBrowseURI( 386 390 $this->getURI('query/'.$query->getQueryKey().'/')); 387 391 388 - return $month_view; 392 + // TODO redesign-2015 : Move buttons out of PHUICalendarView? 393 + $result = new PhabricatorApplicationSearchResultView(); 394 + $result->setContent($month_view); 395 + 396 + return $result; 389 397 } 390 398 391 399 private function buildCalendarDayView( ··· 436 444 $day_view->setBrowseURI( 437 445 $this->getURI('query/'.$query->getQueryKey().'/')); 438 446 439 - return $day_view; 447 + $result = new PhabricatorApplicationSearchResultView(); 448 + $result->setContent($day_view); 449 + 450 + return $result; 440 451 } 441 452 442 453 private function getDisplayYearAndMonthAndDay(
+4 -1
src/applications/conduit/query/PhabricatorConduitSearchEngine.php
··· 196 196 $out[] = $list; 197 197 } 198 198 199 - return $out; 199 + $result = new PhabricatorApplicationSearchResultView(); 200 + $result->setContent($out); 201 + 202 + return $result; 200 203 } 201 204 202 205 }
+5 -1
src/applications/conpherence/query/ConpherenceThreadSearchEngine.php
··· 253 253 $list->addItem($item); 254 254 } 255 255 256 - return $list; 256 + $result = new PhabricatorApplicationSearchResultView(); 257 + $result->setObjectList($list); 258 + $result->setNoDataString(pht('No threads found.')); 259 + 260 + return $result; 257 261 } 258 262 259 263 private function getTypeOptions() {
+5 -1
src/applications/countdown/query/PhabricatorCountdownSearchEngine.php
··· 140 140 $list->addItem($item); 141 141 } 142 142 143 - return $list; 143 + $result = new PhabricatorApplicationSearchResultView(); 144 + $result->setObjectList($list); 145 + $result->setNoDataString(pht('No countdowns found.')); 146 + 147 + return $result; 144 148 } 145 149 146 150 }
+19 -3
src/applications/dashboard/engine/PhabricatorDashboardPanelRenderingEngine.php
··· 185 185 if (!$id) { 186 186 $id = celerity_generate_unique_node_id(); 187 187 } 188 - $box = id(new PHUIObjectBoxView()) 189 - ->setHeader($header) 190 - ->appendChild($content) 188 + 189 + $box = new PHUIObjectBoxView(); 190 + 191 + $interface = 'PhabricatorApplicationSearchResultView'; 192 + if ($content instanceof $interface) { 193 + if ($content->getObjectList()) { 194 + $box->setObjectList($content->getObjectList()); 195 + } 196 + if ($content->getTable()) { 197 + $box->setTable($content->getTable()); 198 + } 199 + if ($content->getContent()) { 200 + $box->appendChild($content->getContent()); 201 + } 202 + } else { 203 + $box->appendChild($content); 204 + } 205 + 206 + $box->setHeader($header) 191 207 ->setID($id) 192 208 ->addSigil('dashboard-panel') 193 209 ->setMetadata(array('objectPHID' => $panel->getPHID()));
+5 -1
src/applications/dashboard/query/PhabricatorDashboardPanelSearchEngine.php
··· 132 132 $list->addItem($item); 133 133 } 134 134 135 - return $list; 135 + $result = new PhabricatorApplicationSearchResultView(); 136 + $result->setObjectList($list); 137 + $result->setNoDataString(pht('No panels found.')); 138 + 139 + return $result; 136 140 } 137 141 138 142 }
+6 -1
src/applications/dashboard/query/PhabricatorDashboardSearchEngine.php
··· 104 104 $list->addItem($item); 105 105 } 106 106 107 - return $list; 107 + $result = new PhabricatorApplicationSearchResultView(); 108 + $result->setObjectList($list); 109 + $result->setNoDataString(pht('No dashboards found.')); 110 + 111 + return $result; 112 + 108 113 } 109 114 110 115 }
+7 -2
src/applications/differential/query/DifferentialRevisionSearchEngine.php
··· 323 323 if (count($views) == 1) { 324 324 // Reduce this to a PHUIObjectItemListView so we can get the free 325 325 // support from ApplicationSearch. 326 - return head($views)->render(); 326 + $list = head($views)->render(); 327 327 } else { 328 - return $views; 328 + $list = $views; 329 329 } 330 + 331 + $result = new PhabricatorApplicationSearchResultView(); 332 + $result->setContent($list); 333 + 334 + return $result; 330 335 } 331 336 332 337 }
+5 -1
src/applications/diviner/query/DivinerAtomSearchEngine.php
··· 116 116 $list->addItem($item); 117 117 } 118 118 119 - return $list; 119 + $result = new PhabricatorApplicationSearchResultView(); 120 + $result->setObjectList($list); 121 + $result->setNoDataString(pht('No books found.')); 122 + 123 + return $result; 120 124 } 121 125 122 126 }
+5 -1
src/applications/drydock/query/DrydockBlueprintSearchEngine.php
··· 69 69 $view->addItem($item); 70 70 } 71 71 72 - return $view; 72 + $result = new PhabricatorApplicationSearchResultView(); 73 + $result->setObjectList($view); 74 + $result->setNoDataString(pht('No blueprints found.')); 75 + 76 + return $result; 73 77 } 74 78 75 79 }
+7 -3
src/applications/drydock/query/DrydockLeaseSearchEngine.php
··· 89 89 PhabricatorSavedQuery $saved, 90 90 array $handles) { 91 91 92 - return id(new DrydockLeaseListView()) 92 + $list = id(new DrydockLeaseListView()) 93 93 ->setUser($this->requireViewer()) 94 - ->setLeases($leases) 95 - ->render(); 94 + ->setLeases($leases); 95 + 96 + $result = new PhabricatorApplicationSearchResultView(); 97 + $result->setTable($list); 98 + 99 + return $result; 96 100 } 97 101 98 102 }
+7 -3
src/applications/drydock/query/DrydockLogSearchEngine.php
··· 49 49 PhabricatorSavedQuery $query, 50 50 array $handles) { 51 51 52 - return id(new DrydockLogListView()) 52 + $list = id(new DrydockLogListView()) 53 53 ->setUser($this->requireViewer()) 54 - ->setLogs($logs) 55 - ->render(); 54 + ->setLogs($logs); 55 + 56 + $result = new PhabricatorApplicationSearchResultView(); 57 + $result->setTable($list); 58 + 59 + return $result; 56 60 } 57 61 58 62 }
+7 -3
src/applications/drydock/query/DrydockResourceSearchEngine.php
··· 87 87 PhabricatorSavedQuery $query, 88 88 array $handles) { 89 89 90 - return id(new DrydockResourceListView()) 90 + $list = id(new DrydockResourceListView()) 91 91 ->setUser($this->requireViewer()) 92 - ->setResources($resources) 93 - ->render(); 92 + ->setResources($resources); 93 + 94 + $result = new PhabricatorApplicationSearchResultView(); 95 + $result->setTable($list); 96 + 97 + return $result; 94 98 } 95 99 96 100 }
+6 -1
src/applications/feed/query/PhabricatorFeedSearchEngine.php
··· 139 139 $builder->setUser($this->requireViewer()); 140 140 $view = $builder->buildView(); 141 141 142 - return phutil_tag_div('phabricator-feed-frame', $view); 142 + $list = phutil_tag_div('phabricator-feed-frame', $view); 143 + 144 + $result = new PhabricatorApplicationSearchResultView(); 145 + $result->setContent($list); 146 + 147 + return $result; 143 148 } 144 149 145 150 }
+5 -1
src/applications/files/query/PhabricatorFileSearchEngine.php
··· 171 171 $list_view->appendChild(id(new PhabricatorGlobalUploadTargetView()) 172 172 ->setUser($viewer)); 173 173 174 - return $list_view; 174 + 175 + $result = new PhabricatorApplicationSearchResultView(); 176 + $result->setContent($list_view); 177 + 178 + return $result; 175 179 } 176 180 177 181 }
+6 -1
src/applications/flag/query/PhabricatorFlagSearchEngine.php
··· 180 180 $list->addItem($item); 181 181 } 182 182 183 - return $list; 183 + $result = new PhabricatorApplicationSearchResultView(); 184 + $result->setObjectList($list); 185 + $result->setNoDataString(pht('No flags found.')); 186 + 187 + return $result; 188 + 184 189 } 185 190 186 191
+4 -1
src/applications/fund/query/FundBackerSearchEngine.php
··· 141 141 'right', 142 142 )); 143 143 144 - return $table; 144 + $result = new PhabricatorApplicationSearchResultView(); 145 + $result->setTable($table); 146 + 147 + return $result; 145 148 } 146 149 147 150 }
+6
src/applications/fund/query/FundInitiativeSearchEngine.php
··· 163 163 $list->addItem($item); 164 164 } 165 165 166 + $result = new PhabricatorApplicationSearchResultView(); 167 + $result->setObjectList($list); 168 + $result->setNoDataString(pht('No initiatives found.')); 169 + 170 + return $result; 171 + 166 172 167 173 return $list; 168 174 }
+6 -1
src/applications/harbormaster/query/HarbormasterBuildPlanSearchEngine.php
··· 93 93 $list->addItem($item); 94 94 } 95 95 96 - return $list; 96 + $result = new PhabricatorApplicationSearchResultView(); 97 + $result->setObjectList($list); 98 + $result->setNoDataString(pht('No build plans found.')); 99 + 100 + return $result; 101 + 97 102 } 98 103 99 104 }
+5 -1
src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php
··· 216 216 217 217 } 218 218 219 - return $list; 219 + $result = new PhabricatorApplicationSearchResultView(); 220 + $result->setObjectList($list); 221 + $result->setNoDataString(pht('No buildables found.')); 222 + 223 + return $result; 220 224 } 221 225 222 226 }
+6 -1
src/applications/herald/query/HeraldRuleSearchEngine.php
··· 209 209 $list->addItem($item); 210 210 } 211 211 212 - return $list; 212 + $result = new PhabricatorApplicationSearchResultView(); 213 + $result->setObjectList($list); 214 + $result->setNoDataString(pht('No rules found.')); 215 + 216 + return $result; 217 + 213 218 } 214 219 215 220 }
+5 -1
src/applications/herald/query/HeraldTranscriptSearchEngine.php
··· 133 133 $list->addItem($item); 134 134 } 135 135 136 - return $list; 136 + $result = new PhabricatorApplicationSearchResultView(); 137 + $result->setObjectList($list); 138 + $result->setNoDataString(pht('No transcripts found.')); 139 + 140 + return $result; 137 141 } 138 142 139 143 }
+5 -1
src/applications/legalpad/query/LegalpadDocumentSearchEngine.php
··· 209 209 $list->addItem($item); 210 210 } 211 211 212 - return $list; 212 + $result = new PhabricatorApplicationSearchResultView(); 213 + $result->setObjectList($list); 214 + $result->setNoDataString(pht('No documents found.')); 215 + 216 + return $result; 213 217 } 214 218 215 219 }
+14 -8
src/applications/legalpad/query/LegalpadDocumentSignatureSearchEngine.php
··· 267 267 'right', 268 268 )); 269 269 270 - // TODO redesign-2015 : Talk to epriestley about 'correct' way to implelment 271 - /* if ($this->document) { 270 + $button = null; 271 + if ($this->document) { 272 272 $document_id = $this->document->getID(); 273 273 274 - $header->addActionLink( 275 - id(new PHUIButtonView()) 276 - ->setText(pht('Add Signature Exemption')) 274 + $button = id(new PHUIButtonView()) 275 + ->setText(pht('Add Exemption')) 277 276 ->setTag('a') 278 277 ->setHref($this->getApplicationURI('addsignature/'.$document_id.'/')) 279 278 ->setWorkflow(true) 280 - ->setIcon(id(new PHUIIconView())->setIconFont('fa-pencil'))); 281 - }*/ 279 + ->setIcon(id(new PHUIIconView())->setIconFont('fa-pencil')); 280 + } 282 281 283 282 if (!$this->document) { 284 283 $table->setNotice( ··· 286 285 'documents you have permission to edit.')); 287 286 } 288 287 289 - return $table; 288 + $result = new PhabricatorApplicationSearchResultView(); 289 + $result->setTable($table); 290 + if ($button) { 291 + $result->addAction($button); 292 + } 293 + 294 + return $result; 295 + 290 296 } 291 297 292 298 private function renderIcon($icon, $color, $title) {
+4 -1
src/applications/macro/query/PhabricatorMacroSearchEngine.php
··· 181 181 $pinboard->addItem($item); 182 182 } 183 183 184 - return $pinboard; 184 + $result = new PhabricatorApplicationSearchResultView(); 185 + $result->setContent($pinboard); 186 + 187 + return $result; 185 188 } 186 189 187 190 }
+6 -1
src/applications/maniphest/query/ManiphestTaskSearchEngine.php
··· 316 316 ManiphestBulkEditCapability::CAPABILITY); 317 317 } 318 318 319 - return id(new ManiphestTaskResultListView()) 319 + $list = id(new ManiphestTaskResultListView()) 320 320 ->setUser($viewer) 321 321 ->setTasks($tasks) 322 322 ->setSavedQuery($saved) 323 323 ->setCanEditPriority($can_edit_priority) 324 324 ->setCanBatchEdit($can_bulk_edit) 325 325 ->setShowBatchControls($this->showBatchControls); 326 + 327 + $result = new PhabricatorApplicationSearchResultView(); 328 + $result->setContent($list); 329 + 330 + return $result; 326 331 } 327 332 328 333 protected function willUseSavedQuery(PhabricatorSavedQuery $saved) {
+4 -1
src/applications/meta/query/PhabricatorAppSearchEngine.php
··· 267 267 $results[] = $list; 268 268 } 269 269 270 - return $results; 270 + $result = new PhabricatorApplicationSearchResultView(); 271 + $result->setContent($results); 272 + 273 + return $result; 271 274 } 272 275 273 276 }
+4 -6
src/applications/notification/query/PhabricatorNotificationSearchEngine.php
··· 127 127 ->addClass('phabricator-notification-list') 128 128 ->appendChild($view); 129 129 130 - $notif_header = id(new PHUIHeaderView()) 131 - ->setHeader($header) 132 - ->addActionLink($button); 130 + $result = new PhabricatorApplicationSearchResultView(); 131 + $result->addAction($button); 132 + $result->setContent($view); 133 133 134 - return id(new PHUIObjectBoxView()) 135 - ->setHeader($notif_header) 136 - ->appendChild($view); 134 + return $result; 137 135 } 138 136 139 137 public function shouldUseOffsetPaging() {
+5 -1
src/applications/nuance/query/NuanceQueueSearchEngine.php
··· 69 69 $list->addItem($item); 70 70 } 71 71 72 - return $list; 72 + $result = new PhabricatorApplicationSearchResultView(); 73 + $result->setObjectList($list); 74 + $result->setNoDataString(pht('No queues found.')); 75 + 76 + return $result; 73 77 } 74 78 75 79 }
+5 -1
src/applications/nuance/query/NuanceSourceSearchEngine.php
··· 72 72 $list->addItem($item); 73 73 } 74 74 75 - return $list; 75 + $result = new PhabricatorApplicationSearchResultView(); 76 + $result->setObjectList($list); 77 + $result->setNoDataString(pht('No sources found.')); 78 + 79 + return $result; 76 80 } 77 81 78 82 }
+5 -1
src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php
··· 108 108 $list->addItem($item); 109 109 } 110 110 111 - return $list; 111 + $result = new PhabricatorApplicationSearchResultView(); 112 + $result->setObjectList($list); 113 + $result->setNoDataString(pht('No clients found.')); 114 + 115 + return $result; 112 116 } 113 117 114 118 }
+5 -1
src/applications/passphrase/query/PassphraseCredentialSearchEngine.php
··· 123 123 $list->addItem($item); 124 124 } 125 125 126 - return $list; 126 + $result = new PhabricatorApplicationSearchResultView(); 127 + $result->setObjectList($list); 128 + $result->setNoDataString(pht('No credentials found.')); 129 + 130 + return $result; 127 131 } 128 132 129 133 }
+5 -1
src/applications/paste/query/PhabricatorPasteSearchEngine.php
··· 160 160 $list->addItem($item); 161 161 } 162 162 163 - return $list; 163 + $result = new PhabricatorApplicationSearchResultView(); 164 + $result->setObjectList($list); 165 + $result->setNoDataString(pht('No pastes found.')); 166 + 167 + return $result; 164 168 } 165 169 }
+4 -1
src/applications/people/query/PhabricatorPeopleLogSearchEngine.php
··· 186 186 $table->setSearchBaseURI($this->getApplicationURI('logs/')); 187 187 } 188 188 189 - return $table; 189 + $result = new PhabricatorApplicationSearchResultView(); 190 + $result->setTable($table); 191 + 192 + return $result; 190 193 } 191 194 }
+5 -1
src/applications/people/query/PhabricatorPeopleSearchEngine.php
··· 247 247 $list->addItem($item); 248 248 } 249 249 250 - return $list; 250 + $result = new PhabricatorApplicationSearchResultView(); 251 + $result->setObjectList($list); 252 + $result->setNoDataString(pht('No accounts found.')); 253 + 254 + return $result; 251 255 } 252 256 253 257 }
+4 -1
src/applications/pholio/query/PholioMockSearchEngine.php
··· 124 124 $board->addItem($item); 125 125 } 126 126 127 - return $board; 127 + $result = new PhabricatorApplicationSearchResultView(); 128 + $result->setContent($board); 129 + 130 + return $result; 128 131 } 129 132 130 133 }
-1
src/applications/phortune/controller/PhortuneMerchantViewController.php
··· 30 30 $merchant->getName()); 31 31 32 32 $header = id(new PHUIHeaderView()) 33 - ->setObjectName(pht('Merchant %d', $merchant->getID())) 34 33 ->setHeader($merchant->getName()) 35 34 ->setUser($viewer) 36 35 ->setPolicyObject($merchant);
+4 -1
src/applications/phortune/query/PhortuneCartSearchEngine.php
··· 228 228 } 229 229 $table->setNotice($notice); 230 230 231 - return $table; 231 + $result = new PhabricatorApplicationSearchResultView(); 232 + $result->setTable($table); 233 + 234 + return $result; 232 235 } 233 236 }
+4 -3
src/applications/phortune/query/PhortuneChargeSearchEngine.php
··· 127 127 ->setCharges($charges) 128 128 ->setHandles($handles); 129 129 130 - return id(new PHUIObjectBoxView()) 131 - ->setHeaderText(pht('Charges')) 132 - ->setTable($table); 130 + $result = new PhabricatorApplicationSearchResultView(); 131 + $result->setTable($table); 132 + 133 + return $table; 133 134 } 134 135 }
+5 -1
src/applications/phortune/query/PhortuneMerchantSearchEngine.php
··· 78 78 $list->addItem($item); 79 79 } 80 80 81 - return $list; 81 + $result = new PhabricatorApplicationSearchResultView(); 82 + $result->setObjectList($list); 83 + $result->setNoDataString(pht('No merchants found.')); 84 + 85 + return $result; 82 86 } 83 87 }
+6 -3
src/applications/phortune/query/PhortuneSubscriptionSearchEngine.php
··· 158 158 $header = pht('Your Subscriptions'); 159 159 } 160 160 161 - return id(new PHUIObjectBoxView()) 162 - ->setHeaderText($header) 163 - ->setTable($table); 161 + $table->setNotice($header); 162 + 163 + $result = new PhabricatorApplicationSearchResultView(); 164 + $result->setTable($table); 165 + 166 + return $result; 164 167 } 165 168 }
+7
src/applications/phortune/view/PhortuneSubscriptionTableView.php
··· 5 5 private $subscriptions; 6 6 private $handles; 7 7 private $isMerchantView; 8 + private $notice; 8 9 9 10 public function setHandles(array $handles) { 10 11 $this->handles = $handles; ··· 33 34 return $this->isMerchantView; 34 35 } 35 36 37 + public function setNotice($notice) { 38 + $this->notice = $notice; 39 + return $this; 40 + } 41 + 36 42 public function render() { 37 43 $subscriptions = $this->getSubscriptions(); 38 44 $handles = $this->getHandles(); ··· 61 67 } 62 68 63 69 $table = id(new AphrontTableView($rows)) 70 + ->setNotice($this->notice) 64 71 ->setHeaders( 65 72 array( 66 73 pht('ID'),
+4 -1
src/applications/phrequent/query/PhrequentSearchEngine.php
··· 189 189 $view->addItem($item); 190 190 } 191 191 192 - return $view; 192 + $result = new PhabricatorApplicationSearchResultView(); 193 + $result->setObjectList($view); 194 + 195 + return $result; 193 196 } 194 197 195 198 }
+5 -1
src/applications/phriction/query/PhrictionSearchEngine.php
··· 178 178 $list->addItem($item); 179 179 } 180 180 181 - return $list; 181 + $result = new PhabricatorApplicationSearchResultView(); 182 + $result->setObjectList($list); 183 + $result->setNoDataString(pht('No documents found.')); 184 + 185 + return $result; 182 186 } 183 187 184 188 }
+5 -1
src/applications/ponder/query/PonderQuestionSearchEngine.php
··· 170 170 $view->addItem($item); 171 171 } 172 172 173 - return $view; 173 + $result = new PhabricatorApplicationSearchResultView(); 174 + $result->setObjectList($view); 175 + $result->setNoDataString(pht('No questions found.')); 176 + 177 + return $result; 174 178 } 175 179 176 180 }
+6 -1
src/applications/project/query/PhabricatorProjectSearchEngine.php
··· 193 193 $list->addItem($item); 194 194 } 195 195 196 - return $list; 196 + $result = new PhabricatorApplicationSearchResultView(); 197 + $result->setObjectList($list); 198 + $result->setNoDataString(pht('No projects found.')); 199 + 200 + return $result; 201 + 197 202 } 198 203 199 204 }
+4 -1
src/applications/releeph/query/ReleephProductSearchEngine.php
··· 121 121 $list->addItem($item); 122 122 } 123 123 124 - return $list; 124 + $result = new PhabricatorApplicationSearchResultView(); 125 + $result->setObjectList($list); 126 + 127 + return $result; 125 128 } 126 129 127 130 }
+3 -4
src/applications/repository/query/PhabricatorRepositoryPushLogSearchEngine.php
··· 108 108 ->setHandles($handles) 109 109 ->setLogs($logs); 110 110 111 - $box = id(new PHUIBoxView()) 112 - ->addMargin(PHUI::MARGIN_LARGE) 113 - ->appendChild($table); 111 + $result = new PhabricatorApplicationSearchResultView(); 112 + $result->setTable($table); 114 113 115 - return $box; 114 + return $result; 116 115 } 117 116 118 117 }
+5 -1
src/applications/repository/query/PhabricatorRepositorySearchEngine.php
··· 209 209 $list->addItem($item); 210 210 } 211 211 212 - return $list; 212 + $result = new PhabricatorApplicationSearchResultView(); 213 + $result->setObjectList($list); 214 + $result->setNoDataString(pht('No repositories found for this query.')); 215 + 216 + return $result; 213 217 } 214 218 215 219 protected function willUseSavedQuery(PhabricatorSavedQuery $saved) {
+32 -18
src/applications/search/controller/PhabricatorApplicationSearchController.php
··· 185 185 $title = pht('Advanced Search'); 186 186 } 187 187 188 - $box = id(new PHUIObjectBoxView()) 189 - ->setHeaderText($title); 188 + $box = new PHUIObjectBoxView(); 190 189 191 190 if ($run_query || $named_query) { 192 191 $box->setShowHide( ··· 228 227 $saved_query); 229 228 } 230 229 231 - if ($list instanceof AphrontTableView) { 232 - $box->setTable($list); 233 - } else { 234 - $box->setObjectList($list); 230 + $header = id(new PHUIHeaderView()) 231 + ->setHeader($title); 232 + if ($list->getActions()) { 233 + foreach ($list->getActions() as $action) { 234 + $header->addActionLink($action); 235 + } 236 + } 237 + 238 + $box->setHeader($header); 239 + 240 + if ($list->getObjectList()) { 241 + $box->setObjectList($list->getObjectList()); 242 + } 243 + if ($list->getTable()) { 244 + $box->setTable($list->getTable()); 245 + } 246 + if ($list->getInfoView()) { 247 + $box->setInfoView($list->getInfoView()); 248 + } 249 + if ($list->getContent()) { 250 + $box->appendChild($list->getContent()); 235 251 } 236 252 237 - // TODO: This is a bit hacky. 238 - if ($list instanceof PHUIObjectItemListView) { 239 - $list->setNoDataString(pht('No results found for this query.')); 240 - } else { 241 - if ($pager->willShowPagingControls()) { 242 - $pager_box = id(new PHUIBoxView()) 243 - ->addPadding(PHUI::PADDING_MEDIUM) 244 - ->addMargin(PHUI::MARGIN_LARGE) 245 - ->setBorder(true) 246 - ->appendChild($pager); 247 - $nav->appendChild($pager_box); 248 - } 253 + if ($pager->willShowPagingControls()) { 254 + $pager_box = id(new PHUIBoxView()) 255 + ->addPadding(PHUI::PADDING_MEDIUM) 256 + ->addMargin(PHUI::MARGIN_LARGE) 257 + ->setBorder(true) 258 + ->appendChild($pager); 259 + $nav->appendChild($pager_box); 249 260 } 261 + 250 262 } catch (PhabricatorTypeaheadInvalidTokenException $ex) { 251 263 $errors[] = pht( 252 264 'This query specifies an invalid parameter. Review the '. 253 265 'query parameters and correct errors.'); 254 266 } 267 + } else { 268 + $box->setHeaderText($title); 255 269 } 256 270 257 271 if ($errors) {
+5 -2
src/applications/search/query/PhabricatorSearchApplicationSearchEngine.php
··· 241 241 242 242 $viewer = $this->requireViewer(); 243 243 $list = new PHUIObjectItemListView(); 244 - $list->setNoDataString(pht('No results returned for that query.')); 244 + $list->setNoDataString(pht('No results found.')); 245 245 246 246 if ($results) { 247 247 $objects = id(new PhabricatorObjectQuery()) ··· 259 259 } 260 260 } 261 261 262 - return $list; 262 + $result = new PhabricatorApplicationSearchResultView(); 263 + $result->setObjectList($list); 264 + 265 + return $result; 263 266 } 264 267 265 268 private function readOwnerPHIDs(PhabricatorSavedQuery $saved) {
+86
src/applications/search/view/PhabricatorApplicationSearchResultView.php
··· 1 + <?php 2 + 3 + final class PhabricatorApplicationSearchResultView extends Phobject { 4 + 5 + /** 6 + * Holds bits and pieces of UI information for Search Engine 7 + * and Dashboard Panel rendering, describing the results and 8 + * controls for presentation. 9 + * 10 + */ 11 + 12 + private $objectList = null; 13 + private $table = null; 14 + private $content = null; 15 + private $infoView = null; 16 + private $actions = array(); 17 + private $collapsed = null; 18 + private $noDataString; 19 + 20 + public function setObjectList(PHUIObjectItemListView $list) { 21 + $this->objectList = $list; 22 + return $this; 23 + } 24 + 25 + public function getObjectList() { 26 + $list = $this->objectList; 27 + if ($list) { 28 + if ($this->noDataString) { 29 + $list->setNoDataString($this->noDataString); 30 + } else { 31 + $list->setNoDataString(pht('No results found for this query.')); 32 + } 33 + } 34 + return $list; 35 + } 36 + 37 + public function setTable(AphrontTableView $table) { 38 + $this->table = $table; 39 + return $this; 40 + } 41 + 42 + public function getTable() { 43 + return $this->table; 44 + } 45 + 46 + public function setInfoView(PHUIInfoView $infoview) { 47 + $this->infoView = $infoview; 48 + return $this; 49 + } 50 + 51 + public function getInfoView() { 52 + return $this->infoView; 53 + } 54 + 55 + public function setContent($content) { 56 + $this->content = $content; 57 + } 58 + 59 + public function getContent() { 60 + return $this->content; 61 + } 62 + 63 + public function addAction(PHUIButtonView $button) { 64 + $this->actions[] = $button; 65 + return $this; 66 + } 67 + 68 + public function getActions() { 69 + return $this->actions; 70 + } 71 + 72 + public function setCollapsed($collapsed) { 73 + $this->collapsed = $collapsed; 74 + return $this; 75 + } 76 + 77 + public function getCollapsed() { 78 + return $this->collapsed; 79 + } 80 + 81 + public function setNoDataString($nodata) { 82 + $this->noDataString = $nodata; 83 + return $this; 84 + } 85 + 86 + }
+5 -1
src/applications/slowvote/query/PhabricatorSlowvoteSearchEngine.php
··· 167 167 $list->addItem($item); 168 168 } 169 169 170 - return $list; 170 + $result = new PhabricatorApplicationSearchResultView(); 171 + $result->setObjectList($list); 172 + $result->setNoDataString(pht('No polls found.')); 173 + 174 + return $result; 171 175 } 172 176 173 177 }
+5 -1
src/applications/spaces/query/PhabricatorSpacesNamespaceSearchEngine.php
··· 91 91 $list->addItem($item); 92 92 } 93 93 94 - return $list; 94 + $result = new PhabricatorApplicationSearchResultView(); 95 + $result->setObjectList($list); 96 + $result->setNoDataString(pht('No spaces found.')); 97 + 98 + return $result; 95 99 } 96 100 97 101 }
-5
webroot/rsrc/css/aphront/table-view.css
··· 275 275 display: none; 276 276 } 277 277 278 - .aphront-table-view-device-ready { 279 - width: 99%; 280 - margin: 8px auto; 281 - } 282 - 283 278 .aphront-table-view td.link { 284 279 padding: 0; 285 280 }
+8
webroot/rsrc/css/application/base/notification-menu.css
··· 40 40 41 41 } 42 42 43 + .phabricator-notification-list.pm { 44 + padding: 0; 45 + } 46 + 47 + .phabricator-notification-list .phabricator-notification { 48 + padding: 10px 4px; 49 + } 50 + 43 51 .phabricator-notification { 44 52 padding: 6px 8px; 45 53 }