Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / drydock / controller / DrydockLogListController.php
blob26719db39e7662da7390783bff14ac7e13daa0f8
1 <?php
3 final class DrydockLogListController extends DrydockLogController {
5 public function shouldAllowPublic() {
6 return true;
9 public function handleRequest(AphrontRequest $request) {
10 $viewer = $request->getViewer();
11 $engine = new DrydockLogSearchEngine();
13 $id = $request->getURIData('id');
14 $type = $request->getURIData('type');
15 switch ($type) {
16 case 'blueprint':
17 $blueprint = id(new DrydockBlueprintQuery())
18 ->setViewer($viewer)
19 ->withIDs(array($id))
20 ->executeOne();
21 if (!$blueprint) {
22 return new Aphront404Response();
24 $engine->setBlueprint($blueprint);
25 $this->setBlueprint($blueprint);
26 break;
27 case 'resource':
28 $resource = id(new DrydockResourceQuery())
29 ->setViewer($viewer)
30 ->withIDs(array($id))
31 ->executeOne();
32 if (!$resource) {
33 return new Aphront404Response();
35 $engine->setResource($resource);
36 $this->setResource($resource);
37 break;
38 case 'lease':
39 $lease = id(new DrydockLeaseQuery())
40 ->setViewer($viewer)
41 ->withIDs(array($id))
42 ->executeOne();
43 if (!$lease) {
44 return new Aphront404Response();
46 $engine->setLease($lease);
47 $this->setLease($lease);
48 break;
49 case 'operation':
50 $operation = id(new DrydockRepositoryOperationQuery())
51 ->setViewer($viewer)
52 ->withIDs(array($id))
53 ->executeOne();
54 if (!$operation) {
55 return new Aphront404Response();
57 $engine->setOperation($operation);
58 $this->setOperation($operation);
59 break;
60 default:
61 return new Aphront404Response();
64 $query_key = $request->getURIData('queryKey');
66 $controller = id(new PhabricatorApplicationSearchController())
67 ->setQueryKey($query_key)
68 ->setSearchEngine($engine)
69 ->setNavigation($this->buildSideNavView());
71 return $this->delegateToController($controller);