Skip to content

Commit 92ccada

Browse files
lkassianikepriestley
lkassianik
authored and
epriestley
committedMay 27, 2014
Create an empty state for dashboards
Summary: Fixes T5177. Not sure if checking for panelPHIDs is right, but seemed like a better choice than adding a new property on dashboard. Test Plan: Create dashboard with no panels. Go to view dashboard. "view" page should have a placeholder that directs user to Manage Dashboard Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Maniphest Tasks: T5177 Differential Revision: https://secure.phabricator.com/D9312
1 parent 33aa395 commit 92ccada

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed
 

‎src/applications/dashboard/controller/PhabricatorDashboardViewController.php

+24-5
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@ public function processRequest() {
2626
$crumbs = $this->buildApplicationCrumbs();
2727
$crumbs->addTextCrumb(pht('Dashboard %d', $dashboard->getID()));
2828

29-
$rendered_dashboard = id(new PhabricatorDashboardRenderingEngine())
30-
->setViewer($viewer)
31-
->setDashboard($dashboard)
32-
->renderDashboard();
29+
if ($dashboard->getPanelPHIDs()) {
30+
$rendered_dashboard = id(new PhabricatorDashboardRenderingEngine())
31+
->setViewer($viewer)
32+
->setDashboard($dashboard)
33+
->renderDashboard();
34+
} else {
35+
$rendered_dashboard = $this->buildEmptyView();
36+
}
3337

3438
return $this->buildApplicationPage(
3539
array(
@@ -50,9 +54,24 @@ public function buildApplicationCrumbs() {
5054
id(new PHUIListItemView())
5155
->setIcon('fa-th')
5256
->setName(pht('Manage Dashboard'))
53-
->setHref($this->getApplicationURI()."manage/{$id}/"));
57+
->setHref($this->getApplicationURI("manage/{$id}/")));
5458

5559
return $crumbs;
5660
}
5761

62+
public function buildEmptyView() {
63+
$id = $this->id;
64+
$manage_uri = $this->getApplicationURI("manage/{$id}/");
65+
66+
return id(new AphrontErrorView())
67+
->setSeverity(AphrontErrorView::SEVERITY_NODATA)
68+
->appendChild(
69+
pht('This dashboard has no panels '.
70+
'yet. Use %s to add panels.',
71+
phutil_tag(
72+
'a',
73+
array('href'=>$manage_uri),
74+
pht('Manage Dashboard'))));
75+
}
76+
5877
}

0 commit comments

Comments
 (0)
Failed to load comments.