forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDrydockRepositoryOperationStatusController.php
59 lines (47 loc) · 1.32 KB
/
DrydockRepositoryOperationStatusController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
final class DrydockRepositoryOperationStatusController
extends DrydockController {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$operation = id(new DrydockRepositoryOperationQuery())
->setViewer($viewer)
->withIDs(array($id))
->executeOne();
if (!$operation) {
return new Aphront404Response();
}
$id = $operation->getID();
$status_view = id(new DrydockRepositoryOperationStatusView())
->setUser($viewer)
->setOperation($operation);
if ($request->isAjax()) {
$payload = array(
'markup' => $status_view->renderUnderwayState(),
'isUnderway' => $operation->isUnderway(),
);
return id(new AphrontAjaxResponse())
->setContent($payload);
}
$title = pht('Repository Operation %d', $id);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(
pht('Operations'),
$this->getApplicationURI('operation/'));
$crumbs->addTextCrumb($title);
return $this->buildApplicationPage(
array(
$crumbs,
$status_view,
),
array(
'title' => array(
$title,
pht('Status'),
),
));
}
}