mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 20:40: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:
parent
d6d3755888
commit
c026152833
12 changed files with 48 additions and 99 deletions
|
@ -3,9 +3,8 @@
|
||||||
final class DrydockBlueprintCreateController
|
final class DrydockBlueprintCreateController
|
||||||
extends DrydockBlueprintController {
|
extends DrydockBlueprintController {
|
||||||
|
|
||||||
public function processRequest() {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
$viewer = $request->getViewer();
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$this->requireApplicationCapability(
|
$this->requireApplicationCapability(
|
||||||
DrydockCreateBlueprintsCapability::CAPABILITY);
|
DrydockCreateBlueprintsCapability::CAPABILITY);
|
||||||
|
|
|
@ -2,20 +2,14 @@
|
||||||
|
|
||||||
final class DrydockBlueprintEditController extends DrydockBlueprintController {
|
final class DrydockBlueprintEditController extends DrydockBlueprintController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
|
$id = $request->getURIData('id');
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
if ($id) {
|
||||||
$this->id = idx($data, 'id');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
if ($this->id) {
|
|
||||||
$blueprint = id(new DrydockBlueprintQuery())
|
$blueprint = id(new DrydockBlueprintQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->requireCapabilities(
|
->requireCapabilities(
|
||||||
array(
|
array(
|
||||||
PhabricatorPolicyCapability::CAN_VIEW,
|
PhabricatorPolicyCapability::CAN_VIEW,
|
||||||
|
@ -27,7 +21,7 @@ final class DrydockBlueprintEditController extends DrydockBlueprintController {
|
||||||
}
|
}
|
||||||
|
|
||||||
$impl = $blueprint->getImplementation();
|
$impl = $blueprint->getImplementation();
|
||||||
$cancel_uri = $this->getApplicationURI('blueprint/'.$this->id.'/');
|
$cancel_uri = $this->getApplicationURI('blueprint/'.$id.'/');
|
||||||
} else {
|
} else {
|
||||||
$this->requireApplicationCapability(
|
$this->requireApplicationCapability(
|
||||||
DrydockCreateBlueprintsCapability::CAPABILITY);
|
DrydockCreateBlueprintsCapability::CAPABILITY);
|
||||||
|
|
|
@ -2,20 +2,16 @@
|
||||||
|
|
||||||
final class DrydockBlueprintListController extends DrydockBlueprintController {
|
final class DrydockBlueprintListController extends DrydockBlueprintController {
|
||||||
|
|
||||||
private $queryKey;
|
|
||||||
|
|
||||||
public function shouldAllowPublic() {
|
public function shouldAllowPublic() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$this->queryKey = idx($data, 'queryKey');
|
$querykey = $request->getURIData('queryKey');
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$controller = id(new PhabricatorApplicationSearchController())
|
$controller = id(new PhabricatorApplicationSearchController())
|
||||||
->setQueryKey($this->queryKey)
|
->setQueryKey($querykey)
|
||||||
->setSearchEngine(new DrydockBlueprintSearchEngine())
|
->setSearchEngine(new DrydockBlueprintSearchEngine())
|
||||||
->setNavigation($this->buildSideNavView());
|
->setNavigation($this->buildSideNavView());
|
||||||
|
|
||||||
|
|
|
@ -2,19 +2,13 @@
|
||||||
|
|
||||||
final class DrydockBlueprintViewController extends DrydockBlueprintController {
|
final class DrydockBlueprintViewController extends DrydockBlueprintController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
public function willProcessRequest(array $data) {
|
$id = $request->getURIData('id');
|
||||||
$this->id = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$blueprint = id(new DrydockBlueprintQuery())
|
$blueprint = id(new DrydockBlueprintQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
if (!$blueprint) {
|
if (!$blueprint) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
|
|
|
@ -22,9 +22,8 @@ final class DrydockConsoleController extends DrydockController {
|
||||||
return $nav;
|
return $nav;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function processRequest() {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$request = $this->getRequest();
|
$viewer = $request->getViewer();
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$menu = id(new PHUIObjectItemListView())
|
$menu = id(new PHUIObjectItemListView())
|
||||||
->setUser($viewer);
|
->setUser($viewer);
|
||||||
|
|
|
@ -2,19 +2,16 @@
|
||||||
|
|
||||||
final class DrydockLeaseListController extends DrydockLeaseController {
|
final class DrydockLeaseListController extends DrydockLeaseController {
|
||||||
|
|
||||||
private $queryKey;
|
|
||||||
|
|
||||||
public function shouldAllowPublic() {
|
public function shouldAllowPublic() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$this->queryKey = idx($data, 'queryKey');
|
$viewer = $request->getViewer();
|
||||||
}
|
$querykey = $request->getURIData('queryKey');
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$controller = id(new PhabricatorApplicationSearchController())
|
$controller = id(new PhabricatorApplicationSearchController())
|
||||||
->setQueryKey($this->queryKey)
|
->setQueryKey($querykey)
|
||||||
->setSearchEngine(new DrydockLeaseSearchEngine())
|
->setSearchEngine(new DrydockLeaseSearchEngine())
|
||||||
->setNavigation($this->buildSideNavView());
|
->setNavigation($this->buildSideNavView());
|
||||||
|
|
||||||
|
|
|
@ -2,19 +2,13 @@
|
||||||
|
|
||||||
final class DrydockLeaseReleaseController extends DrydockLeaseController {
|
final class DrydockLeaseReleaseController extends DrydockLeaseController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
public function willProcessRequest(array $data) {
|
$id = $request->getURIData('id');
|
||||||
$this->id = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$user = $request->getUser();
|
|
||||||
|
|
||||||
$lease = id(new DrydockLeaseQuery())
|
$lease = id(new DrydockLeaseQuery())
|
||||||
->setViewer($user)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
if (!$lease) {
|
if (!$lease) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
|
@ -25,7 +19,7 @@ final class DrydockLeaseReleaseController extends DrydockLeaseController {
|
||||||
|
|
||||||
if ($lease->getStatus() != DrydockLeaseStatus::STATUS_ACTIVE) {
|
if ($lease->getStatus() != DrydockLeaseStatus::STATUS_ACTIVE) {
|
||||||
$dialog = id(new AphrontDialogView())
|
$dialog = id(new AphrontDialogView())
|
||||||
->setUser($user)
|
->setUser($viewer)
|
||||||
->setTitle(pht('Lease Not Active'))
|
->setTitle(pht('Lease Not Active'))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
phutil_tag(
|
phutil_tag(
|
||||||
|
@ -39,7 +33,7 @@ final class DrydockLeaseReleaseController extends DrydockLeaseController {
|
||||||
|
|
||||||
if (!$request->isDialogFormPost()) {
|
if (!$request->isDialogFormPost()) {
|
||||||
$dialog = id(new AphrontDialogView())
|
$dialog = id(new AphrontDialogView())
|
||||||
->setUser($user)
|
->setUser($viewer)
|
||||||
->setTitle(pht('Really release lease?'))
|
->setTitle(pht('Really release lease?'))
|
||||||
->appendChild(
|
->appendChild(
|
||||||
phutil_tag(
|
phutil_tag(
|
||||||
|
|
|
@ -2,19 +2,13 @@
|
||||||
|
|
||||||
final class DrydockLeaseViewController extends DrydockLeaseController {
|
final class DrydockLeaseViewController extends DrydockLeaseController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
public function willProcessRequest(array $data) {
|
$id = $request->getURIData('id');
|
||||||
$this->id = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$lease = id(new DrydockLeaseQuery())
|
$lease = id(new DrydockLeaseQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
if (!$lease) {
|
if (!$lease) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
|
|
|
@ -2,19 +2,16 @@
|
||||||
|
|
||||||
final class DrydockLogListController extends DrydockLogController {
|
final class DrydockLogListController extends DrydockLogController {
|
||||||
|
|
||||||
private $queryKey;
|
|
||||||
|
|
||||||
public function shouldAllowPublic() {
|
public function shouldAllowPublic() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$this->queryKey = idx($data, 'queryKey');
|
$viewer = $request->getViewer();
|
||||||
}
|
$querykey = $request->getURIData('queryKey');
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$controller = id(new PhabricatorApplicationSearchController())
|
$controller = id(new PhabricatorApplicationSearchController())
|
||||||
->setQueryKey($this->queryKey)
|
->setQueryKey($querykey)
|
||||||
->setSearchEngine(new DrydockLogSearchEngine())
|
->setSearchEngine(new DrydockLogSearchEngine())
|
||||||
->setNavigation($this->buildSideNavView());
|
->setNavigation($this->buildSideNavView());
|
||||||
|
|
||||||
|
|
|
@ -2,19 +2,13 @@
|
||||||
|
|
||||||
final class DrydockResourceCloseController extends DrydockResourceController {
|
final class DrydockResourceCloseController extends DrydockResourceController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
public function willProcessRequest(array $data) {
|
$id = $request->getURIData('id');
|
||||||
$this->id = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$resource = id(new DrydockResourceQuery())
|
$resource = id(new DrydockResourceQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
if (!$resource) {
|
if (!$resource) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
|
|
|
@ -2,19 +2,16 @@
|
||||||
|
|
||||||
final class DrydockResourceListController extends DrydockResourceController {
|
final class DrydockResourceListController extends DrydockResourceController {
|
||||||
|
|
||||||
private $queryKey;
|
|
||||||
|
|
||||||
public function shouldAllowPublic() {
|
public function shouldAllowPublic() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function willProcessRequest(array $data) {
|
public function handleRequest(AphrontRequest $request) {
|
||||||
$this->queryKey = idx($data, 'queryKey');
|
$viewer = $request->getViewer();
|
||||||
}
|
$querykey = $request->getURIData('queryKey');
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$controller = id(new PhabricatorApplicationSearchController())
|
$controller = id(new PhabricatorApplicationSearchController())
|
||||||
->setQueryKey($this->queryKey)
|
->setQueryKey($querykey)
|
||||||
->setSearchEngine(new DrydockResourceSearchEngine())
|
->setSearchEngine(new DrydockResourceSearchEngine())
|
||||||
->setNavigation($this->buildSideNavView());
|
->setNavigation($this->buildSideNavView());
|
||||||
|
|
||||||
|
|
|
@ -2,19 +2,13 @@
|
||||||
|
|
||||||
final class DrydockResourceViewController extends DrydockResourceController {
|
final class DrydockResourceViewController extends DrydockResourceController {
|
||||||
|
|
||||||
private $id;
|
public function handleRequest(AphrontRequest $request) {
|
||||||
|
$viewer = $request->getViewer();
|
||||||
public function willProcessRequest(array $data) {
|
$id = $request->getURIData('id');
|
||||||
$this->id = $data['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function processRequest() {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$viewer = $request->getUser();
|
|
||||||
|
|
||||||
$resource = id(new DrydockResourceQuery())
|
$resource = id(new DrydockResourceQuery())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->withIDs(array($this->id))
|
->withIDs(array($id))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
if (!$resource) {
|
if (!$resource) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
|
|
Loading…
Reference in a new issue