Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15285828
D19827.id47387.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
10 KB
Referenced Files
None
Subscribers
None
D19827.id47387.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -952,7 +952,12 @@
'DiffusionRepositoryListController' => 'applications/diffusion/controller/DiffusionRepositoryListController.php',
'DiffusionRepositoryManageController' => 'applications/diffusion/controller/DiffusionRepositoryManageController.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',
+ 'DiffusionRepositoryManagementPanelGroup' => 'applications/diffusion/management/DiffusionRepositoryManagementPanelGroup.php',
'DiffusionRepositoryPath' => 'applications/diffusion/data/DiffusionRepositoryPath.php',
'DiffusionRepositoryPoliciesManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryPoliciesManagementPanel.php',
'DiffusionRepositoryProfilePictureController' => 'applications/diffusion/controller/DiffusionRepositoryProfilePictureController.php',
@@ -6335,7 +6340,12 @@
'DiffusionRepositoryListController' => 'DiffusionController',
'DiffusionRepositoryManageController' => 'DiffusionController',
'DiffusionRepositoryManagePanelsController' => 'DiffusionRepositoryManageController',
+ 'DiffusionRepositoryManagementBuildsPanelGroup' => 'DiffusionRepositoryManagementPanelGroup',
+ 'DiffusionRepositoryManagementIntegrationsPanelGroup' => 'DiffusionRepositoryManagementPanelGroup',
+ 'DiffusionRepositoryManagementMainPanelGroup' => 'DiffusionRepositoryManagementPanelGroup',
+ 'DiffusionRepositoryManagementOtherPanelGroup' => 'DiffusionRepositoryManagementPanelGroup',
'DiffusionRepositoryManagementPanel' => 'Phobject',
+ 'DiffusionRepositoryManagementPanelGroup' => 'Phobject',
'DiffusionRepositoryPath' => 'Phobject',
'DiffusionRepositoryPoliciesManagementPanel' => 'DiffusionRepositoryManagementPanel',
'DiffusionRepositoryProfilePictureController' => 'DiffusionController',
diff --git a/src/applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php b/src/applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php
--- a/src/applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php
+++ b/src/applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php
@@ -93,20 +93,45 @@
$nav = id(new AphrontSideNavFilterView())
->setBaseURI($base_uri);
- foreach ($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);
+ $groups = DiffusionRepositoryManagementPanelGroup::getAllPanelGroups();
+ $panel_groups = mgroup($panels, 'getManagementPanelGroupKey');
+ $other_key = DiffusionRepositoryManagementOtherPanelGroup::PANELGROUPKEY;
+
+ foreach ($groups as $group_key => $group) {
+ // If this is the "Other" group, include everything else that isn't in
+ // some actual group.
+ if ($group_key === $other_key) {
+ $group_panels = array_mergev($panel_groups);
+ $panel_groups = array();
+ } else {
+ $group_panels = idx($panel_groups, $group_key);
+ unset($panel_groups[$group_key]);
+ }
+
+ 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);
diff --git a/src/applications/diffusion/management/DiffusionRepositoryAutomationManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryAutomationManagementPanel.php
--- a/src/applications/diffusion/management/DiffusionRepositoryAutomationManagementPanel.php
+++ b/src/applications/diffusion/management/DiffusionRepositoryAutomationManagementPanel.php
@@ -13,6 +13,10 @@
return 800;
}
+ public function getManagementPanelGroupKey() {
+ return DiffusionRepositoryManagementBuildsPanelGroup::PANELGROUPKEY;
+ }
+
public function shouldEnableForRepository(
PhabricatorRepository $repository) {
return $repository->isGit();
diff --git a/src/applications/diffusion/management/DiffusionRepositoryManagementBuildsPanelGroup.php b/src/applications/diffusion/management/DiffusionRepositoryManagementBuildsPanelGroup.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/management/DiffusionRepositoryManagementBuildsPanelGroup.php
@@ -0,0 +1,16 @@
+<?php
+
+final class DiffusionRepositoryManagementBuildsPanelGroup
+ extends DiffusionRepositoryManagementPanelGroup {
+
+ const PANELGROUPKEY = 'builds';
+
+ public function getManagementPanelGroupLabel() {
+ return pht('Builds');
+ }
+
+ public function getManagementPanelGroupOrder() {
+ return 2000;
+ }
+
+}
diff --git a/src/applications/diffusion/management/DiffusionRepositoryManagementIntegrationsPanelGroup.php b/src/applications/diffusion/management/DiffusionRepositoryManagementIntegrationsPanelGroup.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/management/DiffusionRepositoryManagementIntegrationsPanelGroup.php
@@ -0,0 +1,16 @@
+<?php
+
+final class DiffusionRepositoryManagementIntegrationsPanelGroup
+ extends DiffusionRepositoryManagementPanelGroup {
+
+ const PANELGROUPKEY = 'integrations';
+
+ public function getManagementPanelGroupLabel() {
+ return pht('Integrations');
+ }
+
+ public function getManagementPanelGroupOrder() {
+ return 4000;
+ }
+
+}
diff --git a/src/applications/diffusion/management/DiffusionRepositoryManagementMainPanelGroup.php b/src/applications/diffusion/management/DiffusionRepositoryManagementMainPanelGroup.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/management/DiffusionRepositoryManagementMainPanelGroup.php
@@ -0,0 +1,16 @@
+<?php
+
+final class DiffusionRepositoryManagementMainPanelGroup
+ extends DiffusionRepositoryManagementPanelGroup {
+
+ const PANELGROUPKEY = 'main';
+
+ public function getManagementPanelGroupLabel() {
+ return null;
+ }
+
+ public function getManagementPanelGroupOrder() {
+ return 1000;
+ }
+
+}
diff --git a/src/applications/diffusion/management/DiffusionRepositoryManagementOtherPanelGroup.php b/src/applications/diffusion/management/DiffusionRepositoryManagementOtherPanelGroup.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/management/DiffusionRepositoryManagementOtherPanelGroup.php
@@ -0,0 +1,16 @@
+<?php
+
+final class DiffusionRepositoryManagementOtherPanelGroup
+ extends DiffusionRepositoryManagementPanelGroup {
+
+ const PANELGROUPKEY = 'other';
+
+ public function getManagementPanelGroupLabel() {
+ return pht('Other');
+ }
+
+ public function getManagementPanelGroupOrder() {
+ return 9999;
+ }
+
+}
diff --git a/src/applications/diffusion/management/DiffusionRepositoryManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryManagementPanel.php
--- a/src/applications/diffusion/management/DiffusionRepositoryManagementPanel.php
+++ b/src/applications/diffusion/management/DiffusionRepositoryManagementPanel.php
@@ -47,8 +47,8 @@
return 'fa-pencil';
}
- protected function buildManagementPanelActions() {
- return array();
+ public function getManagementPanelGroupKey() {
+ return DiffusionRepositoryManagementMainPanelGroup::PANELGROUPKEY;
}
public function shouldEnableForRepository(
diff --git a/src/applications/diffusion/management/DiffusionRepositoryManagementPanelGroup.php b/src/applications/diffusion/management/DiffusionRepositoryManagementPanelGroup.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/management/DiffusionRepositoryManagementPanelGroup.php
@@ -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();
+ }
+
+}
diff --git a/src/applications/diffusion/management/DiffusionRepositoryStagingManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryStagingManagementPanel.php
--- a/src/applications/diffusion/management/DiffusionRepositoryStagingManagementPanel.php
+++ b/src/applications/diffusion/management/DiffusionRepositoryStagingManagementPanel.php
@@ -13,6 +13,10 @@
return 700;
}
+ public function getManagementPanelGroupKey() {
+ return DiffusionRepositoryManagementBuildsPanelGroup::PANELGROUPKEY;
+ }
+
public function shouldEnableForRepository(
PhabricatorRepository $repository) {
return $repository->isGit();
diff --git a/src/applications/diffusion/management/DiffusionRepositorySymbolsManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositorySymbolsManagementPanel.php
--- a/src/applications/diffusion/management/DiffusionRepositorySymbolsManagementPanel.php
+++ b/src/applications/diffusion/management/DiffusionRepositorySymbolsManagementPanel.php
@@ -13,6 +13,10 @@
return 900;
}
+ public function getManagementPanelGroupKey() {
+ return DiffusionRepositoryManagementIntegrationsPanelGroup::PANELGROUPKEY;
+ }
+
public function getManagementPanelIcon() {
$repository = $this->getRepository();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 5, 4:16 PM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7225988
Default Alt Text
D19827.id47387.diff (10 KB)
Attached To
Mode
D19827: Separate the repository management UI into sections
Attached
Detach File
Event Timeline
Log In to Comment