mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-22 20:51:10 +01:00
Separate the repository management UI into sections
Summary: Depends on D19826. Ref T13216. We have a fair number of options here; add some groups so the "Build" stuff can go in a little subcategory and such. Test Plan: {F6020896} Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13216 Differential Revision: https://secure.phabricator.com/D19827
This commit is contained in:
parent
c457d23a1d
commit
c25d2a399d
11 changed files with 146 additions and 14 deletions
|
@ -952,7 +952,12 @@ phutil_register_library_map(array(
|
||||||
'DiffusionRepositoryListController' => 'applications/diffusion/controller/DiffusionRepositoryListController.php',
|
'DiffusionRepositoryListController' => 'applications/diffusion/controller/DiffusionRepositoryListController.php',
|
||||||
'DiffusionRepositoryManageController' => 'applications/diffusion/controller/DiffusionRepositoryManageController.php',
|
'DiffusionRepositoryManageController' => 'applications/diffusion/controller/DiffusionRepositoryManageController.php',
|
||||||
'DiffusionRepositoryManagePanelsController' => 'applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php',
|
'DiffusionRepositoryManagePanelsController' => 'applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php',
|
||||||
|
'DiffusionRepositoryManagementBuildsPanelGroup' => 'applications/diffusion/management/DiffusionRepositoryManagementBuildsPanelGroup.php',
|
||||||
|
'DiffusionRepositoryManagementIntegrationsPanelGroup' => 'applications/diffusion/management/DiffusionRepositoryManagementIntegrationsPanelGroup.php',
|
||||||
|
'DiffusionRepositoryManagementMainPanelGroup' => 'applications/diffusion/management/DiffusionRepositoryManagementMainPanelGroup.php',
|
||||||
|
'DiffusionRepositoryManagementOtherPanelGroup' => 'applications/diffusion/management/DiffusionRepositoryManagementOtherPanelGroup.php',
|
||||||
'DiffusionRepositoryManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryManagementPanel.php',
|
'DiffusionRepositoryManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryManagementPanel.php',
|
||||||
|
'DiffusionRepositoryManagementPanelGroup' => 'applications/diffusion/management/DiffusionRepositoryManagementPanelGroup.php',
|
||||||
'DiffusionRepositoryPath' => 'applications/diffusion/data/DiffusionRepositoryPath.php',
|
'DiffusionRepositoryPath' => 'applications/diffusion/data/DiffusionRepositoryPath.php',
|
||||||
'DiffusionRepositoryPoliciesManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryPoliciesManagementPanel.php',
|
'DiffusionRepositoryPoliciesManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryPoliciesManagementPanel.php',
|
||||||
'DiffusionRepositoryProfilePictureController' => 'applications/diffusion/controller/DiffusionRepositoryProfilePictureController.php',
|
'DiffusionRepositoryProfilePictureController' => 'applications/diffusion/controller/DiffusionRepositoryProfilePictureController.php',
|
||||||
|
@ -6335,7 +6340,12 @@ phutil_register_library_map(array(
|
||||||
'DiffusionRepositoryListController' => 'DiffusionController',
|
'DiffusionRepositoryListController' => 'DiffusionController',
|
||||||
'DiffusionRepositoryManageController' => 'DiffusionController',
|
'DiffusionRepositoryManageController' => 'DiffusionController',
|
||||||
'DiffusionRepositoryManagePanelsController' => 'DiffusionRepositoryManageController',
|
'DiffusionRepositoryManagePanelsController' => 'DiffusionRepositoryManageController',
|
||||||
|
'DiffusionRepositoryManagementBuildsPanelGroup' => 'DiffusionRepositoryManagementPanelGroup',
|
||||||
|
'DiffusionRepositoryManagementIntegrationsPanelGroup' => 'DiffusionRepositoryManagementPanelGroup',
|
||||||
|
'DiffusionRepositoryManagementMainPanelGroup' => 'DiffusionRepositoryManagementPanelGroup',
|
||||||
|
'DiffusionRepositoryManagementOtherPanelGroup' => 'DiffusionRepositoryManagementPanelGroup',
|
||||||
'DiffusionRepositoryManagementPanel' => 'Phobject',
|
'DiffusionRepositoryManagementPanel' => 'Phobject',
|
||||||
|
'DiffusionRepositoryManagementPanelGroup' => 'Phobject',
|
||||||
'DiffusionRepositoryPath' => 'Phobject',
|
'DiffusionRepositoryPath' => 'Phobject',
|
||||||
'DiffusionRepositoryPoliciesManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
'DiffusionRepositoryPoliciesManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||||
'DiffusionRepositoryProfilePictureController' => 'DiffusionController',
|
'DiffusionRepositoryProfilePictureController' => 'DiffusionController',
|
||||||
|
|
|
@ -93,20 +93,45 @@ final class DiffusionRepositoryManagePanelsController
|
||||||
$nav = id(new AphrontSideNavFilterView())
|
$nav = id(new AphrontSideNavFilterView())
|
||||||
->setBaseURI($base_uri);
|
->setBaseURI($base_uri);
|
||||||
|
|
||||||
foreach ($panels as $panel) {
|
$groups = DiffusionRepositoryManagementPanelGroup::getAllPanelGroups();
|
||||||
$key = $panel->getManagementPanelKey();
|
$panel_groups = mgroup($panels, 'getManagementPanelGroupKey');
|
||||||
$label = $panel->getManagementPanelLabel();
|
$other_key = DiffusionRepositoryManagementOtherPanelGroup::PANELGROUPKEY;
|
||||||
$icon = $panel->getManagementPanelIcon();
|
|
||||||
$href = $panel->getPanelNavigationURI();
|
|
||||||
|
|
||||||
$item = id(new PHUIListItemView())
|
foreach ($groups as $group_key => $group) {
|
||||||
->setKey($key)
|
// If this is the "Other" group, include everything else that isn't in
|
||||||
->setName($label)
|
// some actual group.
|
||||||
->setType(PHUIListItemView::TYPE_LINK)
|
if ($group_key === $other_key) {
|
||||||
->setHref($href)
|
$group_panels = array_mergev($panel_groups);
|
||||||
->setIcon($icon);
|
$panel_groups = array();
|
||||||
|
} else {
|
||||||
|
$group_panels = idx($panel_groups, $group_key);
|
||||||
|
unset($panel_groups[$group_key]);
|
||||||
|
}
|
||||||
|
|
||||||
$nav->addMenuItem($item);
|
if (!$group_panels) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$label = $group->getManagementPanelGroupLabel();
|
||||||
|
if ($label) {
|
||||||
|
$nav->addLabel($label);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($group_panels as $panel) {
|
||||||
|
$key = $panel->getManagementPanelKey();
|
||||||
|
$label = $panel->getManagementPanelLabel();
|
||||||
|
$icon = $panel->getManagementPanelIcon();
|
||||||
|
$href = $panel->getPanelNavigationURI();
|
||||||
|
|
||||||
|
$item = id(new PHUIListItemView())
|
||||||
|
->setKey($key)
|
||||||
|
->setName($label)
|
||||||
|
->setType(PHUIListItemView::TYPE_LINK)
|
||||||
|
->setHref($href)
|
||||||
|
->setIcon($icon);
|
||||||
|
|
||||||
|
$nav->addMenuItem($item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$nav->selectFilter($selected);
|
$nav->selectFilter($selected);
|
||||||
|
|
|
@ -13,6 +13,10 @@ final class DiffusionRepositoryAutomationManagementPanel
|
||||||
return 800;
|
return 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getManagementPanelGroupKey() {
|
||||||
|
return DiffusionRepositoryManagementBuildsPanelGroup::PANELGROUPKEY;
|
||||||
|
}
|
||||||
|
|
||||||
public function shouldEnableForRepository(
|
public function shouldEnableForRepository(
|
||||||
PhabricatorRepository $repository) {
|
PhabricatorRepository $repository) {
|
||||||
return $repository->isGit();
|
return $repository->isGit();
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DiffusionRepositoryManagementBuildsPanelGroup
|
||||||
|
extends DiffusionRepositoryManagementPanelGroup {
|
||||||
|
|
||||||
|
const PANELGROUPKEY = 'builds';
|
||||||
|
|
||||||
|
public function getManagementPanelGroupLabel() {
|
||||||
|
return pht('Builds');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getManagementPanelGroupOrder() {
|
||||||
|
return 2000;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DiffusionRepositoryManagementIntegrationsPanelGroup
|
||||||
|
extends DiffusionRepositoryManagementPanelGroup {
|
||||||
|
|
||||||
|
const PANELGROUPKEY = 'integrations';
|
||||||
|
|
||||||
|
public function getManagementPanelGroupLabel() {
|
||||||
|
return pht('Integrations');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getManagementPanelGroupOrder() {
|
||||||
|
return 4000;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DiffusionRepositoryManagementMainPanelGroup
|
||||||
|
extends DiffusionRepositoryManagementPanelGroup {
|
||||||
|
|
||||||
|
const PANELGROUPKEY = 'main';
|
||||||
|
|
||||||
|
public function getManagementPanelGroupLabel() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getManagementPanelGroupOrder() {
|
||||||
|
return 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DiffusionRepositoryManagementOtherPanelGroup
|
||||||
|
extends DiffusionRepositoryManagementPanelGroup {
|
||||||
|
|
||||||
|
const PANELGROUPKEY = 'other';
|
||||||
|
|
||||||
|
public function getManagementPanelGroupLabel() {
|
||||||
|
return pht('Other');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getManagementPanelGroupOrder() {
|
||||||
|
return 9999;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -47,8 +47,8 @@ abstract class DiffusionRepositoryManagementPanel
|
||||||
return 'fa-pencil';
|
return 'fa-pencil';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function buildManagementPanelActions() {
|
public function getManagementPanelGroupKey() {
|
||||||
return array();
|
return DiffusionRepositoryManagementMainPanelGroup::PANELGROUPKEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function shouldEnableForRepository(
|
public function shouldEnableForRepository(
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
abstract class DiffusionRepositoryManagementPanelGroup
|
||||||
|
extends Phobject {
|
||||||
|
|
||||||
|
final public function getManagementPanelGroupKey() {
|
||||||
|
return $this->getPhobjectClassConstant('PANELGROUPKEY');
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract public function getManagementPanelGroupOrder();
|
||||||
|
abstract public function getManagementPanelGroupLabel();
|
||||||
|
|
||||||
|
public static function getAllPanelGroups() {
|
||||||
|
return id(new PhutilClassMapQuery())
|
||||||
|
->setAncestorClass(__CLASS__)
|
||||||
|
->setUniqueMethod('getManagementPanelGroupKey')
|
||||||
|
->setSortMethod('getManagementPanelGroupOrder')
|
||||||
|
->execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -13,6 +13,10 @@ final class DiffusionRepositoryStagingManagementPanel
|
||||||
return 700;
|
return 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getManagementPanelGroupKey() {
|
||||||
|
return DiffusionRepositoryManagementBuildsPanelGroup::PANELGROUPKEY;
|
||||||
|
}
|
||||||
|
|
||||||
public function shouldEnableForRepository(
|
public function shouldEnableForRepository(
|
||||||
PhabricatorRepository $repository) {
|
PhabricatorRepository $repository) {
|
||||||
return $repository->isGit();
|
return $repository->isGit();
|
||||||
|
|
|
@ -13,6 +13,10 @@ final class DiffusionRepositorySymbolsManagementPanel
|
||||||
return 900;
|
return 900;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getManagementPanelGroupKey() {
|
||||||
|
return DiffusionRepositoryManagementIntegrationsPanelGroup::PANELGROUPKEY;
|
||||||
|
}
|
||||||
|
|
||||||
public function getManagementPanelIcon() {
|
public function getManagementPanelIcon() {
|
||||||
$repository = $this->getRepository();
|
$repository = $this->getRepository();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue