Page MenuHomePhabricator

D9258.id21986.diff
No OneTemporary

D9258.id21986.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1463,7 +1463,6 @@
'PhabricatorDaemonTaskGarbageCollector' => 'applications/daemon/garbagecollector/PhabricatorDaemonTaskGarbageCollector.php',
'PhabricatorDashboard' => 'applications/dashboard/storage/PhabricatorDashboard.php',
'PhabricatorDashboardAddPanelController' => 'applications/dashboard/controller/PhabricatorDashboardAddPanelController.php',
- 'PhabricatorDashboardArrangeController' => 'applications/dashboard/controller/PhabricatorDashboardArrangeController.php',
'PhabricatorDashboardController' => 'applications/dashboard/controller/PhabricatorDashboardController.php',
'PhabricatorDashboardDAO' => 'applications/dashboard/storage/PhabricatorDashboardDAO.php',
'PhabricatorDashboardEditController' => 'applications/dashboard/controller/PhabricatorDashboardEditController.php',
@@ -1471,6 +1470,7 @@
'PhabricatorDashboardInstallController' => 'applications/dashboard/controller/PhabricatorDashboardInstallController.php',
'PhabricatorDashboardLayoutConfig' => 'applications/dashboard/layoutconfig/PhabricatorDashboardLayoutConfig.php',
'PhabricatorDashboardListController' => 'applications/dashboard/controller/PhabricatorDashboardListController.php',
+ 'PhabricatorDashboardManageController' => 'applications/dashboard/controller/PhabricatorDashboardManageController.php',
'PhabricatorDashboardMovePanelController' => 'applications/dashboard/controller/PhabricatorDashboardMovePanelController.php',
'PhabricatorDashboardPHIDTypeDashboard' => 'applications/dashboard/phid/PhabricatorDashboardPHIDTypeDashboard.php',
'PhabricatorDashboardPHIDTypePanel' => 'applications/dashboard/phid/PhabricatorDashboardPHIDTypePanel.php',
@@ -4258,13 +4258,13 @@
1 => 'PhabricatorPolicyInterface',
),
'PhabricatorDashboardAddPanelController' => 'PhabricatorDashboardController',
- 'PhabricatorDashboardArrangeController' => 'PhabricatorDashboardController',
'PhabricatorDashboardController' => 'PhabricatorController',
'PhabricatorDashboardDAO' => 'PhabricatorLiskDAO',
'PhabricatorDashboardEditController' => 'PhabricatorDashboardController',
'PhabricatorDashboardInstall' => 'PhabricatorDashboardDAO',
'PhabricatorDashboardInstallController' => 'PhabricatorDashboardController',
'PhabricatorDashboardListController' => 'PhabricatorDashboardController',
+ 'PhabricatorDashboardManageController' => 'PhabricatorDashboardController',
'PhabricatorDashboardMovePanelController' => 'PhabricatorDashboardController',
'PhabricatorDashboardPHIDTypeDashboard' => 'PhabricatorPHIDType',
'PhabricatorDashboardPHIDTypePanel' => 'PhabricatorPHIDType',
diff --git a/src/applications/dashboard/application/PhabricatorApplicationDashboard.php b/src/applications/dashboard/application/PhabricatorApplicationDashboard.php
--- a/src/applications/dashboard/application/PhabricatorApplicationDashboard.php
+++ b/src/applications/dashboard/application/PhabricatorApplicationDashboard.php
@@ -21,7 +21,7 @@
'(?:query/(?P<queryKey>[^/]+)/)?'
=> 'PhabricatorDashboardListController',
'view/(?P<id>\d+)/' => 'PhabricatorDashboardViewController',
- 'arrange/(?P<id>\d+)/' => 'PhabricatorDashboardArrangeController',
+ 'manage/(?P<id>\d+)/' => 'PhabricatorDashboardManageController',
'create/' => 'PhabricatorDashboardEditController',
'edit/(?:(?P<id>\d+)/)?' => 'PhabricatorDashboardEditController',
'install/(?P<id>\d+)/' => 'PhabricatorDashboardInstallController',
diff --git a/src/applications/dashboard/controller/PhabricatorDashboardAddPanelController.php b/src/applications/dashboard/controller/PhabricatorDashboardAddPanelController.php
--- a/src/applications/dashboard/controller/PhabricatorDashboardAddPanelController.php
+++ b/src/applications/dashboard/controller/PhabricatorDashboardAddPanelController.php
@@ -26,13 +26,8 @@
return new Aphront404Response();
}
- if ($request->getStr('src', 'edit') == 'edit') {
- $redirect_uri = $this->getApplicationURI(
- 'view/'.$dashboard->getID().'/');
- } else {
- $redirect_uri = $this->getApplicationURI(
- 'arrange/'.$dashboard->getID().'/');
- }
+ $redirect_uri = $this->getApplicationURI(
+ 'manage/'.$dashboard->getID().'/');
$layout_config = $dashboard->getLayoutConfigObject();
$v_panel = $request->getStr('panel');
diff --git a/src/applications/dashboard/controller/PhabricatorDashboardArrangeController.php b/src/applications/dashboard/controller/PhabricatorDashboardArrangeController.php
deleted file mode 100644
--- a/src/applications/dashboard/controller/PhabricatorDashboardArrangeController.php
+++ /dev/null
@@ -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,
- ));
- }
-
-}
diff --git a/src/applications/dashboard/controller/PhabricatorDashboardEditController.php b/src/applications/dashboard/controller/PhabricatorDashboardEditController.php
--- a/src/applications/dashboard/controller/PhabricatorDashboardEditController.php
+++ b/src/applications/dashboard/controller/PhabricatorDashboardEditController.php
@@ -46,7 +46,7 @@
$crumbs->addTextCrumb('Create Dashboard');
} else {
$id = $dashboard->getID();
- $cancel_uri = $this->getApplicationURI('view/'.$id.'/');
+ $cancel_uri = $this->getApplicationURI('manage/'.$id.'/');
$title = pht('Edit Dashboard %d', $dashboard->getID());
$header = pht('Edit Dashboard "%s"', $dashboard->getName());
@@ -94,11 +94,8 @@
->setContentSourceFromRequest($request)
->applyTransactions($dashboard, $xactions);
- if ($is_new) {
- $uri = $this->getApplicationURI('arrange/'.$dashboard->getID().'/');
- } else {
- $uri = $this->getApplicationURI('view/'.$dashboard->getID().'/');
- }
+ $uri = $this->getApplicationURI('manage/'.$dashboard->getID().'/');
+
return id(new AphrontRedirectResponse())->setURI($uri);
} catch (PhabricatorApplicationTransactionValidationException $ex) {
$validation_exception = $ex;
diff --git a/src/applications/dashboard/controller/PhabricatorDashboardViewController.php b/src/applications/dashboard/controller/PhabricatorDashboardManageController.php
copy from src/applications/dashboard/controller/PhabricatorDashboardViewController.php
copy to src/applications/dashboard/controller/PhabricatorDashboardManageController.php
--- a/src/applications/dashboard/controller/PhabricatorDashboardViewController.php
+++ b/src/applications/dashboard/controller/PhabricatorDashboardManageController.php
@@ -1,6 +1,6 @@
<?php
-final class PhabricatorDashboardViewController
+final class PhabricatorDashboardManageController
extends PhabricatorDashboardController {
private $id;
@@ -12,6 +12,8 @@
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
+ $id = $this->id;
+ $dashboard_uri = $this->getApplicationURI('view/'.$id.'/');
$dashboard = id(new PhabricatorDashboardQuery())
->setViewer($viewer)
@@ -23,8 +25,12 @@
}
$title = $dashboard->getName();
+
$crumbs = $this->buildApplicationCrumbs();
- $crumbs->addTextCrumb(pht('Dashboard %d', $dashboard->getID()));
+ $crumbs->addTextCrumb(
+ pht('Dashboard %d', $dashboard->getID()),
+ $dashboard_uri);
+ $crumbs->addTextCrumb(pht('Manage'));
$header = $this->buildHeaderView($dashboard);
$actions = $this->buildActionView($dashboard);
@@ -39,6 +45,7 @@
$rendered_dashboard = id(new PhabricatorDashboardRenderingEngine())
->setViewer($viewer)
->setDashboard($dashboard)
+ ->setArrangeMode(true)
->renderDashboard();
return $this->buildApplicationPage(
@@ -84,14 +91,6 @@
->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',
@@ -112,14 +111,6 @@
->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;
}
diff --git a/src/applications/dashboard/controller/PhabricatorDashboardPanelEditController.php b/src/applications/dashboard/controller/PhabricatorDashboardPanelEditController.php
--- a/src/applications/dashboard/controller/PhabricatorDashboardPanelEditController.php
+++ b/src/applications/dashboard/controller/PhabricatorDashboardPanelEditController.php
@@ -182,7 +182,7 @@
$request = $this->getRequest();
$dashboard_id = $request->getInt('dashboardID');
if ($dashboard_id) {
- $uri = $this->getApplicationURI('arrange/'.$dashboard_id.'/');
+ $uri = $this->getApplicationURI('manage/'.$dashboard_id.'/');
} else {
$uri = '/'.$panel->getMonogram();
}
diff --git a/src/applications/dashboard/controller/PhabricatorDashboardRemovePanelController.php b/src/applications/dashboard/controller/PhabricatorDashboardRemovePanelController.php
--- a/src/applications/dashboard/controller/PhabricatorDashboardRemovePanelController.php
+++ b/src/applications/dashboard/controller/PhabricatorDashboardRemovePanelController.php
@@ -36,7 +36,7 @@
}
$redirect_uri = $this->getApplicationURI(
- 'arrange/'.$dashboard->getID().'/');
+ 'manage/'.$dashboard->getID().'/');
$layout_config = $dashboard->getLayoutConfigObject();
if ($request->isFormPost()) {
diff --git a/src/applications/dashboard/controller/PhabricatorDashboardViewController.php b/src/applications/dashboard/controller/PhabricatorDashboardViewController.php
--- a/src/applications/dashboard/controller/PhabricatorDashboardViewController.php
+++ b/src/applications/dashboard/controller/PhabricatorDashboardViewController.php
@@ -26,16 +26,6 @@
$crumbs = $this->buildApplicationCrumbs();
$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())
->setViewer($viewer)
->setDashboard($dashboard)
@@ -44,8 +34,6 @@
return $this->buildApplicationPage(
array(
$crumbs,
- $box,
- $timeline,
$rendered_dashboard,
),
array(
@@ -54,117 +42,17 @@
));
}
- 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));
-
- $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);
+ public function buildApplicationCrumbs() {
+ $crumbs = parent::buildApplicationCrumbs();
+ $id = $this->id;
- $timeline = id(new PhabricatorApplicationTransactionView())
- ->setUser($viewer)
- ->setObjectPHID($dashboard->getPHID())
- ->setTransactions($xactions);
+ $crumbs->addAction(
+ id(new PHUIListItemView())
+ ->setIcon('fa-th')
+ ->setName(pht('Manage Dashboard'))
+ ->setHref($this->getApplicationURI()."manage/{$id}/"));
- return $timeline;
+ return $crumbs;
}
}

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 19, 4:08 AM (4 h, 39 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6715353
Default Alt Text
D9258.id21986.diff (16 KB)

Event Timeline