@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.

Rough cut at new "pro" Diffusion edit UI skeleton

Summary:
Ref T4292. This puts a very rough skeleton in place for the new "Manage Repository" UI, somewhat similar to the "Settings" UI.

Right now, it has one panel with no content, and is not reachable from the UI.

Test Plan: {F1214525}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T4292

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

+170
+6
src/__phutil_library_map__.php
··· 739 739 'DiffusionRefsQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php', 740 740 'DiffusionRenameHistoryQuery' => 'applications/diffusion/query/DiffusionRenameHistoryQuery.php', 741 741 'DiffusionRepositoryByIDRemarkupRule' => 'applications/diffusion/remarkup/DiffusionRepositoryByIDRemarkupRule.php', 742 + 'DiffusionRepositoryClusterManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryClusterManagementPanel.php', 742 743 'DiffusionRepositoryController' => 'applications/diffusion/controller/DiffusionRepositoryController.php', 743 744 'DiffusionRepositoryCreateController' => 'applications/diffusion/controller/DiffusionRepositoryCreateController.php', 744 745 'DiffusionRepositoryDatasource' => 'applications/diffusion/typeahead/DiffusionRepositoryDatasource.php', ··· 759 760 'DiffusionRepositoryEditSubversionController' => 'applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php', 760 761 'DiffusionRepositoryEditUpdateController' => 'applications/diffusion/controller/DiffusionRepositoryEditUpdateController.php', 761 762 'DiffusionRepositoryListController' => 'applications/diffusion/controller/DiffusionRepositoryListController.php', 763 + 'DiffusionRepositoryManageController' => 'applications/diffusion/controller/DiffusionRepositoryManageController.php', 764 + 'DiffusionRepositoryManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryManagementPanel.php', 762 765 'DiffusionRepositoryNewController' => 'applications/diffusion/controller/DiffusionRepositoryNewController.php', 763 766 'DiffusionRepositoryPath' => 'applications/diffusion/data/DiffusionRepositoryPath.php', 764 767 'DiffusionRepositoryRef' => 'applications/diffusion/data/DiffusionRepositoryRef.php', ··· 4921 4924 'DiffusionRefsQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod', 4922 4925 'DiffusionRenameHistoryQuery' => 'Phobject', 4923 4926 'DiffusionRepositoryByIDRemarkupRule' => 'PhabricatorObjectRemarkupRule', 4927 + 'DiffusionRepositoryClusterManagementPanel' => 'DiffusionRepositoryManagementPanel', 4924 4928 'DiffusionRepositoryController' => 'DiffusionController', 4925 4929 'DiffusionRepositoryCreateController' => 'DiffusionRepositoryEditController', 4926 4930 'DiffusionRepositoryDatasource' => 'PhabricatorTypeaheadDatasource', ··· 4941 4945 'DiffusionRepositoryEditSubversionController' => 'DiffusionRepositoryEditController', 4942 4946 'DiffusionRepositoryEditUpdateController' => 'DiffusionRepositoryEditController', 4943 4947 'DiffusionRepositoryListController' => 'DiffusionController', 4948 + 'DiffusionRepositoryManageController' => 'DiffusionController', 4949 + 'DiffusionRepositoryManagementPanel' => 'Phobject', 4944 4950 'DiffusionRepositoryNewController' => 'DiffusionController', 4945 4951 'DiffusionRepositoryPath' => 'Phobject', 4946 4952 'DiffusionRepositoryRef' => 'Phobject',
+2
src/applications/diffusion/application/PhabricatorDiffusionApplication.php
··· 87 87 => 'DiffusionCommitTagsController', 88 88 'commit/(?P<commit>[a-z0-9]+)/edit/' 89 89 => 'DiffusionCommitEditController', 90 + 'manage/(?:(?P<panel>[^/]+)/)?' 91 + => 'DiffusionRepositoryManageController', 90 92 'edit/' => array( 91 93 '' => 'DiffusionRepositoryEditMainController', 92 94 'basic/' => 'DiffusionRepositoryEditBasicController',
+99
src/applications/diffusion/controller/DiffusionRepositoryManageController.php
··· 1 + <?php 2 + 3 + final class DiffusionRepositoryManageController 4 + extends DiffusionController { 5 + 6 + private $navigation; 7 + 8 + public function buildApplicationMenu() { 9 + // TODO: This is messy for now; the mobile menu should be set automatically 10 + // when the body content is a two-column view with navigation. 11 + if ($this->navigation) { 12 + return $this->navigation->getMenu(); 13 + } 14 + return parent::buildApplicationMenu(); 15 + } 16 + 17 + 18 + public function handleRequest(AphrontRequest $request) { 19 + $response = $this->loadDiffusionContext(); 20 + if ($response) { 21 + return $response; 22 + } 23 + 24 + $viewer = $this->getViewer(); 25 + $drequest = $this->getDiffusionRequest(); 26 + $repository = $drequest->getRepository(); 27 + 28 + $panels = DiffusionRepositoryManagementPanel::getAllPanels(); 29 + 30 + foreach ($panels as $panel) { 31 + $panel 32 + ->setViewer($viewer) 33 + ->setRepository($repository); 34 + } 35 + 36 + $selected = $request->getURIData('panel'); 37 + if (!strlen($selected)) { 38 + $selected = head_key($panels); 39 + } 40 + 41 + if (empty($panels[$selected])) { 42 + return new Aphront404Response(); 43 + } 44 + 45 + $nav = $this->renderSideNav($repository, $panels, $selected); 46 + $this->navigation = $nav; 47 + 48 + $panel = $panels[$selected]; 49 + 50 + $content = $panel->buildManagementPanelContent(); 51 + 52 + $title = array( 53 + $panel->getManagementPanelLabel(), 54 + $repository->getDisplayName(), 55 + ); 56 + 57 + $crumbs = $this->buildApplicationCrumbs(); 58 + $crumbs->addTextCrumb( 59 + $repository->getDisplayName(), 60 + $repository->getURI()); 61 + $crumbs->addTextCrumb( 62 + pht('Manage'), 63 + $repository->getPathURI('manage/')); 64 + $crumbs->addTextCrumb($panel->getManagementPanelLabel()); 65 + 66 + $view = id(new PHUITwoColumnView()) 67 + ->setNavigation($nav) 68 + ->setMainColumn($content); 69 + 70 + return $this->newPage() 71 + ->setTitle($title) 72 + ->setCrumbs($crumbs) 73 + ->appendChild($view); 74 + } 75 + 76 + private function renderSideNav( 77 + PhabricatorRepository $repository, 78 + array $panels, 79 + $selected) { 80 + 81 + $base_uri = $repository->getPathURI('manage/'); 82 + $base_uri = new PhutilURI($base_uri); 83 + 84 + $nav = id(new AphrontSideNavFilterView()) 85 + ->setBaseURI($base_uri); 86 + 87 + foreach ($panels as $panel) { 88 + $nav->addFilter( 89 + $panel->getManagementPanelKey(), 90 + $panel->getManagementPanelLabel()); 91 + } 92 + 93 + $nav->selectFilter($selected); 94 + 95 + return $nav; 96 + } 97 + 98 + 99 + }
+20
src/applications/diffusion/management/DiffusionRepositoryClusterManagementPanel.php
··· 1 + <?php 2 + 3 + final class DiffusionRepositoryClusterManagementPanel 4 + extends DiffusionRepositoryManagementPanel { 5 + 6 + const PANELKEY = 'cluster'; 7 + 8 + public function getManagementPanelLabel() { 9 + return pht('Cluster Configuration'); 10 + } 11 + 12 + public function getManagementPanelOrder() { 13 + return 12345; 14 + } 15 + 16 + public function buildManagementPanelContent() { 17 + return pht('TODO: Cluster configuration management.'); 18 + } 19 + 20 + }
+43
src/applications/diffusion/management/DiffusionRepositoryManagementPanel.php
··· 1 + <?php 2 + 3 + abstract class DiffusionRepositoryManagementPanel 4 + extends Phobject { 5 + 6 + private $viewer; 7 + private $repository; 8 + 9 + final public function setViewer(PhabricatorUser $viewer) { 10 + $this->viewer = $viewer; 11 + return $this; 12 + } 13 + 14 + final public function getViewer() { 15 + return $this->viewer; 16 + } 17 + 18 + final public function setRepository(PhabricatorRepository $repository) { 19 + $this->repository = $repository; 20 + return $this; 21 + } 22 + 23 + final public function getRepository() { 24 + return $this->repository; 25 + } 26 + 27 + final public function getManagementPanelKey() { 28 + return $this->getPhobjectClassConstant('PANELKEY'); 29 + } 30 + 31 + abstract public function getManagementPanelLabel(); 32 + abstract public function getManagementPanelOrder(); 33 + abstract public function buildManagementPanelContent(); 34 + 35 + public static function getAllPanels() { 36 + return id(new PhutilClassMapQuery()) 37 + ->setAncestorClass(__CLASS__) 38 + ->setUniqueMethod('getManagementPanelKey') 39 + ->setSortMethod('getManagementPanelOrder') 40 + ->execute(); 41 + } 42 + 43 + }