From a72ade94757ae38b4760bd6efad67ff30dd0b376 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 26 Nov 2019 14:49:36 -0800 Subject: [PATCH] Carve out a separate "Modules/Extensions" section of Config Summary: Ref T13362. Config is currently doing a ton of stuff and fairly overwhelming. Separate out "Modules/Extensions" so it can live in its own section. (This stuff is mostly useful for development and normal users rarely need to end up here.) Test Plan: Visited seciton, clicked around. This is just a visual change. Maniphest Tasks: T13362 Differential Revision: https://secure.phabricator.com/D20930 --- .../PhabricatorConfigApplication.php | 2 +- .../PhabricatorConfigController.php | 7 ------ .../PhabricatorConfigModuleController.php | 23 +++++++++++++++++-- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/applications/config/application/PhabricatorConfigApplication.php b/src/applications/config/application/PhabricatorConfigApplication.php index e7540ad9de..a8c7f2ff5b 100644 --- a/src/applications/config/application/PhabricatorConfigApplication.php +++ b/src/applications/config/application/PhabricatorConfigApplication.php @@ -63,7 +63,7 @@ final class PhabricatorConfigApplication extends PhabricatorApplication { 'purge/' => 'PhabricatorConfigPurgeCacheController', ), 'module/' => array( - '(?P[^/]+)/' => 'PhabricatorConfigModuleController', + '(?:(?P[^/]+)/)?' => 'PhabricatorConfigModuleController', ), 'cluster/' => array( 'databases/' => 'PhabricatorConfigClusterDatabasesController', diff --git a/src/applications/config/controller/PhabricatorConfigController.php b/src/applications/config/controller/PhabricatorConfigController.php index 1b6a5af8b5..0b2a67a17f 100644 --- a/src/applications/config/controller/PhabricatorConfigController.php +++ b/src/applications/config/controller/PhabricatorConfigController.php @@ -42,13 +42,6 @@ abstract class PhabricatorConfigController extends PhabricatorController { pht('Repository Servers'), null, 'fa-code'); $nav->addFilter('cluster/search/', pht('Search Servers'), null, 'fa-search'); - $nav->addLabel(pht('Modules')); - - $modules = PhabricatorConfigModule::getAllModules(); - foreach ($modules as $key => $module) { - $nav->addFilter('module/'.$key.'/', - $module->getModuleName(), null, 'fa-puzzle-piece'); - } return $nav; } diff --git a/src/applications/config/controller/PhabricatorConfigModuleController.php b/src/applications/config/controller/PhabricatorConfigModuleController.php index fe919c57e4..aaa873f5d2 100644 --- a/src/applications/config/controller/PhabricatorConfigModuleController.php +++ b/src/applications/config/controller/PhabricatorConfigModuleController.php @@ -8,6 +8,11 @@ final class PhabricatorConfigModuleController $key = $request->getURIData('module'); $all_modules = PhabricatorConfigModule::getAllModules(); + + if (!strlen($key)) { + $key = head_key($all_modules); + } + if (empty($all_modules[$key])) { return new Aphront404Response(); } @@ -16,13 +21,27 @@ final class PhabricatorConfigModuleController $content = $module->renderModuleStatus($request); $title = $module->getModuleName(); - $nav = $this->buildSideNavView(); - $nav->selectFilter('module/'.$key.'/'); + $nav = new AphrontSideNavFilterView(); + $nav->setBaseURI(new PhutilURI($this->getApplicationURI())); + + $modules_uri = $this->getApplicationURI('module/'); + + $modules = PhabricatorConfigModule::getAllModules(); + + foreach ($modules as $module_key => $module) { + $nav->newLink($module_key) + ->setName($module->getModuleName()) + ->setHref(urisprintf('%s%s/', $modules_uri, $module_key)) + ->setIcon('fa-puzzle-piece'); + } + + $nav->selectFilter($key); $header = $this->buildHeaderView($title); $view = $this->buildConfigBoxView($title, $content); $crumbs = $this->buildApplicationCrumbs() + ->addTextCrumb(pht('Extensions/Modules'), $modules_uri) ->addTextCrumb($title) ->setBorder(true);