1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Make Portals reachable without knowing the URI

Summary:
Depends on D20360. Ref T13275. This makes the "Dashboards" application start on a Drydock-like console page where you pick portals, dashboards, or panels.

Probably the "Dashboards" application should either be renamed to "IntelliknowledgePro" or Portals should be split off into a separate application eventually, but let's see how things go like this for now, since restructuring probably breaks some URIs at least a little bit so I'd like more confidence that we're headed in the right direction before we do it.

Test Plan:
  - Visited Dashboards via typeahead, got options for Dashboards/Portals/Panels.
  - Visited Portals pages, got simplified crumbs.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13275

Differential Revision: https://secure.phabricator.com/D20361
This commit is contained in:
epriestley 2019-03-31 14:48:23 -07:00
parent c9d3fb2ac5
commit 18732a0d2f
6 changed files with 89 additions and 6 deletions

View file

@ -2907,6 +2907,7 @@ phutil_register_library_map(array(
'PhabricatorDashboardApplication' => 'applications/dashboard/application/PhabricatorDashboardApplication.php',
'PhabricatorDashboardArchiveController' => 'applications/dashboard/controller/PhabricatorDashboardArchiveController.php',
'PhabricatorDashboardArrangeController' => 'applications/dashboard/controller/PhabricatorDashboardArrangeController.php',
'PhabricatorDashboardConsoleController' => 'applications/dashboard/controller/PhabricatorDashboardConsoleController.php',
'PhabricatorDashboardController' => 'applications/dashboard/controller/PhabricatorDashboardController.php',
'PhabricatorDashboardDAO' => 'applications/dashboard/storage/PhabricatorDashboardDAO.php',
'PhabricatorDashboardDashboardHasPanelEdgeType' => 'applications/dashboard/edge/PhabricatorDashboardDashboardHasPanelEdgeType.php',
@ -8867,6 +8868,7 @@ phutil_register_library_map(array(
'PhabricatorDashboardApplication' => 'PhabricatorApplication',
'PhabricatorDashboardArchiveController' => 'PhabricatorDashboardController',
'PhabricatorDashboardArrangeController' => 'PhabricatorDashboardProfileController',
'PhabricatorDashboardConsoleController' => 'PhabricatorDashboardController',
'PhabricatorDashboardController' => 'PhabricatorController',
'PhabricatorDashboardDAO' => 'PhabricatorLiskDAO',
'PhabricatorDashboardDashboardHasPanelEdgeType' => 'PhabricatorEdgeType',

View file

@ -10,6 +10,10 @@ final class PhabricatorDashboardApplication extends PhabricatorApplication {
return '/dashboard/';
}
public function getTypeaheadURI() {
return '/dashboard/console/';
}
public function getShortDescription() {
return pht('Create Custom Pages');
}
@ -42,6 +46,7 @@ final class PhabricatorDashboardApplication extends PhabricatorApplication {
'create/' => 'PhabricatorDashboardEditController',
'edit/(?:(?P<id>\d+)/)?' => 'PhabricatorDashboardEditController',
'install/(?:(?P<id>\d+)/)?' => 'PhabricatorDashboardInstallController',
'console/' => 'PhabricatorDashboardConsoleController',
'addpanel/(?P<id>\d+)/' => 'PhabricatorDashboardAddPanelController',
'movepanel/(?P<id>\d+)/' => 'PhabricatorDashboardMovePanelController',
'removepanel/(?P<id>\d+)/'

View file

@ -0,0 +1,72 @@
<?php
final class PhabricatorDashboardConsoleController
extends PhabricatorDashboardController {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$menu = id(new PHUIObjectItemListView())
->setUser($viewer)
->setBig(true);
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Portals'))
->setImageIcon('fa-compass')
->setHref('/portal/')
->setClickable(true)
->addAttribute(
pht(
'Portals are collections of dashboards, links, and other '.
'resources that can provide a high-level overview of a '.
'project.')));
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Dashboards'))
->setImageIcon('fa-dashboard')
->setHref($this->getApplicationURI('/'))
->setClickable(true)
->addAttribute(
pht(
'Dashboards organize panels, creating a cohesive page for '.
'analysis or action.')));
$menu->addItem(
id(new PHUIObjectItemView())
->setHeader(pht('Panels'))
->setImageIcon('fa-line-chart')
->setHref($this->getApplicationURI('panel/'))
->setClickable(true)
->addAttribute(
pht(
'Panels show queries, charts, and other information to provide '.
'insight on a particular topic.')));
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Console'));
$crumbs->setBorder(true);
$title = pht('Dashboard Console');
$box = id(new PHUIObjectBoxView())
->setHeaderText($title)
->setBackground(PHUIObjectBoxView::WHITE_CONFIG)
->setObjectList($menu);
$view = id(new PHUITwoColumnView())
->setFixed(true)
->setFooter($box);
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($view);
}
}

View file

@ -28,9 +28,6 @@ final class PhabricatorDashboardListController
->setViewer($user)
->addNavigationItems($nav->getMenu());
$nav->addLabel(pht('Panels'));
$nav->addFilter('panel/', pht('Manage Panels'));
$nav->selectFilter(null);
return $nav;

View file

@ -4,9 +4,13 @@ abstract class PhabricatorDashboardPortalController
extends PhabricatorDashboardController {
protected function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
$crumbs = new PHUICrumbsView();
$crumbs->addTextCrumb(pht('Portals'), '/portal/');
$crumbs->addCrumb(
id(new PHUICrumbView())
->setHref('/portal/')
->setName(pht('Portals'))
->setIcon('fa-compass'));
return $crumbs;
}

View file

@ -872,7 +872,10 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView
// mobile navigation menu from.
$application_menu = $controller->buildApplicationMenu();
if (!$application_menu) {
$application_menu = $this->getNavigation()->getMenu();
$navigation = $this->getNavigation();
if ($navigation) {
$application_menu = $navigation->getMenu();
}
}
$this->applicationMenu = $application_menu;