mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-21 13:00:56 +01:00
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
This commit is contained in:
parent
33aa395806
commit
92ccadaa42
1 changed files with 24 additions and 5 deletions
|
@ -26,10 +26,14 @@ final class PhabricatorDashboardViewController
|
|||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addTextCrumb(pht('Dashboard %d', $dashboard->getID()));
|
||||
|
||||
$rendered_dashboard = id(new PhabricatorDashboardRenderingEngine())
|
||||
->setViewer($viewer)
|
||||
->setDashboard($dashboard)
|
||||
->renderDashboard();
|
||||
if ($dashboard->getPanelPHIDs()) {
|
||||
$rendered_dashboard = id(new PhabricatorDashboardRenderingEngine())
|
||||
->setViewer($viewer)
|
||||
->setDashboard($dashboard)
|
||||
->renderDashboard();
|
||||
} else {
|
||||
$rendered_dashboard = $this->buildEmptyView();
|
||||
}
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
array(
|
||||
|
@ -50,9 +54,24 @@ final class PhabricatorDashboardViewController
|
|||
id(new PHUIListItemView())
|
||||
->setIcon('fa-th')
|
||||
->setName(pht('Manage Dashboard'))
|
||||
->setHref($this->getApplicationURI()."manage/{$id}/"));
|
||||
->setHref($this->getApplicationURI("manage/{$id}/")));
|
||||
|
||||
return $crumbs;
|
||||
}
|
||||
|
||||
public function buildEmptyView() {
|
||||
$id = $this->id;
|
||||
$manage_uri = $this->getApplicationURI("manage/{$id}/");
|
||||
|
||||
return id(new AphrontErrorView())
|
||||
->setSeverity(AphrontErrorView::SEVERITY_NODATA)
|
||||
->appendChild(
|
||||
pht('This dashboard has no panels '.
|
||||
'yet. Use %s to add panels.',
|
||||
phutil_tag(
|
||||
'a',
|
||||
array('href'=>$manage_uri),
|
||||
pht('Manage Dashboard'))));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue