diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 79268ede11..0459033891 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1741,6 +1741,7 @@ phutil_register_library_map(array( 'PhabricatorConfigDatabaseStatusController' => 'applications/config/controller/PhabricatorConfigDatabaseStatusController.php', 'PhabricatorConfigDefaultSource' => 'infrastructure/env/PhabricatorConfigDefaultSource.php', 'PhabricatorConfigDictionarySource' => 'infrastructure/env/PhabricatorConfigDictionarySource.php', + 'PhabricatorConfigEdgeModule' => 'applications/config/module/PhabricatorConfigEdgeModule.php', 'PhabricatorConfigEditController' => 'applications/config/controller/PhabricatorConfigEditController.php', 'PhabricatorConfigEditor' => 'applications/config/editor/PhabricatorConfigEditor.php', 'PhabricatorConfigEntry' => 'applications/config/storage/PhabricatorConfigEntry.php', @@ -1763,14 +1764,17 @@ phutil_register_library_map(array( 'PhabricatorConfigManagementMigrateWorkflow' => 'applications/config/management/PhabricatorConfigManagementMigrateWorkflow.php', 'PhabricatorConfigManagementSetWorkflow' => 'applications/config/management/PhabricatorConfigManagementSetWorkflow.php', 'PhabricatorConfigManagementWorkflow' => 'applications/config/management/PhabricatorConfigManagementWorkflow.php', + 'PhabricatorConfigModule' => 'applications/config/module/PhabricatorConfigModule.php', + 'PhabricatorConfigModuleController' => 'applications/config/controller/PhabricatorConfigModuleController.php', 'PhabricatorConfigOption' => 'applications/config/option/PhabricatorConfigOption.php', 'PhabricatorConfigOptionType' => 'applications/config/custom/PhabricatorConfigOptionType.php', + 'PhabricatorConfigPHIDModule' => 'applications/config/module/PhabricatorConfigPHIDModule.php', 'PhabricatorConfigProxySource' => 'infrastructure/env/PhabricatorConfigProxySource.php', 'PhabricatorConfigResponse' => 'applications/config/response/PhabricatorConfigResponse.php', 'PhabricatorConfigSchemaQuery' => 'applications/config/schema/PhabricatorConfigSchemaQuery.php', 'PhabricatorConfigSchemaSpec' => 'applications/config/schema/PhabricatorConfigSchemaSpec.php', 'PhabricatorConfigServerSchema' => 'applications/config/schema/PhabricatorConfigServerSchema.php', - 'PhabricatorConfigSiteModuleController' => 'applications/config/controller/PhabricatorConfigSiteModuleController.php', + 'PhabricatorConfigSiteModule' => 'applications/config/module/PhabricatorConfigSiteModule.php', 'PhabricatorConfigSiteSource' => 'infrastructure/env/PhabricatorConfigSiteSource.php', 'PhabricatorConfigSource' => 'infrastructure/env/PhabricatorConfigSource.php', 'PhabricatorConfigStackSource' => 'infrastructure/env/PhabricatorConfigStackSource.php', @@ -5478,6 +5482,7 @@ phutil_register_library_map(array( 'PhabricatorConfigDatabaseStatusController' => 'PhabricatorConfigDatabaseController', 'PhabricatorConfigDefaultSource' => 'PhabricatorConfigProxySource', 'PhabricatorConfigDictionarySource' => 'PhabricatorConfigSource', + 'PhabricatorConfigEdgeModule' => 'PhabricatorConfigModule', 'PhabricatorConfigEditController' => 'PhabricatorConfigController', 'PhabricatorConfigEditor' => 'PhabricatorApplicationTransactionEditor', 'PhabricatorConfigEntry' => array( @@ -5504,17 +5509,20 @@ phutil_register_library_map(array( 'PhabricatorConfigManagementMigrateWorkflow' => 'PhabricatorConfigManagementWorkflow', 'PhabricatorConfigManagementSetWorkflow' => 'PhabricatorConfigManagementWorkflow', 'PhabricatorConfigManagementWorkflow' => 'PhabricatorManagementWorkflow', + 'PhabricatorConfigModule' => 'Phobject', + 'PhabricatorConfigModuleController' => 'PhabricatorConfigController', 'PhabricatorConfigOption' => array( 'Phobject', 'PhabricatorMarkupInterface', ), 'PhabricatorConfigOptionType' => 'Phobject', + 'PhabricatorConfigPHIDModule' => 'PhabricatorConfigModule', 'PhabricatorConfigProxySource' => 'PhabricatorConfigSource', 'PhabricatorConfigResponse' => 'AphrontStandaloneHTMLResponse', 'PhabricatorConfigSchemaQuery' => 'Phobject', 'PhabricatorConfigSchemaSpec' => 'Phobject', 'PhabricatorConfigServerSchema' => 'PhabricatorConfigStorageSchema', - 'PhabricatorConfigSiteModuleController' => 'PhabricatorConfigController', + 'PhabricatorConfigSiteModule' => 'PhabricatorConfigModule', 'PhabricatorConfigSiteSource' => 'PhabricatorConfigProxySource', 'PhabricatorConfigSource' => 'Phobject', 'PhabricatorConfigStackSource' => 'PhabricatorConfigSource', diff --git a/src/applications/config/application/PhabricatorConfigApplication.php b/src/applications/config/application/PhabricatorConfigApplication.php index 6ef6a2a4f4..8375881c24 100644 --- a/src/applications/config/application/PhabricatorConfigApplication.php +++ b/src/applications/config/application/PhabricatorConfigApplication.php @@ -57,7 +57,7 @@ final class PhabricatorConfigApplication extends PhabricatorApplication { ), 'cache/' => 'PhabricatorConfigCacheController', 'module/' => array( - 'sites/' => 'PhabricatorConfigSiteModuleController', + '(?P[^/]+)/' => 'PhabricatorConfigModuleController', ), ), ); diff --git a/src/applications/config/controller/PhabricatorConfigController.php b/src/applications/config/controller/PhabricatorConfigController.php index 1265c37a61..a752c2754c 100644 --- a/src/applications/config/controller/PhabricatorConfigController.php +++ b/src/applications/config/controller/PhabricatorConfigController.php @@ -25,7 +25,11 @@ abstract class PhabricatorConfigController extends PhabricatorController { $nav->addLabel(pht('Welcome')); $nav->addFilter('welcome/', pht('Welcome Screen')); $nav->addLabel(pht('Modules')); - $nav->addFilter('module/sites/', pht('Sites')); + + $modules = PhabricatorConfigModule::getAllModules(); + foreach ($modules as $key => $module) { + $nav->addFilter('module/'.$key.'/', $module->getModuleName()); + } return $nav; } diff --git a/src/applications/config/controller/PhabricatorConfigModuleController.php b/src/applications/config/controller/PhabricatorConfigModuleController.php new file mode 100644 index 0000000000..76343ecc11 --- /dev/null +++ b/src/applications/config/controller/PhabricatorConfigModuleController.php @@ -0,0 +1,37 @@ +getViewer(); + $key = $request->getURIData('module'); + + $all_modules = PhabricatorConfigModule::getAllModules(); + if (empty($all_modules[$key])) { + return new Aphront404Response(); + } + + $module = $all_modules[$key]; + $content = $module->renderModuleStatus($request); + $name = $module->getModuleName(); + + $crumbs = $this->buildApplicationCrumbs(); + $crumbs->addTextCrumb($name); + + $nav = $this->buildSideNavView(); + $nav->selectFilter('module/'.$key.'/'); + $nav->appendChild( + array( + $crumbs, + $content, + )); + + return $this->buildApplicationPage( + $nav, + array( + 'title' => $name, + )); + } + +} diff --git a/src/applications/config/controller/PhabricatorConfigSiteModuleController.php b/src/applications/config/controller/PhabricatorConfigSiteModuleController.php deleted file mode 100644 index f2b79b2675..0000000000 --- a/src/applications/config/controller/PhabricatorConfigSiteModuleController.php +++ /dev/null @@ -1,56 +0,0 @@ -getViewer(); - - $sites = AphrontSite::getAllSites(); - - $rows = array(); - foreach ($sites as $key => $site) { - $rows[] = array( - $site->getPriority(), - $key, - $site->getDescription(), - ); - } - - $table = id(new AphrontTableView($rows)) - ->setHeaders( - array( - pht('Priority'), - pht('Class'), - pht('Description'), - )) - ->setColumnClasses( - array( - null, - 'pri', - 'wide', - )); - - $box = id(new PHUIObjectBoxView()) - ->setHeaderText(pht('Site Modules')) - ->appendChild($table); - - $crumbs = $this->buildApplicationCrumbs(); - $crumbs->addTextCrumb(pht('Site Modules')); - - $nav = $this->buildSideNavView(); - $nav->selectFilter('module/sites/'); - $nav->appendChild( - array( - $crumbs, - $box, - )); - - return $this->buildApplicationPage( - $nav, - array( - 'title' => array(pht('Site Modules')), - )); - } - -} diff --git a/src/applications/config/module/PhabricatorConfigEdgeModule.php b/src/applications/config/module/PhabricatorConfigEdgeModule.php new file mode 100644 index 0000000000..f8a348caf3 --- /dev/null +++ b/src/applications/config/module/PhabricatorConfigEdgeModule.php @@ -0,0 +1,47 @@ +getViewer(); + + $types = PhabricatorEdgeType::getAllTypes(); + $types = msort($types, 'getEdgeConstant'); + + $rows = array(); + foreach ($types as $key => $type) { + $rows[] = array( + $type->getEdgeConstant(), + $type->getInverseEdgeConstant(), + get_class($type), + ); + } + + $table = id(new AphrontTableView($rows)) + ->setHeaders( + array( + pht('Constant'), + pht('Inverse'), + pht('Class'), + )) + ->setColumnClasses( + array( + null, + null, + 'pri wide', + )); + + return id(new PHUIObjectBoxView()) + ->setHeaderText(pht('Edge Types')) + ->appendChild($table); + } + +} diff --git a/src/applications/config/module/PhabricatorConfigModule.php b/src/applications/config/module/PhabricatorConfigModule.php new file mode 100644 index 0000000000..05625e5d50 --- /dev/null +++ b/src/applications/config/module/PhabricatorConfigModule.php @@ -0,0 +1,17 @@ +setAncestorClass(__CLASS__) + ->setUniqueMethod('getModuleKey') + ->setSortMethod('getModuleName') + ->execute(); + } + +} diff --git a/src/applications/config/module/PhabricatorConfigPHIDModule.php b/src/applications/config/module/PhabricatorConfigPHIDModule.php new file mode 100644 index 0000000000..300740ea77 --- /dev/null +++ b/src/applications/config/module/PhabricatorConfigPHIDModule.php @@ -0,0 +1,47 @@ +getViewer(); + + $types = PhabricatorPHIDType::getAllTypes(); + $types = msort($types, 'getTypeConstant'); + + $rows = array(); + foreach ($types as $key => $type) { + $rows[] = array( + $type->getTypeConstant(), + get_class($type), + $type->getTypeName(), + ); + } + + $table = id(new AphrontTableView($rows)) + ->setHeaders( + array( + pht('Constant'), + pht('Class'), + pht('Name'), + )) + ->setColumnClasses( + array( + null, + 'pri', + 'wide', + )); + + return id(new PHUIObjectBoxView()) + ->setHeaderText(pht('PHID Types')) + ->appendChild($table); + } + +} diff --git a/src/applications/config/module/PhabricatorConfigSiteModule.php b/src/applications/config/module/PhabricatorConfigSiteModule.php new file mode 100644 index 0000000000..0b85db2a10 --- /dev/null +++ b/src/applications/config/module/PhabricatorConfigSiteModule.php @@ -0,0 +1,46 @@ +getViewer(); + + $sites = AphrontSite::getAllSites(); + + $rows = array(); + foreach ($sites as $key => $site) { + $rows[] = array( + $site->getPriority(), + $key, + $site->getDescription(), + ); + } + + $table = id(new AphrontTableView($rows)) + ->setHeaders( + array( + pht('Priority'), + pht('Class'), + pht('Description'), + )) + ->setColumnClasses( + array( + null, + 'pri', + 'wide', + )); + + return id(new PHUIObjectBoxView()) + ->setHeaderText(pht('Sites')) + ->appendChild($table); + } + +}