Differential D11957 Diff 28796 src/applications/conduit/controller/PhabricatorConduitAPIController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conduit/controller/PhabricatorConduitAPIController.php
Show First 20 Lines • Show All 526 Lines • ▼ Show 20 Lines | if ($request) { | ||||
$param_rows[] = array( | $param_rows[] = array( | ||||
$key, | $key, | ||||
$this->renderAPIValue($value), | $this->renderAPIValue($value), | ||||
); | ); | ||||
} | } | ||||
} | } | ||||
$param_table = new AphrontTableView($param_rows); | $param_table = new AphrontTableView($param_rows); | ||||
$param_table->setDeviceReadyTable(true); | |||||
$param_table->setColumnClasses( | $param_table->setColumnClasses( | ||||
array( | array( | ||||
'header', | 'header', | ||||
'wide', | 'wide', | ||||
)); | )); | ||||
$result_rows = array(); | $result_rows = array(); | ||||
foreach ($result as $key => $value) { | foreach ($result as $key => $value) { | ||||
$result_rows[] = array( | $result_rows[] = array( | ||||
$key, | $key, | ||||
$this->renderAPIValue($value), | $this->renderAPIValue($value), | ||||
); | ); | ||||
} | } | ||||
$result_table = new AphrontTableView($result_rows); | $result_table = new AphrontTableView($result_rows); | ||||
$result_table->setDeviceReadyTable(true); | |||||
$result_table->setColumnClasses( | $result_table->setColumnClasses( | ||||
array( | array( | ||||
'header', | 'header', | ||||
'wide', | 'wide', | ||||
)); | )); | ||||
$param_panel = new AphrontPanelView(); | $param_panel = new PHUIObjectBoxView(); | ||||
$param_panel->setHeader('Method Parameters'); | $param_panel->setHeaderText(pht('Method Parameters')); | ||||
$param_panel->appendChild($param_table); | $param_panel->appendChild($param_table); | ||||
$result_panel = new AphrontPanelView(); | $result_panel = new PHUIObjectBoxView(); | ||||
$result_panel->setHeader('Method Result'); | $result_panel->setHeaderText(pht('Method Result')); | ||||
$result_panel->appendChild($result_table); | $result_panel->appendChild($result_table); | ||||
$param_head = id(new PHUIHeaderView()) | |||||
->setHeader(pht('Method Parameters')); | |||||
$result_head = id(new PHUIHeaderView()) | |||||
->setHeader(pht('Method Result')); | |||||
$method_uri = $this->getApplicationURI('method/'.$method.'/'); | $method_uri = $this->getApplicationURI('method/'.$method.'/'); | ||||
$crumbs = $this->buildApplicationCrumbs() | $crumbs = $this->buildApplicationCrumbs() | ||||
->addTextCrumb($method, $method_uri) | ->addTextCrumb($method, $method_uri) | ||||
->addTextCrumb(pht('Call')); | ->addTextCrumb(pht('Call')); | ||||
return $this->buildApplicationPage( | return $this->buildApplicationPage( | ||||
array( | array( | ||||
$crumbs, | $crumbs, | ||||
$param_head, | $param_panel, | ||||
$param_table, | $result_panel, | ||||
$result_head, | |||||
$result_table, | |||||
), | ), | ||||
array( | array( | ||||
'title' => 'Method Call Result', | 'title' => pht('Method Call Result'), | ||||
)); | )); | ||||
} | } | ||||
private function renderAPIValue($value) { | private function renderAPIValue($value) { | ||||
$json = new PhutilJSON(); | $json = new PhutilJSON(); | ||||
if (is_array($value)) { | if (is_array($value)) { | ||||
$value = $json->encodeFormatted($value); | $value = $json->encodeFormatted($value); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines |