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:
@@ -92,6 +92,26 @@ final class PhabricatorDashboardViewController
|
||||
->setDisabled(!$can_edit)
|
||||
->setWorkflow(!$can_edit));
|
||||
|
||||
$installed_dashboard = id(new PhabricatorDashboardInstall())
|
||||
->loadOneWhere(
|
||||
'objectPHID = %s AND applicationClass = %s',
|
||||
$viewer->getPHID(),
|
||||
'PhabricatorApplicationHome');
|
||||
if ($installed_dashboard &&
|
||||
$installed_dashboard->getDashboardPHID() == $dashboard->getPHID()) {
|
||||
$title_install = pht('Uninstall Dashboard');
|
||||
$href_install = "uninstall/{$id}/";
|
||||
} else {
|
||||
$title_install = pht('Install Dashboard');
|
||||
$href_install = "install/{$id}/";
|
||||
}
|
||||
$actions->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setName($title_install)
|
||||
->setIcon('fa-wrench')
|
||||
->setHref($this->getApplicationURI($href_install))
|
||||
->setWorkflow(true));
|
||||
|
||||
$actions->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setName(pht('Add Panel'))
|
||||
|
||||
Reference in New Issue
Block a user