Dashboards - add ability to install dashboard as home
Summary: See title. Adds PhabricatorDashboardInstall data object which scopes installs to objectPHID + applicationClass. This is because we already have a collision for user home pages and user profiles. Assume only one dashboard per objectPHID + applicationClass though at the database level. Fixes T5076. Test Plan: From dashboard view, installed a dashboard - success! Went back to dashboard view and uninstalled it! Reviewers: chad, epriestley Reviewed By: epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T5076 Differential Revision: https://secure.phabricator.com/D9206
This commit is contained in:
@@ -20,15 +20,36 @@ final class PhabricatorHomeMainController
|
||||
if ($this->filter == 'jump') {
|
||||
return $this->buildJumpResponse();
|
||||
}
|
||||
|
||||
$nav = $this->buildNav();
|
||||
|
||||
$project_query = new PhabricatorProjectQuery();
|
||||
$project_query->setViewer($user);
|
||||
$project_query->withMemberPHIDs(array($user->getPHID()));
|
||||
$projects = $project_query->execute();
|
||||
$dashboard = PhabricatorDashboardInstall::getDashboard(
|
||||
$user,
|
||||
$user->getPHID(),
|
||||
get_class($this->getCurrentApplication()));
|
||||
if ($dashboard) {
|
||||
$rendered_dashboard = id(new PhabricatorDashboardRenderingEngine())
|
||||
->setViewer($user)
|
||||
->setDashboard($dashboard)
|
||||
->renderDashboard();
|
||||
$nav->appendChild($rendered_dashboard);
|
||||
} else {
|
||||
$project_query = new PhabricatorProjectQuery();
|
||||
$project_query->setViewer($user);
|
||||
$project_query->withMemberPHIDs(array($user->getPHID()));
|
||||
$projects = $project_query->execute();
|
||||
|
||||
return $this->buildMainResponse($nav, $projects);
|
||||
$nav = $this->buildMainResponse($nav, $projects);
|
||||
}
|
||||
|
||||
$nav->appendChild(id(new PhabricatorGlobalUploadTargetView())
|
||||
->setUser($user));
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
$nav,
|
||||
array(
|
||||
'title' => 'Phabricator',
|
||||
'device' => true,
|
||||
));
|
||||
}
|
||||
|
||||
private function buildMainResponse($nav, array $projects) {
|
||||
@@ -91,17 +112,10 @@ final class PhabricatorHomeMainController
|
||||
$this->minipanels,
|
||||
);
|
||||
|
||||
$user = $this->getRequest()->getUser();
|
||||
$nav->appendChild($content);
|
||||
$nav->appendChild(id(new PhabricatorGlobalUploadTargetView())
|
||||
->setUser($user));
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
$nav,
|
||||
array(
|
||||
'title' => 'Phabricator',
|
||||
'device' => true,
|
||||
));
|
||||
return $nav;
|
||||
|
||||
}
|
||||
|
||||
private function buildJumpResponse() {
|
||||
|
||||
Reference in New Issue
Block a user