1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-04-12 04:18:37 +02:00
phorge-phorge/src/applications/config/controller/module/PhabricatorConfigModuleController.php
epriestley 530145ba3b Give "Config" a full-width, hierarchical layout
Summary:
Depends on D20933. Ref T13362. This reorganizes Config a bit and attempts to simplify it.

Subsections are now in a landing page console and groupings have been removed. We "only" have 75 values you can edit from the web UI nowadays, which is still a lot, but less overwhelming than it was in the past. And the trend is generally downward, as config is removed/simplified or moved into application settings.

This also gets rid of the "gigantic blobs of JSON in the UI".

Test Plan: Browsed all Config sections.

Maniphest Tasks: T13362

Differential Revision: https://secure.phabricator.com/D20934
2020-02-04 06:59:51 -08:00

59 lines
1.5 KiB
PHP

<?php
final class PhabricatorConfigModuleController
extends PhabricatorConfigController {
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
$key = $request->getURIData('module');
$all_modules = PhabricatorConfigModule::getAllModules();
if (!strlen($key)) {
$key = head_key($all_modules);
}
if (empty($all_modules[$key])) {
return new Aphront404Response();
}
$module = $all_modules[$key];
$content = $module->renderModuleStatus($request);
$title = $module->getModuleName();
$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);
$content = id(new PHUITwoColumnView())
->setHeader($header)
->setFooter($view);
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->setNavigation($nav)
->appendChild($content);
}
}