Remove product literal strings in "pht()", part 6
[phabricator.git] / src / applications / drydock / controller / DrydockRepositoryOperationViewController.php
blobe255c63ec3335a4217d1b5ee2a04430735fc7b7d
1 <?php
3 final class DrydockRepositoryOperationViewController
4 extends DrydockRepositoryOperationController {
6 public function shouldAllowPublic() {
7 return true;
10 public function handleRequest(AphrontRequest $request) {
11 $viewer = $request->getViewer();
12 $id = $request->getURIData('id');
14 $operation = id(new DrydockRepositoryOperationQuery())
15 ->setViewer($viewer)
16 ->withIDs(array($id))
17 ->executeOne();
18 if (!$operation) {
19 return new Aphront404Response();
22 $id = $operation->getID();
23 $title = pht('Repository Operation %d', $id);
25 $header = id(new PHUIHeaderView())
26 ->setHeader($title)
27 ->setUser($viewer)
28 ->setPolicyObject($operation)
29 ->setHeaderIcon('fa-fighter-jet');
31 $state = $operation->getOperationState();
32 $icon = DrydockRepositoryOperation::getOperationStateIcon($state);
33 $name = DrydockRepositoryOperation::getOperationStateName($state);
34 $header->setStatus($icon, null, $name);
36 $curtain = $this->buildCurtain($operation);
37 $properties = $this->buildPropertyListView($operation);
39 $crumbs = $this->buildApplicationCrumbs();
40 $crumbs->addTextCrumb(
41 pht('Operations'),
42 $this->getApplicationURI('operation/'));
43 $crumbs->addTextCrumb($title);
44 $crumbs->setBorder(true);
46 $status_view = id(new DrydockRepositoryOperationStatusView())
47 ->setUser($viewer)
48 ->setOperation($operation);
50 $log_query = id(new DrydockLogQuery())
51 ->withOperationPHIDs(array($operation->getPHID()));
53 $log_table = $this->buildLogTable($log_query)
54 ->setHideOperations(true);
56 $logs = $this->buildLogBox(
57 $log_table,
58 $this->getApplicationURI("operation/{$id}/logs/query/all/"));
60 $view = id(new PHUITwoColumnView())
61 ->setHeader($header)
62 ->setCurtain($curtain)
63 ->addPropertySection(pht('Properties'), $properties)
64 ->setMainColumn(
65 array(
66 $status_view,
67 $logs,
68 ));
70 return $this->newPage()
71 ->setTitle($title)
72 ->setCrumbs($crumbs)
73 ->appendChild(
74 array(
75 $view,
76 ));
79 private function buildCurtain(DrydockRepositoryOperation $operation) {
80 $viewer = $this->getViewer();
81 $id = $operation->getID();
83 $curtain = $this->newCurtainView($operation);
85 return $curtain;
88 private function buildPropertyListView(
89 DrydockRepositoryOperation $operation) {
91 $viewer = $this->getViewer();
93 $view = new PHUIPropertyListView();
94 $view->addProperty(
95 pht('Repository'),
96 $viewer->renderHandle($operation->getRepositoryPHID()));
98 $view->addProperty(
99 pht('Object'),
100 $viewer->renderHandle($operation->getObjectPHID()));
102 $lease_phid = $operation->getWorkingCopyLeasePHID();
103 if ($lease_phid) {
104 $lease_display = $viewer->renderHandle($lease_phid);
105 } else {
106 $lease_display = phutil_tag('em', array(), pht('None'));
109 $view->addProperty(pht('Working Copy'), $lease_display);
111 return $view;