Correct a parameter order swap in "diffusion.historyquery" for Mercurial
[phabricator.git] / src / applications / dashboard / controller / panel / PhabricatorDashboardPanelListController.php
blob1eab1482619a219144c6b40abefef409f731bf63
1 <?php
3 final class PhabricatorDashboardPanelListController
4 extends PhabricatorDashboardController {
6 private $queryKey;
8 public function shouldAllowPublic() {
9 return true;
12 public function handleRequest(AphrontRequest $request) {
13 $query_key = $request->getURIData('queryKey');
15 $controller = id(new PhabricatorApplicationSearchController())
16 ->setQueryKey($query_key)
17 ->setSearchEngine(new PhabricatorDashboardPanelSearchEngine())
18 ->setNavigation($this->buildSideNavView());
19 return $this->delegateToController($controller);
22 public function buildSideNavView() {
23 $user = $this->getRequest()->getUser();
25 $nav = new AphrontSideNavFilterView();
26 $nav->setBaseURI(new PhutilURI($this->getApplicationURI()));
28 id(new PhabricatorDashboardPanelSearchEngine())
29 ->setViewer($user)
30 ->addNavigationItems($nav->getMenu());
32 $nav->selectFilter(null);
34 return $nav;
37 protected function buildApplicationCrumbs() {
38 $crumbs = parent::buildApplicationCrumbs();
40 $crumbs->addTextCrumb(pht('Panels'), $this->getApplicationURI().'panel/');
42 $crumbs->addAction(
43 id(new PHUIListItemView())
44 ->setIcon('fa-plus-square')
45 ->setName(pht('Create Panel'))
46 ->setHref($this->getApplicationURI().'panel/edit/'));
48 return $crumbs;
51 protected function getNewUserBody() {
52 $create_button = id(new PHUIButtonView())
53 ->setTag('a')
54 ->setText(pht('Create a Panel'))
55 ->setHref('/dashboard/panel/edit/')
56 ->setColor(PHUIButtonView::GREEN);
58 $icon = $this->getApplication()->getIcon();
59 $app_name = $this->getApplication()->getName();
60 $view = id(new PHUIBigInfoView())
61 ->setIcon($icon)
62 ->setTitle(pht('Welcome to %s', $app_name))
63 ->setDescription(
64 pht('Build individual panels to display on your homepage dashboard.'))
65 ->addAction($create_button);
67 return $view;