diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 05c2940f29..867071a519 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -537,6 +537,7 @@ phutil_register_library_map(array( 'PhabricatorConduitConsoleController' => 'applications/conduit/controller/console', 'PhabricatorConduitController' => 'applications/conduit/controller/base', 'PhabricatorConduitDAO' => 'applications/conduit/storage/base', + 'PhabricatorConduitListController' => 'applications/conduit/controller/list', 'PhabricatorConduitLogController' => 'applications/conduit/controller/log', 'PhabricatorConduitMethodCallLog' => 'applications/conduit/storage/methodcalllog', 'PhabricatorConduitTokenController' => 'applications/conduit/controller/token', @@ -1459,6 +1460,7 @@ phutil_register_library_map(array( 'PhabricatorConduitConsoleController' => 'PhabricatorConduitController', 'PhabricatorConduitController' => 'PhabricatorController', 'PhabricatorConduitDAO' => 'PhabricatorLiskDAO', + 'PhabricatorConduitListController' => 'PhabricatorConduitController', 'PhabricatorConduitLogController' => 'PhabricatorConduitController', 'PhabricatorConduitMethodCallLog' => 'PhabricatorConduitDAO', 'PhabricatorConduitTokenController' => 'PhabricatorConduitController', diff --git a/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php b/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php index eba7c73c7d..ce1f5fe257 100644 --- a/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php +++ b/src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php @@ -89,7 +89,7 @@ class AphrontDefaultApplicationConfiguration '/p/(?P\w+)/(?:(?P\w+)/)?' => 'PhabricatorPeopleProfileController', '/conduit/' => array( - '' => 'PhabricatorConduitConsoleController', + '' => 'PhabricatorConduitListController', 'method/(?P[^/]+)/' => 'PhabricatorConduitConsoleController', 'log/' => 'PhabricatorConduitLogController', 'log/view/(?P[^/]+)/' => 'PhabricatorConduitLogController', diff --git a/src/applications/conduit/controller/base/PhabricatorConduitController.php b/src/applications/conduit/controller/base/PhabricatorConduitController.php index 8f5988e6f5..366ae2625c 100644 --- a/src/applications/conduit/controller/base/PhabricatorConduitController.php +++ b/src/applications/conduit/controller/base/PhabricatorConduitController.php @@ -45,7 +45,6 @@ abstract class PhabricatorConduitController extends PhabricatorController { $nav = new AphrontSideNavFilterView(); $nav->setBaseURI(new PhutilURI('/conduit/')); - $first_filter = null; $method_filters = $this->getMethodFilters(); foreach ($method_filters as $group => $methods) { $nav->addLabel($group); @@ -61,16 +60,10 @@ abstract class PhabricatorConduitController extends PhabricatorController { $nav->addFilter('method/'.$method_name, $display_name); - if (!$first_filter) { - $first_filter = 'method/'.$method_name; - } } $nav->addSpacer(); } - $nav->addLabel('Utilities'); - $nav->addFilter('log', 'Logs'); - $nav->addFilter('token', 'Token'); - $nav->selectFilter($this->getFilter(), $first_filter); + $nav->selectFilter($this->getFilter()); $nav->appendChild($view); $body = $nav; } else { @@ -82,7 +75,6 @@ abstract class PhabricatorConduitController extends PhabricatorController { return $response->setContent($page->render()); } - private function getFilter() { return $this->filter; } @@ -111,7 +103,7 @@ abstract class PhabricatorConduitController extends PhabricatorController { return array_values(ipull($classes, 'name')); } - private function getMethodFilters() { + protected function getMethodFilters() { $classes = $this->getAllMethodImplementationClasses(); $method_names = array(); foreach ($classes as $method_class) { @@ -119,7 +111,8 @@ abstract class PhabricatorConduitController extends PhabricatorController { $method_class); $group_name = head(explode('.', $method_name)); - $status = newv($method_class, array())->getMethodStatus(); + $method_object = newv($method_class, array()); + $status = $method_object->getMethodStatus(); $key = sprintf( '%02d %s %s', @@ -131,6 +124,7 @@ abstract class PhabricatorConduitController extends PhabricatorController { 'full_name' => $method_name, 'group_name' => $group_name, 'status' => $status, + 'description' => $method_object->getMethodDescription(), ); } ksort($method_names); diff --git a/src/applications/conduit/controller/console/PhabricatorConduitConsoleController.php b/src/applications/conduit/controller/console/PhabricatorConduitConsoleController.php index b1e8a8856d..9007feda8f 100644 --- a/src/applications/conduit/controller/console/PhabricatorConduitConsoleController.php +++ b/src/applications/conduit/controller/console/PhabricatorConduitConsoleController.php @@ -25,7 +25,7 @@ final class PhabricatorConduitConsoleController private $method; public function willProcessRequest(array $data) { - $this->method = idx($data, 'method'); + $this->method = $data['method']; } public function processRequest() { @@ -34,7 +34,7 @@ final class PhabricatorConduitConsoleController $methods = $this->getAllMethods(); if (empty($methods[$this->method])) { - $this->method = head_key($methods); + return new Aphront404Response(); } $this->setFilter('method/'.$this->method); @@ -45,7 +45,7 @@ final class PhabricatorConduitConsoleController $reason = $method_object->getMethodStatusDescription(); $status_view = null; - if ($status != 'stable') { + if ($status != ConduitAPIMethod::METHOD_STATUS_STABLE) { $status_view = new AphrontErrorView(); switch ($status) { case ConduitAPIMethod::METHOD_STATUS_DEPRECATED: @@ -141,7 +141,7 @@ final class PhabricatorConduitConsoleController $panel, ), array( - 'title' => 'Conduit Console', + 'title' => 'Conduit Console - '.$this->method, )); } diff --git a/src/applications/conduit/controller/console/__init__.php b/src/applications/conduit/controller/console/__init__.php index 5e21a1df74..754a06f1a4 100644 --- a/src/applications/conduit/controller/console/__init__.php +++ b/src/applications/conduit/controller/console/__init__.php @@ -6,6 +6,7 @@ +phutil_require_module('phabricator', 'aphront/response/404'); phutil_require_module('phabricator', 'applications/conduit/controller/base'); phutil_require_module('phabricator', 'applications/conduit/method/base'); phutil_require_module('phabricator', 'view/form/base'); diff --git a/src/applications/conduit/controller/list/PhabricatorConduitListController.php b/src/applications/conduit/controller/list/PhabricatorConduitListController.php new file mode 100644 index 0000000000..713a443107 --- /dev/null +++ b/src/applications/conduit/controller/list/PhabricatorConduitListController.php @@ -0,0 +1,97 @@ +getMethodFilters(); + $rows = array(); + foreach ($method_groups as $group => $methods) { + foreach ($methods as $info) { + switch ($info['status']) { + case ConduitAPIMethod::METHOD_STATUS_DEPRECATED: + $status = 'Deprecated'; + break; + case ConduitAPIMethod::METHOD_STATUS_UNSTABLE: + $status = 'Unstable'; + break; + default: + $status = null; + break; + } + + $rows[] = array( + $group, + phutil_render_tag( + 'a', + array( + 'href' => '/conduit/method/'.$info['full_name'], + ), + phutil_escape_html($info['full_name'])), + $info['description'], + $status, + ); + $group = null; + } + } + + $table = new AphrontTableView($rows); + $table->setHeaders(array( + 'Group', + 'Name', + 'Description', + 'Status', + )); + $table->setColumnClasses(array( + 'pri', + 'pri', + 'wide', + null, + )); + + $panel = new AphrontPanelView(); + $panel->setHeader('Conduit Methods'); + $panel->appendChild($table); + $panel->setWidth(AphrontPanelView::WIDTH_FULL); + + $utils = new AphrontPanelView(); + $utils->setHeader('Utilities'); + $utils->appendChild( + '
    '. + '
  • Log - Conduit Method Calls
  • '. + '
  • Token - Certificate Install
  • '. + '
'); + $utils->setWidth(AphrontPanelView::WIDTH_FULL); + + $this->setShowSideNav(false); + + return $this->buildStandardPageResponse( + array( + $panel, + $utils, + ), + array( + 'title' => 'Conduit Console', + )); + } + +} diff --git a/src/applications/conduit/controller/list/__init__.php b/src/applications/conduit/controller/list/__init__.php new file mode 100644 index 0000000000..e315ebe696 --- /dev/null +++ b/src/applications/conduit/controller/list/__init__.php @@ -0,0 +1,17 @@ +appendChild($table); $panel->appendChild($pager); - $this->setFilter('log'); + $this->setShowSideNav(false); return $this->buildStandardPageResponse( $panel, diff --git a/src/applications/conduit/controller/token/PhabricatorConduitTokenController.php b/src/applications/conduit/controller/token/PhabricatorConduitTokenController.php index ad56c11ad5..60b19d12c0 100644 --- a/src/applications/conduit/controller/token/PhabricatorConduitTokenController.php +++ b/src/applications/conduit/controller/token/PhabricatorConduitTokenController.php @@ -57,7 +57,6 @@ final class PhabricatorConduitTokenController '

arc will then complete the '. 'install process for you.

'); - $this->setFilter('token'); $this->setShowSideNav(false); return $this->buildStandardPageResponse(