mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-19 03:01:11 +01:00
Make the default view of dashboards be just the dashboard
Summary: Fixes T4985, add manage page, change view page to show only panels. Arguably, PhabricatorDashboardArrangeController is no longer necessary. Also, still trying to figure out if I updated all flows that involve "arrange/{id}". Probably missed some. Also not sure of the Manage Dashboard icon. Please advise. Test Plan: Create dashboard, add panels, "view/{id}" should show just panels, Manage Dashboard should show timeline and edit links. Reviewers: #blessed_reviewers, epriestley, chad Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Maniphest Tasks: T4985 Differential Revision: https://secure.phabricator.com/D9258
This commit is contained in:
parent
f896dc5392
commit
6302414883
9 changed files with 180 additions and 193 deletions
|
@ -1463,7 +1463,6 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorDaemonTaskGarbageCollector' => 'applications/daemon/garbagecollector/PhabricatorDaemonTaskGarbageCollector.php',
|
'PhabricatorDaemonTaskGarbageCollector' => 'applications/daemon/garbagecollector/PhabricatorDaemonTaskGarbageCollector.php',
|
||||||
'PhabricatorDashboard' => 'applications/dashboard/storage/PhabricatorDashboard.php',
|
'PhabricatorDashboard' => 'applications/dashboard/storage/PhabricatorDashboard.php',
|
||||||
'PhabricatorDashboardAddPanelController' => 'applications/dashboard/controller/PhabricatorDashboardAddPanelController.php',
|
'PhabricatorDashboardAddPanelController' => 'applications/dashboard/controller/PhabricatorDashboardAddPanelController.php',
|
||||||
'PhabricatorDashboardArrangeController' => 'applications/dashboard/controller/PhabricatorDashboardArrangeController.php',
|
|
||||||
'PhabricatorDashboardController' => 'applications/dashboard/controller/PhabricatorDashboardController.php',
|
'PhabricatorDashboardController' => 'applications/dashboard/controller/PhabricatorDashboardController.php',
|
||||||
'PhabricatorDashboardDAO' => 'applications/dashboard/storage/PhabricatorDashboardDAO.php',
|
'PhabricatorDashboardDAO' => 'applications/dashboard/storage/PhabricatorDashboardDAO.php',
|
||||||
'PhabricatorDashboardEditController' => 'applications/dashboard/controller/PhabricatorDashboardEditController.php',
|
'PhabricatorDashboardEditController' => 'applications/dashboard/controller/PhabricatorDashboardEditController.php',
|
||||||
|
@ -1471,6 +1470,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorDashboardInstallController' => 'applications/dashboard/controller/PhabricatorDashboardInstallController.php',
|
'PhabricatorDashboardInstallController' => 'applications/dashboard/controller/PhabricatorDashboardInstallController.php',
|
||||||
'PhabricatorDashboardLayoutConfig' => 'applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php',
|
'PhabricatorDashboardLayoutConfig' => 'applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php',
|
||||||
'PhabricatorDashboardListController' => 'applications/dashboard/controller/PhabricatorDashboardListController.php',
|
'PhabricatorDashboardListController' => 'applications/dashboard/controller/PhabricatorDashboardListController.php',
|
||||||
|
'PhabricatorDashboardManageController' => 'applications/dashboard/controller/PhabricatorDashboardManageController.php',
|
||||||
'PhabricatorDashboardMovePanelController' => 'applications/dashboard/controller/PhabricatorDashboardMovePanelController.php',
|
'PhabricatorDashboardMovePanelController' => 'applications/dashboard/controller/PhabricatorDashboardMovePanelController.php',
|
||||||
'PhabricatorDashboardPHIDTypeDashboard' => 'applications/dashboard/phid/PhabricatorDashboardPHIDTypeDashboard.php',
|
'PhabricatorDashboardPHIDTypeDashboard' => 'applications/dashboard/phid/PhabricatorDashboardPHIDTypeDashboard.php',
|
||||||
'PhabricatorDashboardPHIDTypePanel' => 'applications/dashboard/phid/PhabricatorDashboardPHIDTypePanel.php',
|
'PhabricatorDashboardPHIDTypePanel' => 'applications/dashboard/phid/PhabricatorDashboardPHIDTypePanel.php',
|
||||||
|
@ -4258,13 +4258,13 @@ phutil_register_library_map(array(
|
||||||
1 => 'PhabricatorPolicyInterface',
|
1 => 'PhabricatorPolicyInterface',
|
||||||
),
|
),
|
||||||
'PhabricatorDashboardAddPanelController' => 'PhabricatorDashboardController',
|
'PhabricatorDashboardAddPanelController' => 'PhabricatorDashboardController',
|
||||||
'PhabricatorDashboardArrangeController' => 'PhabricatorDashboardController',
|
|
||||||
'PhabricatorDashboardController' => 'PhabricatorController',
|
'PhabricatorDashboardController' => 'PhabricatorController',
|
||||||
'PhabricatorDashboardDAO' => 'PhabricatorLiskDAO',
|
'PhabricatorDashboardDAO' => 'PhabricatorLiskDAO',
|
||||||
'PhabricatorDashboardEditController' => 'PhabricatorDashboardController',
|
'PhabricatorDashboardEditController' => 'PhabricatorDashboardController',
|
||||||
'PhabricatorDashboardInstall' => 'PhabricatorDashboardDAO',
|
'PhabricatorDashboardInstall' => 'PhabricatorDashboardDAO',
|
||||||
'PhabricatorDashboardInstallController' => 'PhabricatorDashboardController',
|
'PhabricatorDashboardInstallController' => 'PhabricatorDashboardController',
|
||||||
'PhabricatorDashboardListController' => 'PhabricatorDashboardController',
|
'PhabricatorDashboardListController' => 'PhabricatorDashboardController',
|
||||||
|
'PhabricatorDashboardManageController' => 'PhabricatorDashboardController',
|
||||||
'PhabricatorDashboardMovePanelController' => 'PhabricatorDashboardController',
|
'PhabricatorDashboardMovePanelController' => 'PhabricatorDashboardController',
|
||||||
'PhabricatorDashboardPHIDTypeDashboard' => 'PhabricatorPHIDType',
|
'PhabricatorDashboardPHIDTypeDashboard' => 'PhabricatorPHIDType',
|
||||||
'PhabricatorDashboardPHIDTypePanel' => 'PhabricatorPHIDType',
|
'PhabricatorDashboardPHIDTypePanel' => 'PhabricatorPHIDType',
|
||||||
|
|
|
@ -21,7 +21,7 @@ final class PhabricatorApplicationDashboard extends PhabricatorApplication {
|
||||||
'(?:query/(?P<queryKey>[^/]+)/)?'
|
'(?:query/(?P<queryKey>[^/]+)/)?'
|
||||||
=> 'PhabricatorDashboardListController',
|
=> 'PhabricatorDashboardListController',
|
||||||
'view/(?P<id>\d+)/' => 'PhabricatorDashboardViewController',
|
'view/(?P<id>\d+)/' => 'PhabricatorDashboardViewController',
|
||||||
'arrange/(?P<id>\d+)/' => 'PhabricatorDashboardArrangeController',
|
'manage/(?P<id>\d+)/' => 'PhabricatorDashboardManageController',
|
||||||
'create/' => 'PhabricatorDashboardEditController',
|
'create/' => 'PhabricatorDashboardEditController',
|
||||||
'edit/(?:(?P<id>\d+)/)?' => 'PhabricatorDashboardEditController',
|
'edit/(?:(?P<id>\d+)/)?' => 'PhabricatorDashboardEditController',
|
||||||
'install/(?P<id>\d+)/' => 'PhabricatorDashboardInstallController',
|
'install/(?P<id>\d+)/' => 'PhabricatorDashboardInstallController',
|
||||||
|
|
|
@ -26,13 +26,8 @@ final class PhabricatorDashboardAddPanelController
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($request->getStr('src', 'edit') == 'edit') {
|
|
||||||
$redirect_uri = $this->getApplicationURI(
|
$redirect_uri = $this->getApplicationURI(
|
||||||
'view/'.$dashboard->getID().'/');
|
'manage/'.$dashboard->getID().'/');
|
||||||
} else {
|
|
||||||
$redirect_uri = $this->getApplicationURI(
|
|
||||||
'arrange/'.$dashboard->getID().'/');
|
|
||||||
}
|
|
||||||
$layout_config = $dashboard->getLayoutConfigObject();
|
$layout_config = $dashboard->getLayoutConfigObject();
|
||||||
|
|
||||||
$v_panel = $request->getStr('panel');
|
$v_panel = $request->getStr('panel');
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
final class PhabricatorDashboardArrangeController
|
|
||||||
extends PhabricatorDashboardController {
|
|
||||||
|
|
||||||
private $id;
|
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
|
||||||
$this->id = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$dashboard = id(new PhabricatorDashboardQuery())
|
|
||||||
->setViewer($viewer)
|
|
||||||
->withIDs(array($this->id))
|
|
||||||
->needPanels(true)
|
|
||||||
->requireCapabilities(
|
|
||||||
array(
|
|
||||||
PhabricatorPolicyCapability::CAN_VIEW,
|
|
||||||
PhabricatorPolicyCapability::CAN_EDIT,
|
|
||||||
))
|
|
||||||
->executeOne();
|
|
||||||
if (!$dashboard) {
|
|
||||||
return new Aphront404Response();
|
|
||||||
}
|
|
||||||
|
|
||||||
$title = $dashboard->getName();
|
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
|
||||||
$crumbs->addTextCrumb(
|
|
||||||
pht('Dashboard %d', $dashboard->getID()),
|
|
||||||
$this->getApplicationURI('view/'.$dashboard->getID().'/'));
|
|
||||||
$crumbs->addTextCrumb(pht('Arrange'));
|
|
||||||
|
|
||||||
$rendered_dashboard = id(new PhabricatorDashboardRenderingEngine())
|
|
||||||
->setViewer($viewer)
|
|
||||||
->setDashboard($dashboard)
|
|
||||||
->setArrangeMode(true)
|
|
||||||
->renderDashboard();
|
|
||||||
|
|
||||||
return $this->buildApplicationPage(
|
|
||||||
array(
|
|
||||||
$crumbs,
|
|
||||||
$rendered_dashboard,
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'title' => $title,
|
|
||||||
'device' => true,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -46,7 +46,7 @@ final class PhabricatorDashboardEditController
|
||||||
$crumbs->addTextCrumb('Create Dashboard');
|
$crumbs->addTextCrumb('Create Dashboard');
|
||||||
} else {
|
} else {
|
||||||
$id = $dashboard->getID();
|
$id = $dashboard->getID();
|
||||||
$cancel_uri = $this->getApplicationURI('view/'.$id.'/');
|
$cancel_uri = $this->getApplicationURI('manage/'.$id.'/');
|
||||||
|
|
||||||
$title = pht('Edit Dashboard %d', $dashboard->getID());
|
$title = pht('Edit Dashboard %d', $dashboard->getID());
|
||||||
$header = pht('Edit Dashboard "%s"', $dashboard->getName());
|
$header = pht('Edit Dashboard "%s"', $dashboard->getName());
|
||||||
|
@ -94,11 +94,8 @@ final class PhabricatorDashboardEditController
|
||||||
->setContentSourceFromRequest($request)
|
->setContentSourceFromRequest($request)
|
||||||
->applyTransactions($dashboard, $xactions);
|
->applyTransactions($dashboard, $xactions);
|
||||||
|
|
||||||
if ($is_new) {
|
$uri = $this->getApplicationURI('manage/'.$dashboard->getID().'/');
|
||||||
$uri = $this->getApplicationURI('arrange/'.$dashboard->getID().'/');
|
|
||||||
} else {
|
|
||||||
$uri = $this->getApplicationURI('view/'.$dashboard->getID().'/');
|
|
||||||
}
|
|
||||||
return id(new AphrontRedirectResponse())->setURI($uri);
|
return id(new AphrontRedirectResponse())->setURI($uri);
|
||||||
} catch (PhabricatorApplicationTransactionValidationException $ex) {
|
} catch (PhabricatorApplicationTransactionValidationException $ex) {
|
||||||
$validation_exception = $ex;
|
$validation_exception = $ex;
|
||||||
|
|
|
@ -0,0 +1,161 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorDashboardManageController
|
||||||
|
extends PhabricatorDashboardController {
|
||||||
|
|
||||||
|
private $id;
|
||||||
|
|
||||||
|
public function willProcessRequest(array $data) {
|
||||||
|
$this->id = $data['id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function processRequest() {
|
||||||
|
$request = $this->getRequest();
|
||||||
|
$viewer = $request->getUser();
|
||||||
|
$id = $this->id;
|
||||||
|
$dashboard_uri = $this->getApplicationURI('view/'.$id.'/');
|
||||||
|
|
||||||
|
$dashboard = id(new PhabricatorDashboardQuery())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->withIDs(array($this->id))
|
||||||
|
->needPanels(true)
|
||||||
|
->executeOne();
|
||||||
|
if (!$dashboard) {
|
||||||
|
return new Aphront404Response();
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = $dashboard->getName();
|
||||||
|
|
||||||
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
|
$crumbs->addTextCrumb(
|
||||||
|
pht('Dashboard %d', $dashboard->getID()),
|
||||||
|
$dashboard_uri);
|
||||||
|
$crumbs->addTextCrumb(pht('Manage'));
|
||||||
|
|
||||||
|
$header = $this->buildHeaderView($dashboard);
|
||||||
|
$actions = $this->buildActionView($dashboard);
|
||||||
|
$properties = $this->buildPropertyView($dashboard);
|
||||||
|
$timeline = $this->buildTransactions($dashboard);
|
||||||
|
|
||||||
|
$properties->setActionList($actions);
|
||||||
|
$box = id(new PHUIObjectBoxView())
|
||||||
|
->setHeader($header)
|
||||||
|
->addPropertyList($properties);
|
||||||
|
|
||||||
|
$rendered_dashboard = id(new PhabricatorDashboardRenderingEngine())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->setDashboard($dashboard)
|
||||||
|
->setArrangeMode(true)
|
||||||
|
->renderDashboard();
|
||||||
|
|
||||||
|
return $this->buildApplicationPage(
|
||||||
|
array(
|
||||||
|
$crumbs,
|
||||||
|
$box,
|
||||||
|
$timeline,
|
||||||
|
$rendered_dashboard,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'title' => $title,
|
||||||
|
'device' => true,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildHeaderView(PhabricatorDashboard $dashboard) {
|
||||||
|
$viewer = $this->getRequest()->getUser();
|
||||||
|
|
||||||
|
return id(new PHUIHeaderView())
|
||||||
|
->setUser($viewer)
|
||||||
|
->setHeader($dashboard->getName())
|
||||||
|
->setPolicyObject($dashboard);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildActionView(PhabricatorDashboard $dashboard) {
|
||||||
|
$viewer = $this->getRequest()->getUser();
|
||||||
|
$id = $dashboard->getID();
|
||||||
|
|
||||||
|
$actions = id(new PhabricatorActionListView())
|
||||||
|
->setObjectURI($this->getApplicationURI('view/'.$dashboard->getID().'/'))
|
||||||
|
->setUser($viewer);
|
||||||
|
|
||||||
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||||
|
$viewer,
|
||||||
|
$dashboard,
|
||||||
|
PhabricatorPolicyCapability::CAN_EDIT);
|
||||||
|
|
||||||
|
$actions->addAction(
|
||||||
|
id(new PhabricatorActionView())
|
||||||
|
->setName(pht('Edit Dashboard'))
|
||||||
|
->setIcon('fa-pencil')
|
||||||
|
->setHref($this->getApplicationURI("edit/{$id}/"))
|
||||||
|
->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));
|
||||||
|
|
||||||
|
return $actions;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildPropertyView(PhabricatorDashboard $dashboard) {
|
||||||
|
$viewer = $this->getRequest()->getUser();
|
||||||
|
|
||||||
|
$properties = id(new PHUIPropertyListView())
|
||||||
|
->setUser($viewer)
|
||||||
|
->setObject($dashboard);
|
||||||
|
|
||||||
|
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
|
||||||
|
$viewer,
|
||||||
|
$dashboard);
|
||||||
|
|
||||||
|
$properties->addProperty(
|
||||||
|
pht('Editable By'),
|
||||||
|
$descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
|
||||||
|
|
||||||
|
$panel_phids = $dashboard->getPanelPHIDs();
|
||||||
|
$this->loadHandles($panel_phids);
|
||||||
|
|
||||||
|
$properties->addProperty(
|
||||||
|
pht('Panels'),
|
||||||
|
$this->renderHandlesForPHIDs($panel_phids));
|
||||||
|
|
||||||
|
return $properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildTransactions(PhabricatorDashboard $dashboard) {
|
||||||
|
$viewer = $this->getRequest()->getUser();
|
||||||
|
|
||||||
|
$xactions = id(new PhabricatorDashboardTransactionQuery())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->withObjectPHIDs(array($dashboard->getPHID()))
|
||||||
|
->execute();
|
||||||
|
|
||||||
|
$engine = id(new PhabricatorMarkupEngine())
|
||||||
|
->setViewer($viewer);
|
||||||
|
|
||||||
|
$timeline = id(new PhabricatorApplicationTransactionView())
|
||||||
|
->setUser($viewer)
|
||||||
|
->setObjectPHID($dashboard->getPHID())
|
||||||
|
->setTransactions($xactions);
|
||||||
|
|
||||||
|
return $timeline;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -182,7 +182,7 @@ final class PhabricatorDashboardPanelEditController
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$dashboard_id = $request->getInt('dashboardID');
|
$dashboard_id = $request->getInt('dashboardID');
|
||||||
if ($dashboard_id) {
|
if ($dashboard_id) {
|
||||||
$uri = $this->getApplicationURI('arrange/'.$dashboard_id.'/');
|
$uri = $this->getApplicationURI('manage/'.$dashboard_id.'/');
|
||||||
} else {
|
} else {
|
||||||
$uri = '/'.$panel->getMonogram();
|
$uri = '/'.$panel->getMonogram();
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ final class PhabricatorDashboardRemovePanelController
|
||||||
}
|
}
|
||||||
|
|
||||||
$redirect_uri = $this->getApplicationURI(
|
$redirect_uri = $this->getApplicationURI(
|
||||||
'arrange/'.$dashboard->getID().'/');
|
'manage/'.$dashboard->getID().'/');
|
||||||
$layout_config = $dashboard->getLayoutConfigObject();
|
$layout_config = $dashboard->getLayoutConfigObject();
|
||||||
|
|
||||||
if ($request->isFormPost()) {
|
if ($request->isFormPost()) {
|
||||||
|
|
|
@ -26,16 +26,6 @@ final class PhabricatorDashboardViewController
|
||||||
$crumbs = $this->buildApplicationCrumbs();
|
$crumbs = $this->buildApplicationCrumbs();
|
||||||
$crumbs->addTextCrumb(pht('Dashboard %d', $dashboard->getID()));
|
$crumbs->addTextCrumb(pht('Dashboard %d', $dashboard->getID()));
|
||||||
|
|
||||||
$header = $this->buildHeaderView($dashboard);
|
|
||||||
$actions = $this->buildActionView($dashboard);
|
|
||||||
$properties = $this->buildPropertyView($dashboard);
|
|
||||||
$timeline = $this->buildTransactions($dashboard);
|
|
||||||
|
|
||||||
$properties->setActionList($actions);
|
|
||||||
$box = id(new PHUIObjectBoxView())
|
|
||||||
->setHeader($header)
|
|
||||||
->addPropertyList($properties);
|
|
||||||
|
|
||||||
$rendered_dashboard = id(new PhabricatorDashboardRenderingEngine())
|
$rendered_dashboard = id(new PhabricatorDashboardRenderingEngine())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->setDashboard($dashboard)
|
->setDashboard($dashboard)
|
||||||
|
@ -44,8 +34,6 @@ final class PhabricatorDashboardViewController
|
||||||
return $this->buildApplicationPage(
|
return $this->buildApplicationPage(
|
||||||
array(
|
array(
|
||||||
$crumbs,
|
$crumbs,
|
||||||
$box,
|
|
||||||
$timeline,
|
|
||||||
$rendered_dashboard,
|
$rendered_dashboard,
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
@ -54,117 +42,17 @@ final class PhabricatorDashboardViewController
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildHeaderView(PhabricatorDashboard $dashboard) {
|
public function buildApplicationCrumbs() {
|
||||||
$viewer = $this->getRequest()->getUser();
|
$crumbs = parent::buildApplicationCrumbs();
|
||||||
|
$id = $this->id;
|
||||||
|
|
||||||
return id(new PHUIHeaderView())
|
$crumbs->addAction(
|
||||||
->setUser($viewer)
|
id(new PHUIListItemView())
|
||||||
->setHeader($dashboard->getName())
|
->setIcon('fa-th')
|
||||||
->setPolicyObject($dashboard);
|
->setName(pht('Manage Dashboard'))
|
||||||
}
|
->setHref($this->getApplicationURI()."manage/{$id}/"));
|
||||||
|
|
||||||
private function buildActionView(PhabricatorDashboard $dashboard) {
|
return $crumbs;
|
||||||
$viewer = $this->getRequest()->getUser();
|
|
||||||
$id = $dashboard->getID();
|
|
||||||
|
|
||||||
$actions = id(new PhabricatorActionListView())
|
|
||||||
->setObjectURI($this->getApplicationURI('view/'.$dashboard->getID().'/'))
|
|
||||||
->setUser($viewer);
|
|
||||||
|
|
||||||
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
|
||||||
$viewer,
|
|
||||||
$dashboard,
|
|
||||||
PhabricatorPolicyCapability::CAN_EDIT);
|
|
||||||
|
|
||||||
$actions->addAction(
|
|
||||||
id(new PhabricatorActionView())
|
|
||||||
->setName(pht('Edit Dashboard'))
|
|
||||||
->setIcon('fa-pencil')
|
|
||||||
->setHref($this->getApplicationURI("edit/{$id}/"))
|
|
||||||
->setDisabled(!$can_edit)
|
|
||||||
->setWorkflow(!$can_edit));
|
|
||||||
|
|
||||||
$actions->addAction(
|
|
||||||
id(new PhabricatorActionView())
|
|
||||||
->setName(pht('Arrange Dashboard'))
|
|
||||||
->setIcon('fa-arrows')
|
|
||||||
->setHref($this->getApplicationURI("arrange/{$id}/"))
|
|
||||||
->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'))
|
|
||||||
->setIcon('fa-plus')
|
|
||||||
->setHref($this->getApplicationURI("addpanel/{$id}/"))
|
|
||||||
->setDisabled(!$can_edit)
|
|
||||||
->setWorkflow(true));
|
|
||||||
|
|
||||||
return $actions;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function buildPropertyView(PhabricatorDashboard $dashboard) {
|
|
||||||
$viewer = $this->getRequest()->getUser();
|
|
||||||
|
|
||||||
$properties = id(new PHUIPropertyListView())
|
|
||||||
->setUser($viewer)
|
|
||||||
->setObject($dashboard);
|
|
||||||
|
|
||||||
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
|
|
||||||
$viewer,
|
|
||||||
$dashboard);
|
|
||||||
|
|
||||||
$properties->addProperty(
|
|
||||||
pht('Editable By'),
|
|
||||||
$descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
|
|
||||||
|
|
||||||
$panel_phids = $dashboard->getPanelPHIDs();
|
|
||||||
$this->loadHandles($panel_phids);
|
|
||||||
|
|
||||||
$properties->addProperty(
|
|
||||||
pht('Panels'),
|
|
||||||
$this->renderHandlesForPHIDs($panel_phids));
|
|
||||||
|
|
||||||
return $properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function buildTransactions(PhabricatorDashboard $dashboard) {
|
|
||||||
$viewer = $this->getRequest()->getUser();
|
|
||||||
|
|
||||||
$xactions = id(new PhabricatorDashboardTransactionQuery())
|
|
||||||
->setViewer($viewer)
|
|
||||||
->withObjectPHIDs(array($dashboard->getPHID()))
|
|
||||||
->execute();
|
|
||||||
|
|
||||||
$engine = id(new PhabricatorMarkupEngine())
|
|
||||||
->setViewer($viewer);
|
|
||||||
|
|
||||||
$timeline = id(new PhabricatorApplicationTransactionView())
|
|
||||||
->setUser($viewer)
|
|
||||||
->setObjectPHID($dashboard->getPHID())
|
|
||||||
->setTransactions($xactions);
|
|
||||||
|
|
||||||
return $timeline;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue