mirror of
https://we.phorge.it/source/phorge.git
synced 2025-03-15 22:04:57 +01:00
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
This commit is contained in:
parent
0216fac30a
commit
8a153c1fe9
5 changed files with 170 additions and 0 deletions
|
@ -739,6 +739,7 @@ phutil_register_library_map(array(
|
|||
'DiffusionRefsQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php',
|
||||
'DiffusionRenameHistoryQuery' => 'applications/diffusion/query/DiffusionRenameHistoryQuery.php',
|
||||
'DiffusionRepositoryByIDRemarkupRule' => 'applications/diffusion/remarkup/DiffusionRepositoryByIDRemarkupRule.php',
|
||||
'DiffusionRepositoryClusterManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryClusterManagementPanel.php',
|
||||
'DiffusionRepositoryController' => 'applications/diffusion/controller/DiffusionRepositoryController.php',
|
||||
'DiffusionRepositoryCreateController' => 'applications/diffusion/controller/DiffusionRepositoryCreateController.php',
|
||||
'DiffusionRepositoryDatasource' => 'applications/diffusion/typeahead/DiffusionRepositoryDatasource.php',
|
||||
|
@ -759,6 +760,8 @@ phutil_register_library_map(array(
|
|||
'DiffusionRepositoryEditSubversionController' => 'applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php',
|
||||
'DiffusionRepositoryEditUpdateController' => 'applications/diffusion/controller/DiffusionRepositoryEditUpdateController.php',
|
||||
'DiffusionRepositoryListController' => 'applications/diffusion/controller/DiffusionRepositoryListController.php',
|
||||
'DiffusionRepositoryManageController' => 'applications/diffusion/controller/DiffusionRepositoryManageController.php',
|
||||
'DiffusionRepositoryManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryManagementPanel.php',
|
||||
'DiffusionRepositoryNewController' => 'applications/diffusion/controller/DiffusionRepositoryNewController.php',
|
||||
'DiffusionRepositoryPath' => 'applications/diffusion/data/DiffusionRepositoryPath.php',
|
||||
'DiffusionRepositoryRef' => 'applications/diffusion/data/DiffusionRepositoryRef.php',
|
||||
|
@ -4921,6 +4924,7 @@ phutil_register_library_map(array(
|
|||
'DiffusionRefsQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
|
||||
'DiffusionRenameHistoryQuery' => 'Phobject',
|
||||
'DiffusionRepositoryByIDRemarkupRule' => 'PhabricatorObjectRemarkupRule',
|
||||
'DiffusionRepositoryClusterManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||
'DiffusionRepositoryController' => 'DiffusionController',
|
||||
'DiffusionRepositoryCreateController' => 'DiffusionRepositoryEditController',
|
||||
'DiffusionRepositoryDatasource' => 'PhabricatorTypeaheadDatasource',
|
||||
|
@ -4941,6 +4945,8 @@ phutil_register_library_map(array(
|
|||
'DiffusionRepositoryEditSubversionController' => 'DiffusionRepositoryEditController',
|
||||
'DiffusionRepositoryEditUpdateController' => 'DiffusionRepositoryEditController',
|
||||
'DiffusionRepositoryListController' => 'DiffusionController',
|
||||
'DiffusionRepositoryManageController' => 'DiffusionController',
|
||||
'DiffusionRepositoryManagementPanel' => 'Phobject',
|
||||
'DiffusionRepositoryNewController' => 'DiffusionController',
|
||||
'DiffusionRepositoryPath' => 'Phobject',
|
||||
'DiffusionRepositoryRef' => 'Phobject',
|
||||
|
|
|
@ -87,6 +87,8 @@ final class PhabricatorDiffusionApplication extends PhabricatorApplication {
|
|||
=> 'DiffusionCommitTagsController',
|
||||
'commit/(?P<commit>[a-z0-9]+)/edit/'
|
||||
=> 'DiffusionCommitEditController',
|
||||
'manage/(?:(?P<panel>[^/]+)/)?'
|
||||
=> 'DiffusionRepositoryManageController',
|
||||
'edit/' => array(
|
||||
'' => 'DiffusionRepositoryEditMainController',
|
||||
'basic/' => 'DiffusionRepositoryEditBasicController',
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
<?php
|
||||
|
||||
final class DiffusionRepositoryManageController
|
||||
extends DiffusionController {
|
||||
|
||||
private $navigation;
|
||||
|
||||
public function buildApplicationMenu() {
|
||||
// TODO: This is messy for now; the mobile menu should be set automatically
|
||||
// when the body content is a two-column view with navigation.
|
||||
if ($this->navigation) {
|
||||
return $this->navigation->getMenu();
|
||||
}
|
||||
return parent::buildApplicationMenu();
|
||||
}
|
||||
|
||||
|
||||
public function handleRequest(AphrontRequest $request) {
|
||||
$response = $this->loadDiffusionContext();
|
||||
if ($response) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
$viewer = $this->getViewer();
|
||||
$drequest = $this->getDiffusionRequest();
|
||||
$repository = $drequest->getRepository();
|
||||
|
||||
$panels = DiffusionRepositoryManagementPanel::getAllPanels();
|
||||
|
||||
foreach ($panels as $panel) {
|
||||
$panel
|
||||
->setViewer($viewer)
|
||||
->setRepository($repository);
|
||||
}
|
||||
|
||||
$selected = $request->getURIData('panel');
|
||||
if (!strlen($selected)) {
|
||||
$selected = head_key($panels);
|
||||
}
|
||||
|
||||
if (empty($panels[$selected])) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$nav = $this->renderSideNav($repository, $panels, $selected);
|
||||
$this->navigation = $nav;
|
||||
|
||||
$panel = $panels[$selected];
|
||||
|
||||
$content = $panel->buildManagementPanelContent();
|
||||
|
||||
$title = array(
|
||||
$panel->getManagementPanelLabel(),
|
||||
$repository->getDisplayName(),
|
||||
);
|
||||
|
||||
$crumbs = $this->buildApplicationCrumbs();
|
||||
$crumbs->addTextCrumb(
|
||||
$repository->getDisplayName(),
|
||||
$repository->getURI());
|
||||
$crumbs->addTextCrumb(
|
||||
pht('Manage'),
|
||||
$repository->getPathURI('manage/'));
|
||||
$crumbs->addTextCrumb($panel->getManagementPanelLabel());
|
||||
|
||||
$view = id(new PHUITwoColumnView())
|
||||
->setNavigation($nav)
|
||||
->setMainColumn($content);
|
||||
|
||||
return $this->newPage()
|
||||
->setTitle($title)
|
||||
->setCrumbs($crumbs)
|
||||
->appendChild($view);
|
||||
}
|
||||
|
||||
private function renderSideNav(
|
||||
PhabricatorRepository $repository,
|
||||
array $panels,
|
||||
$selected) {
|
||||
|
||||
$base_uri = $repository->getPathURI('manage/');
|
||||
$base_uri = new PhutilURI($base_uri);
|
||||
|
||||
$nav = id(new AphrontSideNavFilterView())
|
||||
->setBaseURI($base_uri);
|
||||
|
||||
foreach ($panels as $panel) {
|
||||
$nav->addFilter(
|
||||
$panel->getManagementPanelKey(),
|
||||
$panel->getManagementPanelLabel());
|
||||
}
|
||||
|
||||
$nav->selectFilter($selected);
|
||||
|
||||
return $nav;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
final class DiffusionRepositoryClusterManagementPanel
|
||||
extends DiffusionRepositoryManagementPanel {
|
||||
|
||||
const PANELKEY = 'cluster';
|
||||
|
||||
public function getManagementPanelLabel() {
|
||||
return pht('Cluster Configuration');
|
||||
}
|
||||
|
||||
public function getManagementPanelOrder() {
|
||||
return 12345;
|
||||
}
|
||||
|
||||
public function buildManagementPanelContent() {
|
||||
return pht('TODO: Cluster configuration management.');
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
abstract class DiffusionRepositoryManagementPanel
|
||||
extends Phobject {
|
||||
|
||||
private $viewer;
|
||||
private $repository;
|
||||
|
||||
final public function setViewer(PhabricatorUser $viewer) {
|
||||
$this->viewer = $viewer;
|
||||
return $this;
|
||||
}
|
||||
|
||||
final public function getViewer() {
|
||||
return $this->viewer;
|
||||
}
|
||||
|
||||
final public function setRepository(PhabricatorRepository $repository) {
|
||||
$this->repository = $repository;
|
||||
return $this;
|
||||
}
|
||||
|
||||
final public function getRepository() {
|
||||
return $this->repository;
|
||||
}
|
||||
|
||||
final public function getManagementPanelKey() {
|
||||
return $this->getPhobjectClassConstant('PANELKEY');
|
||||
}
|
||||
|
||||
abstract public function getManagementPanelLabel();
|
||||
abstract public function getManagementPanelOrder();
|
||||
abstract public function buildManagementPanelContent();
|
||||
|
||||
public static function getAllPanels() {
|
||||
return id(new PhutilClassMapQuery())
|
||||
->setAncestorClass(__CLASS__)
|
||||
->setUniqueMethod('getManagementPanelKey')
|
||||
->setSortMethod('getManagementPanelOrder')
|
||||
->execute();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue