@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Create overview of Conduit methods

Summary:
Also couple of small changes:

- Add method name to title.
- 404 for /conduit/method/x/.
- Remove utilities from side panel.
- Remove side panel from log.

Test Plan:
/conduit/
/conduit/method/x/
/conduit/method/user.whoami/
/conduit/log/

Reviewers: btrahan, epriestley

Reviewed By: epriestley

CC: aran, Koolvin

Differential Revision: https://secure.phabricator.com/D2326

vrana d27a7513 11ffed7c

+128 -18
+2
src/__phutil_library_map__.php
··· 537 537 'PhabricatorConduitConsoleController' => 'applications/conduit/controller/console', 538 538 'PhabricatorConduitController' => 'applications/conduit/controller/base', 539 539 'PhabricatorConduitDAO' => 'applications/conduit/storage/base', 540 + 'PhabricatorConduitListController' => 'applications/conduit/controller/list', 540 541 'PhabricatorConduitLogController' => 'applications/conduit/controller/log', 541 542 'PhabricatorConduitMethodCallLog' => 'applications/conduit/storage/methodcalllog', 542 543 'PhabricatorConduitTokenController' => 'applications/conduit/controller/token', ··· 1459 1460 'PhabricatorConduitConsoleController' => 'PhabricatorConduitController', 1460 1461 'PhabricatorConduitController' => 'PhabricatorController', 1461 1462 'PhabricatorConduitDAO' => 'PhabricatorLiskDAO', 1463 + 'PhabricatorConduitListController' => 'PhabricatorConduitController', 1462 1464 'PhabricatorConduitLogController' => 'PhabricatorConduitController', 1463 1465 'PhabricatorConduitMethodCallLog' => 'PhabricatorConduitDAO', 1464 1466 'PhabricatorConduitTokenController' => 'PhabricatorConduitController',
+1 -1
src/aphront/default/configuration/AphrontDefaultApplicationConfiguration.php
··· 89 89 '/p/(?P<username>\w+)/(?:(?P<page>\w+)/)?' 90 90 => 'PhabricatorPeopleProfileController', 91 91 '/conduit/' => array( 92 - '' => 'PhabricatorConduitConsoleController', 92 + '' => 'PhabricatorConduitListController', 93 93 'method/(?P<method>[^/]+)/' => 'PhabricatorConduitConsoleController', 94 94 'log/' => 'PhabricatorConduitLogController', 95 95 'log/view/(?P<view>[^/]+)/' => 'PhabricatorConduitLogController',
+5 -11
src/applications/conduit/controller/base/PhabricatorConduitController.php
··· 45 45 46 46 $nav = new AphrontSideNavFilterView(); 47 47 $nav->setBaseURI(new PhutilURI('/conduit/')); 48 - $first_filter = null; 49 48 $method_filters = $this->getMethodFilters(); 50 49 foreach ($method_filters as $group => $methods) { 51 50 $nav->addLabel($group); ··· 61 60 62 61 $nav->addFilter('method/'.$method_name, 63 62 $display_name); 64 - if (!$first_filter) { 65 - $first_filter = 'method/'.$method_name; 66 - } 67 63 } 68 64 $nav->addSpacer(); 69 65 } 70 - $nav->addLabel('Utilities'); 71 - $nav->addFilter('log', 'Logs'); 72 - $nav->addFilter('token', 'Token'); 73 - $nav->selectFilter($this->getFilter(), $first_filter); 66 + $nav->selectFilter($this->getFilter()); 74 67 $nav->appendChild($view); 75 68 $body = $nav; 76 69 } else { ··· 81 74 $response = new AphrontWebpageResponse(); 82 75 return $response->setContent($page->render()); 83 76 } 84 - 85 77 86 78 private function getFilter() { 87 79 return $this->filter; ··· 111 103 return array_values(ipull($classes, 'name')); 112 104 } 113 105 114 - private function getMethodFilters() { 106 + protected function getMethodFilters() { 115 107 $classes = $this->getAllMethodImplementationClasses(); 116 108 $method_names = array(); 117 109 foreach ($classes as $method_class) { ··· 119 111 $method_class); 120 112 $group_name = head(explode('.', $method_name)); 121 113 122 - $status = newv($method_class, array())->getMethodStatus(); 114 + $method_object = newv($method_class, array()); 115 + $status = $method_object->getMethodStatus(); 123 116 124 117 $key = sprintf( 125 118 '%02d %s %s', ··· 131 124 'full_name' => $method_name, 132 125 'group_name' => $group_name, 133 126 'status' => $status, 127 + 'description' => $method_object->getMethodDescription(), 134 128 ); 135 129 } 136 130 ksort($method_names);
+4 -4
src/applications/conduit/controller/console/PhabricatorConduitConsoleController.php
··· 25 25 private $method; 26 26 27 27 public function willProcessRequest(array $data) { 28 - $this->method = idx($data, 'method'); 28 + $this->method = $data['method']; 29 29 } 30 30 31 31 public function processRequest() { ··· 34 34 35 35 $methods = $this->getAllMethods(); 36 36 if (empty($methods[$this->method])) { 37 - $this->method = head_key($methods); 37 + return new Aphront404Response(); 38 38 } 39 39 $this->setFilter('method/'.$this->method); 40 40 ··· 45 45 $reason = $method_object->getMethodStatusDescription(); 46 46 47 47 $status_view = null; 48 - if ($status != 'stable') { 48 + if ($status != ConduitAPIMethod::METHOD_STATUS_STABLE) { 49 49 $status_view = new AphrontErrorView(); 50 50 switch ($status) { 51 51 case ConduitAPIMethod::METHOD_STATUS_DEPRECATED: ··· 141 141 $panel, 142 142 ), 143 143 array( 144 - 'title' => 'Conduit Console', 144 + 'title' => 'Conduit Console - '.$this->method, 145 145 )); 146 146 } 147 147
+1
src/applications/conduit/controller/console/__init__.php
··· 6 6 7 7 8 8 9 + phutil_require_module('phabricator', 'aphront/response/404'); 9 10 phutil_require_module('phabricator', 'applications/conduit/controller/base'); 10 11 phutil_require_module('phabricator', 'applications/conduit/method/base'); 11 12 phutil_require_module('phabricator', 'view/form/base');
+97
src/applications/conduit/controller/list/PhabricatorConduitListController.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + /** 20 + * @group conduit 21 + */ 22 + final class PhabricatorConduitListController 23 + extends PhabricatorConduitController { 24 + 25 + public function processRequest() { 26 + $method_groups = $this->getMethodFilters(); 27 + $rows = array(); 28 + foreach ($method_groups as $group => $methods) { 29 + foreach ($methods as $info) { 30 + switch ($info['status']) { 31 + case ConduitAPIMethod::METHOD_STATUS_DEPRECATED: 32 + $status = 'Deprecated'; 33 + break; 34 + case ConduitAPIMethod::METHOD_STATUS_UNSTABLE: 35 + $status = 'Unstable'; 36 + break; 37 + default: 38 + $status = null; 39 + break; 40 + } 41 + 42 + $rows[] = array( 43 + $group, 44 + phutil_render_tag( 45 + 'a', 46 + array( 47 + 'href' => '/conduit/method/'.$info['full_name'], 48 + ), 49 + phutil_escape_html($info['full_name'])), 50 + $info['description'], 51 + $status, 52 + ); 53 + $group = null; 54 + } 55 + } 56 + 57 + $table = new AphrontTableView($rows); 58 + $table->setHeaders(array( 59 + 'Group', 60 + 'Name', 61 + 'Description', 62 + 'Status', 63 + )); 64 + $table->setColumnClasses(array( 65 + 'pri', 66 + 'pri', 67 + 'wide', 68 + null, 69 + )); 70 + 71 + $panel = new AphrontPanelView(); 72 + $panel->setHeader('Conduit Methods'); 73 + $panel->appendChild($table); 74 + $panel->setWidth(AphrontPanelView::WIDTH_FULL); 75 + 76 + $utils = new AphrontPanelView(); 77 + $utils->setHeader('Utilities'); 78 + $utils->appendChild( 79 + '<ul>'. 80 + '<li><a href="/conduit/log/">Log</a> - Conduit Method Calls</li>'. 81 + '<li><a href="/conduit/token/">Token</a> - Certificate Install</li>'. 82 + '</ul>'); 83 + $utils->setWidth(AphrontPanelView::WIDTH_FULL); 84 + 85 + $this->setShowSideNav(false); 86 + 87 + return $this->buildStandardPageResponse( 88 + array( 89 + $panel, 90 + $utils, 91 + ), 92 + array( 93 + 'title' => 'Conduit Console', 94 + )); 95 + } 96 + 97 + }
+17
src/applications/conduit/controller/list/__init__.php
··· 1 + <?php 2 + /** 3 + * This file is automatically generated. Lint this module to rebuild it. 4 + * @generated 5 + */ 6 + 7 + 8 + 9 + phutil_require_module('phabricator', 'applications/conduit/controller/base'); 10 + phutil_require_module('phabricator', 'applications/conduit/method/base'); 11 + phutil_require_module('phabricator', 'view/control/table'); 12 + phutil_require_module('phabricator', 'view/layout/panel'); 13 + 14 + phutil_require_module('phutil', 'markup'); 15 + 16 + 17 + phutil_require_source('PhabricatorConduitListController.php');
+1 -1
src/applications/conduit/controller/log/PhabricatorConduitLogController.php
··· 57 57 $panel->appendChild($table); 58 58 $panel->appendChild($pager); 59 59 60 - $this->setFilter('log'); 60 + $this->setShowSideNav(false); 61 61 62 62 return $this->buildStandardPageResponse( 63 63 $panel,
-1
src/applications/conduit/controller/token/PhabricatorConduitTokenController.php
··· 57 57 '<p class="aphront-form-instructions">arc will then complete the '. 58 58 'install process for you.</p>'); 59 59 60 - $this->setFilter('token'); 61 60 $this->setShowSideNav(false); 62 61 63 62 return $this->buildStandardPageResponse(