1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-04-03 16:08:19 +02:00

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
This commit is contained in:
epriestley 2019-11-26 14:49:36 -08:00
parent c42c5983aa
commit a72ade9475
3 changed files with 22 additions and 10 deletions

View file

@ -63,7 +63,7 @@ final class PhabricatorConfigApplication extends PhabricatorApplication {
'purge/' => 'PhabricatorConfigPurgeCacheController', 'purge/' => 'PhabricatorConfigPurgeCacheController',
), ),
'module/' => array( 'module/' => array(
'(?P<module>[^/]+)/' => 'PhabricatorConfigModuleController', '(?:(?P<module>[^/]+)/)?' => 'PhabricatorConfigModuleController',
), ),
'cluster/' => array( 'cluster/' => array(
'databases/' => 'PhabricatorConfigClusterDatabasesController', 'databases/' => 'PhabricatorConfigClusterDatabasesController',

View file

@ -42,13 +42,6 @@ abstract class PhabricatorConfigController extends PhabricatorController {
pht('Repository Servers'), null, 'fa-code'); pht('Repository Servers'), null, 'fa-code');
$nav->addFilter('cluster/search/', $nav->addFilter('cluster/search/',
pht('Search Servers'), null, 'fa-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; return $nav;
} }

View file

@ -8,6 +8,11 @@ final class PhabricatorConfigModuleController
$key = $request->getURIData('module'); $key = $request->getURIData('module');
$all_modules = PhabricatorConfigModule::getAllModules(); $all_modules = PhabricatorConfigModule::getAllModules();
if (!strlen($key)) {
$key = head_key($all_modules);
}
if (empty($all_modules[$key])) { if (empty($all_modules[$key])) {
return new Aphront404Response(); return new Aphront404Response();
} }
@ -16,13 +21,27 @@ final class PhabricatorConfigModuleController
$content = $module->renderModuleStatus($request); $content = $module->renderModuleStatus($request);
$title = $module->getModuleName(); $title = $module->getModuleName();
$nav = $this->buildSideNavView(); $nav = new AphrontSideNavFilterView();
$nav->selectFilter('module/'.$key.'/'); $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); $header = $this->buildHeaderView($title);
$view = $this->buildConfigBoxView($title, $content); $view = $this->buildConfigBoxView($title, $content);
$crumbs = $this->buildApplicationCrumbs() $crumbs = $this->buildApplicationCrumbs()
->addTextCrumb(pht('Extensions/Modules'), $modules_uri)
->addTextCrumb($title) ->addTextCrumb($title)
->setBorder(true); ->setBorder(true);