1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-28 00:10:57 +01:00

Update Dashboard for handleRequest

Summary: Updates Dashboards

Test Plan: Bounced around lists, installed, history, create panel, create dashboard, etc.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T8628

Differential Revision: https://secure.phabricator.com/D13680
This commit is contained in:
Chad Little 2015-07-22 13:27:30 -07:00
parent b72b6eb18f
commit 0bbcd3888c
15 changed files with 62 additions and 141 deletions

View file

@ -3,19 +3,13 @@
final class PhabricatorDashboardAddPanelController
extends PhabricatorDashboardController {
private $id;
public function willProcessRequest(array $data) {
$this->id = idx($data, 'id');
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$dashboard = id(new PhabricatorDashboardQuery())
->setViewer($viewer)
->withIDs(array($this->id))
->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,

View file

@ -3,19 +3,13 @@
final class PhabricatorDashboardCopyController
extends PhabricatorDashboardController {
private $id;
public function willProcessRequest(array $data) {
$this->id = idx($data, 'id');
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$dashboard = id(new PhabricatorDashboardQuery())
->setViewer($viewer)
->withIDs(array($this->id))
->withIDs(array($id))
->needPanels(true)
->executeOne();
if (!$dashboard) {

View file

@ -3,20 +3,14 @@
final class PhabricatorDashboardEditController
extends PhabricatorDashboardController {
private $id;
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
public function willProcessRequest(array $data) {
$this->id = idx($data, 'id');
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
if ($this->id) {
if ($id) {
$dashboard = id(new PhabricatorDashboardQuery())
->setViewer($viewer)
->withIDs(array($this->id))
->withIDs(array($id))
->needPanels(true)
->requireCapabilities(
array(

View file

@ -3,22 +3,16 @@
final class PhabricatorDashboardHistoryController
extends PhabricatorDashboardController {
private $id;
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
public function willProcessRequest(array $data) {
$this->id = $data['id'];
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
$id = $this->id;
$dashboard_view_uri = $this->getApplicationURI('view/'.$id.'/');
$dashboard_manage_uri = $this->getApplicationURI('manage/'.$id.'/');
$dashboard = id(new PhabricatorDashboardQuery())
->setViewer($viewer)
->withIDs(array($this->id))
->withIDs(array($id))
->executeOne();
if (!$dashboard) {
return new Aphront404Response();

View file

@ -5,13 +5,9 @@ final class PhabricatorDashboardInstallController
private $id;
public function willProcessRequest(array $data) {
$this->id = idx($data, 'id');
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$this->id = $request->getURIData('id');
$dashboard = id(new PhabricatorDashboardQuery())
->setViewer($viewer)

View file

@ -3,19 +3,16 @@
final class PhabricatorDashboardListController
extends PhabricatorDashboardController {
private $queryKey;
public function shouldAllowPublic() {
return true;
}
public function willProcessRequest(array $data) {
$this->queryKey = idx($data, 'queryKey');
}
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$query_key = $request->getURIData('queryKey');
public function processRequest() {
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey)
->setQueryKey($query_key)
->setSearchEngine(new PhabricatorDashboardSearchEngine())
->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller);

View file

@ -3,15 +3,9 @@
final class PhabricatorDashboardMovePanelController
extends PhabricatorDashboardController {
private $id;
public function willProcessRequest(array $data) {
$this->id = $data['id'];
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$column_id = $request->getStr('columnID');
$panel_phid = $request->getStr('objectPHID');
@ -20,7 +14,7 @@ final class PhabricatorDashboardMovePanelController
$dashboard = id(new PhabricatorDashboardQuery())
->setViewer($viewer)
->withIDs(array($this->id))
->withIDs(array($id))
->needPanels(true)
->requireCapabilities(
array(

View file

@ -3,19 +3,13 @@
final class PhabricatorDashboardPanelArchiveController
extends PhabricatorDashboardController {
private $id;
public function willProcessRequest(array $data) {
$this->id = $data['id'];
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$panel = id(new PhabricatorDashboardPanelQuery())
->setViewer($viewer)
->withIDs(array($this->id))
->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,

View file

@ -3,15 +3,9 @@
final class PhabricatorDashboardPanelEditController
extends PhabricatorDashboardController {
private $id;
public function willProcessRequest(array $data) {
$this->id = idx($data, 'id');
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
// If the user is trying to create a panel directly on a dashboard, make
// sure they have permission to see and edit the dashboard.
@ -35,7 +29,7 @@ final class PhabricatorDashboardPanelEditController
$manage_uri = $this->getApplicationURI('manage/'.$dashboard_id.'/');
}
if ($this->id) {
if ($id) {
$is_create = false;
if ($dashboard) {
@ -51,7 +45,7 @@ final class PhabricatorDashboardPanelEditController
$panel = id(new PhabricatorDashboardPanelQuery())
->setViewer($viewer)
->withIDs(array($this->id))
->withIDs(array($id))
->requireCapabilities($capabilities)
->executeOne();
if (!$panel) {

View file

@ -9,13 +9,11 @@ final class PhabricatorDashboardPanelListController
return true;
}
public function willProcessRequest(array $data) {
$this->queryKey = idx($data, 'queryKey');
}
public function handleRequest(AphrontRequest $request) {
$query_key = $request->getURIData('queryKey');
public function processRequest() {
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey)
->setQueryKey($query_key)
->setSearchEngine(new PhabricatorDashboardPanelSearchEngine())
->setNavigation($this->buildSideNavView());
return $this->delegateToController($controller);

View file

@ -3,23 +3,17 @@
final class PhabricatorDashboardPanelRenderController
extends PhabricatorDashboardController {
private $id;
public function shouldAllowPublic() {
return true;
}
public function willProcessRequest(array $data) {
$this->id = $data['id'];
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$panel = id(new PhabricatorDashboardPanelQuery())
->setViewer($viewer)
->withIDs(array($this->id))
->withIDs(array($id))
->executeOne();
if (!$panel) {
return new Aphront404Response();

View file

@ -3,23 +3,17 @@
final class PhabricatorDashboardPanelViewController
extends PhabricatorDashboardController {
private $id;
public function shouldAllowPublic() {
return true;
}
public function willProcessRequest(array $data) {
$this->id = $data['id'];
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$panel = id(new PhabricatorDashboardPanelQuery())
->setViewer($viewer)
->withIDs(array($this->id))
->withIDs(array($id))
->executeOne();
if (!$panel) {
return new Aphront404Response();

View file

@ -3,19 +3,13 @@
final class PhabricatorDashboardRemovePanelController
extends PhabricatorDashboardController {
private $id;
public function willProcessRequest(array $data) {
$this->id = idx($data, 'id');
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$dashboard = id(new PhabricatorDashboardQuery())
->setViewer($viewer)
->withIDs(array($this->id))
->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,

View file

@ -3,19 +3,13 @@
final class PhabricatorDashboardUninstallController
extends PhabricatorDashboardController {
private $id;
public function willProcessRequest(array $data) {
$this->id = idx($data, 'id');
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$dashboard = id(new PhabricatorDashboardQuery())
->setViewer($viewer)
->withIDs(array($this->id))
->withIDs(array($id))
->executeOne();
if (!$dashboard) {
return new Aphront404Response();
@ -73,7 +67,7 @@ final class PhabricatorDashboardUninstallController
->setTitle(pht('Uninstall Dashboard'))
->appendChild($form->buildLayoutView())
->addCancelButton($this->getCancelURI(
$application_class, $object_phid))
$application_class, $object_phid, $id))
->addSubmitButton(pht('Uninstall Dashboard'));
}
@ -114,11 +108,11 @@ final class PhabricatorDashboardUninstallController
return $body;
}
private function getCancelURI($application_class, $object_phid) {
private function getCancelURI($application_class, $object_phid, $id) {
$uri = null;
switch ($application_class) {
case 'PhabricatorHomeApplication':
$uri = '/dashboard/view/'.$this->id.'/';
$uri = '/dashboard/view/'.$id.'/';
break;
}
return $uri;

View file

@ -9,13 +9,9 @@ final class PhabricatorDashboardViewController
return true;
}
public function willProcessRequest(array $data) {
$this->id = $data['id'];
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$this->id = $request->getURIData('id');
$dashboard = id(new PhabricatorDashboardQuery())
->setViewer($viewer)