phorge/src/applications/dashboard/controller/PhabricatorDashboardViewController.php
Chad Little d1c253de94 Touch up basic usability of Dashboards
Summary: Ref T10390. This mostly shuffles layout into "View" and keepts "Manage" around for Edit/Copy/History. This feels better to me overall. Also tweaked some spacing and color.

Test Plan:
New Dashboard, edit Dashboard, shuffle panels. Create new panels.

{F2684043}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T10390

Differential Revision: https://secure.phabricator.com/D17326
2017-02-09 14:20:47 -08:00

60 lines
1.6 KiB
PHP

<?php
final class PhabricatorDashboardViewController
extends PhabricatorDashboardProfileController {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$dashboard = id(new PhabricatorDashboardQuery())
->setViewer($viewer)
->withIDs(array($id))
->needPanels(true)
->executeOne();
if (!$dashboard) {
return new Aphront404Response();
}
$this->setDashboard($dashboard);
$dashboard_uri = $this->getApplicationURI("view/{$id}/");
$title = $dashboard->getName();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('View'));
if ($dashboard->getPanelPHIDs()) {
$rendered_dashboard = id(new PhabricatorDashboardRenderingEngine())
->setViewer($viewer)
->setDashboard($dashboard)
->renderDashboard();
$content = id(new PHUIBoxView())
->addClass('dashboard-preview-box')
->appendChild($rendered_dashboard);
} else {
$content = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
->appendChild(pht('This dashboard has no panels yet.'));
}
$navigation = $this->buildSideNavView('view');
$header = $this->buildHeaderView();
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setFooter(array(
$content,
));
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->setNavigation($navigation)
->appendChild($view);
}
}