Allow entire dashboards to be copied
Summary:
Further improve UX for dealing with policy rules on dashboards:
- When in the "Manage" view of a dashboard you can not edit:
- Don't show the panel management controls.
- Show a notice that the board isn't editable, recommending you make a copy instead.
- Add a "Copy Dashboard" action to create a copy which you //can// edit.
Test Plan: Copied some dashboards. See screenshots.
Reviewers: chad
Reviewed By: chad
Subscribers: epriestley
Differential Revision: https://secure.phabricator.com/D9508
This commit is contained in:
@@ -28,6 +28,11 @@ final class PhabricatorDashboardManageController
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||
$viewer,
|
||||
$dashboard,
|
||||
PhabricatorPolicyCapability::CAN_EDIT);
|
||||
|
||||
$title = $dashboard->getName();
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
@@ -45,10 +50,21 @@ final class PhabricatorDashboardManageController
|
||||
->setHeader($header)
|
||||
->addPropertyList($properties);
|
||||
|
||||
if (!$can_edit) {
|
||||
$no_edit = pht(
|
||||
'You do not have permission to edit this dashboard. If you want to '.
|
||||
'make changes, make a copy first.');
|
||||
|
||||
$box->setErrorView(
|
||||
id(new AphrontErrorView())
|
||||
->setSeverity(AphrontErrorView::SEVERITY_NOTICE)
|
||||
->setErrors(array($no_edit)));
|
||||
}
|
||||
|
||||
$rendered_dashboard = id(new PhabricatorDashboardRenderingEngine())
|
||||
->setViewer($viewer)
|
||||
->setDashboard($dashboard)
|
||||
->setArrangeMode(true)
|
||||
->setArrangeMode($can_edit)
|
||||
->renderDashboard();
|
||||
|
||||
return $this->buildApplicationPage(
|
||||
@@ -93,6 +109,13 @@ final class PhabricatorDashboardManageController
|
||||
->setDisabled(!$can_edit)
|
||||
->setWorkflow(!$can_edit));
|
||||
|
||||
$actions->addAction(
|
||||
id(new PhabricatorActionView())
|
||||
->setName(pht('Copy Dashboard'))
|
||||
->setIcon('fa-files-o')
|
||||
->setHref($this->getApplicationURI("copy/{$id}/"))
|
||||
->setWorkflow(true));
|
||||
|
||||
$installed_dashboard = id(new PhabricatorDashboardInstall())
|
||||
->loadOneWhere(
|
||||
'objectPHID = %s AND applicationClass = %s',
|
||||
|
||||
Reference in New Issue
Block a user