Summary: Ref T11330. Adds general support for webhooks. This is still rough and missing a lot of pieces -- and not yet useful for anything -- but can make HTTP requests. Test Plan: Used `bin/webhook call ...` to complete requests to a test endpoint. Maniphest Tasks: T11330 Differential Revision: https://secure.phabricator.com/D19045
79 lines
1.6 KiB
PHP
79 lines
1.6 KiB
PHP
<?php
|
|
|
|
final class HeraldWebhookRequestListView
|
|
extends AphrontView {
|
|
|
|
private $requests;
|
|
private $highlightID;
|
|
|
|
public function setRequests(array $requests) {
|
|
assert_instances_of($requests, 'HeraldWebhookRequest');
|
|
$this->requests = $requests;
|
|
return $this;
|
|
}
|
|
|
|
public function setHighlightID($highlight_id) {
|
|
$this->highlightID = $highlight_id;
|
|
return $this;
|
|
}
|
|
|
|
public function getHighlightID() {
|
|
return $this->highlightID;
|
|
}
|
|
|
|
public function render() {
|
|
$viewer = $this->getViewer();
|
|
$requests = $this->requests;
|
|
|
|
$handle_phids = array();
|
|
foreach ($requests as $request) {
|
|
$handle_phids[] = $request->getObjectPHID();
|
|
}
|
|
$handles = $viewer->loadHandles($handle_phids);
|
|
|
|
$highlight_id = $this->getHighlightID();
|
|
|
|
$rows = array();
|
|
$rowc = array();
|
|
foreach ($requests as $request) {
|
|
$icon = $request->newStatusIcon();
|
|
|
|
if ($highlight_id == $request->getID()) {
|
|
$rowc[] = 'highlighted';
|
|
} else {
|
|
$rowc[] = null;
|
|
}
|
|
|
|
$rows[] = array(
|
|
$request->getID(),
|
|
$icon,
|
|
$handles[$request->getObjectPHID()]->renderLink(),
|
|
$request->getErrorType(),
|
|
$request->getErrorCode(),
|
|
);
|
|
}
|
|
|
|
$table = id(new AphrontTableView($rows))
|
|
->setRowClasses($rowc)
|
|
->setHeaders(
|
|
array(
|
|
pht('ID'),
|
|
'',
|
|
pht('Object'),
|
|
pht('Type'),
|
|
pht('Code'),
|
|
))
|
|
->setColumnClasses(
|
|
array(
|
|
'n',
|
|
'',
|
|
'wide',
|
|
'',
|
|
'',
|
|
));
|
|
|
|
return $table;
|
|
}
|
|
|
|
}
|