1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-20 12:30:56 +01:00

Update Drydock for handleRequest

Summary: Poked through the Drydock controllers and updated the codes.

Test Plan: Built random fake stuff in Drydock

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D13731
This commit is contained in:
Chad Little 2015-07-27 07:56:52 -07:00
parent d6d3755888
commit c026152833
12 changed files with 48 additions and 99 deletions

View file

@ -3,9 +3,8 @@
final class DrydockBlueprintCreateController
extends DrydockBlueprintController {
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$this->requireApplicationCapability(
DrydockCreateBlueprintsCapability::CAPABILITY);

View file

@ -2,20 +2,14 @@
final class DrydockBlueprintEditController extends DrydockBlueprintController {
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) {
$blueprint = id(new DrydockBlueprintQuery())
->setViewer($viewer)
->withIDs(array($this->id))
->withIDs(array($id))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
@ -27,7 +21,7 @@ final class DrydockBlueprintEditController extends DrydockBlueprintController {
}
$impl = $blueprint->getImplementation();
$cancel_uri = $this->getApplicationURI('blueprint/'.$this->id.'/');
$cancel_uri = $this->getApplicationURI('blueprint/'.$id.'/');
} else {
$this->requireApplicationCapability(
DrydockCreateBlueprintsCapability::CAPABILITY);

View file

@ -2,20 +2,16 @@
final class DrydockBlueprintListController extends DrydockBlueprintController {
private $queryKey;
public function shouldAllowPublic() {
return true;
}
public function willProcessRequest(array $data) {
$this->queryKey = idx($data, 'queryKey');
}
public function handleRequest(AphrontRequest $request) {
$querykey = $request->getURIData('queryKey');
public function processRequest() {
$request = $this->getRequest();
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey)
->setQueryKey($querykey)
->setSearchEngine(new DrydockBlueprintSearchEngine())
->setNavigation($this->buildSideNavView());

View file

@ -2,19 +2,13 @@
final class DrydockBlueprintViewController extends DrydockBlueprintController {
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');
$blueprint = id(new DrydockBlueprintQuery())
->setViewer($viewer)
->withIDs(array($this->id))
->withIDs(array($id))
->executeOne();
if (!$blueprint) {
return new Aphront404Response();

View file

@ -22,9 +22,8 @@ final class DrydockConsoleController extends DrydockController {
return $nav;
}
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$menu = id(new PHUIObjectItemListView())
->setUser($viewer);

View file

@ -2,19 +2,16 @@
final class DrydockLeaseListController extends DrydockLeaseController {
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();
$querykey = $request->getURIData('queryKey');
public function processRequest() {
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey)
->setQueryKey($querykey)
->setSearchEngine(new DrydockLeaseSearchEngine())
->setNavigation($this->buildSideNavView());

View file

@ -2,19 +2,13 @@
final class DrydockLeaseReleaseController extends DrydockLeaseController {
private $id;
public function willProcessRequest(array $data) {
$this->id = $data['id'];
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$lease = id(new DrydockLeaseQuery())
->setViewer($user)
->withIDs(array($this->id))
->setViewer($viewer)
->withIDs(array($id))
->executeOne();
if (!$lease) {
return new Aphront404Response();
@ -25,7 +19,7 @@ final class DrydockLeaseReleaseController extends DrydockLeaseController {
if ($lease->getStatus() != DrydockLeaseStatus::STATUS_ACTIVE) {
$dialog = id(new AphrontDialogView())
->setUser($user)
->setUser($viewer)
->setTitle(pht('Lease Not Active'))
->appendChild(
phutil_tag(
@ -39,7 +33,7 @@ final class DrydockLeaseReleaseController extends DrydockLeaseController {
if (!$request->isDialogFormPost()) {
$dialog = id(new AphrontDialogView())
->setUser($user)
->setUser($viewer)
->setTitle(pht('Really release lease?'))
->appendChild(
phutil_tag(

View file

@ -2,19 +2,13 @@
final class DrydockLeaseViewController extends DrydockLeaseController {
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');
$lease = id(new DrydockLeaseQuery())
->setViewer($viewer)
->withIDs(array($this->id))
->withIDs(array($id))
->executeOne();
if (!$lease) {
return new Aphront404Response();

View file

@ -2,19 +2,16 @@
final class DrydockLogListController extends DrydockLogController {
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();
$querykey = $request->getURIData('queryKey');
public function processRequest() {
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey)
->setQueryKey($querykey)
->setSearchEngine(new DrydockLogSearchEngine())
->setNavigation($this->buildSideNavView());

View file

@ -2,19 +2,13 @@
final class DrydockResourceCloseController extends DrydockResourceController {
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');
$resource = id(new DrydockResourceQuery())
->setViewer($viewer)
->withIDs(array($this->id))
->withIDs(array($id))
->executeOne();
if (!$resource) {
return new Aphront404Response();

View file

@ -2,19 +2,16 @@
final class DrydockResourceListController extends DrydockResourceController {
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();
$querykey = $request->getURIData('queryKey');
public function processRequest() {
$controller = id(new PhabricatorApplicationSearchController())
->setQueryKey($this->queryKey)
->setQueryKey($querykey)
->setSearchEngine(new DrydockResourceSearchEngine())
->setNavigation($this->buildSideNavView());

View file

@ -2,19 +2,13 @@
final class DrydockResourceViewController extends DrydockResourceController {
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');
$resource = id(new DrydockResourceQuery())
->setViewer($viewer)
->withIDs(array($this->id))
->withIDs(array($id))
->executeOne();
if (!$resource) {
return new Aphront404Response();