Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / herald / view / HeraldWebhookRequestListView.php
blob082d320bbaa3aef2bab83eff80a85e1b944b2ff9
1 <?php
3 final class HeraldWebhookRequestListView
4 extends AphrontView {
6 private $requests;
7 private $highlightID;
9 public function setRequests(array $requests) {
10 assert_instances_of($requests, 'HeraldWebhookRequest');
11 $this->requests = $requests;
12 return $this;
15 public function setHighlightID($highlight_id) {
16 $this->highlightID = $highlight_id;
17 return $this;
20 public function getHighlightID() {
21 return $this->highlightID;
24 public function render() {
25 $viewer = $this->getViewer();
26 $requests = $this->requests;
28 $handle_phids = array();
29 foreach ($requests as $request) {
30 $handle_phids[] = $request->getObjectPHID();
32 $handles = $viewer->loadHandles($handle_phids);
34 $highlight_id = $this->getHighlightID();
36 $rows = array();
37 $rowc = array();
38 foreach ($requests as $request) {
39 $icon = $request->newStatusIcon();
41 if ($highlight_id == $request->getID()) {
42 $rowc[] = 'highlighted';
43 } else {
44 $rowc[] = null;
47 $last_epoch = $request->getLastRequestEpoch();
48 if ($request->getLastRequestEpoch()) {
49 $last_request = phabricator_datetime($last_epoch, $viewer);
50 } else {
51 $last_request = null;
54 $rows[] = array(
55 $request->getID(),
56 $icon,
57 $handles[$request->getObjectPHID()]->renderLink(),
58 $request->getErrorTypeForDisplay(),
59 $request->getErrorCodeForDisplay(),
60 $last_request,
64 $table = id(new AphrontTableView($rows))
65 ->setRowClasses($rowc)
66 ->setHeaders(
67 array(
68 pht('ID'),
69 null,
70 pht('Object'),
71 pht('Type'),
72 pht('Code'),
73 pht('Requested At'),
75 ->setColumnClasses(
76 array(
77 'n',
78 '',
79 'wide',
80 '',
81 '',
82 '',
83 ));
85 return $table;