From 1a75ae24056b76ce80d320c37bd28360dece3c23 Mon Sep 17 00:00:00 2001 From: Chad Little Date: Tue, 23 May 2017 11:27:21 -0700 Subject: [PATCH] Modernize Diffusion Create with sidenav, curtain Summary: This moves the navigation to a standard sidebar, and moves all actions to the curtain. Also pulled out info view when available for cleaner UI. Test Plan: Create a git, svn, hg test repository and verify each page in the sidebar renders as expected. {F4973792} Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D18003 --- ...fusionRepositoryManagePanelsController.php | 11 ++- ...fusionRepositoryActionsManagementPanel.php | 13 ++-- ...ionRepositoryAutomationManagementPanel.php | 17 +++-- ...ffusionRepositoryBasicsManagementPanel.php | 34 ++++++---- ...usionRepositoryBranchesManagementPanel.php | 13 ++-- ...RepositoryDocumentationManagementPanel.php | 4 ++ ...fusionRepositoryHistoryManagementPanel.php | 3 + .../DiffusionRepositoryManagementPanel.php | 38 +++-------- ...usionRepositoryPoliciesManagementPanel.php | 13 ++-- ...fusionRepositoryStagingManagementPanel.php | 13 ++-- ...ffusionRepositoryStatusManagementPanel.php | 13 ++-- ...fusionRepositoryStorageManagementPanel.php | 44 ++++++------ ...ionRepositorySubversionManagementPanel.php | 13 ++-- ...fusionRepositorySymbolsManagementPanel.php | 13 ++-- ...DiffusionRepositoryURIsManagementPanel.php | 68 ++++++++++--------- 15 files changed, 162 insertions(+), 148 deletions(-) diff --git a/src/applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php b/src/applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php index 22c03145e0..12faa6799d 100644 --- a/src/applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php +++ b/src/applications/diffusion/controller/DiffusionRepositoryManagePanelsController.php @@ -83,11 +83,11 @@ final class DiffusionRepositoryManagePanelsController ->setTag('a') ->setText(pht('View Repository')) ->setHref($repository->getURI()) - ->setIcon('fa-code')); + ->setIcon('fa-code') + ->setColor(PHUIButtonView::GREEN)); $view = id(new PHUITwoColumnView()) ->setHeader($header) - ->setNavigation($nav) ->setMainColumn($content); $curtain = $panel->buildManagementPanelCurtain(); @@ -98,6 +98,7 @@ final class DiffusionRepositoryManagePanelsController return $this->newPage() ->setTitle($title) ->setCrumbs($crumbs) + ->setNavigation($nav) ->appendChild($view); } @@ -112,6 +113,12 @@ final class DiffusionRepositoryManagePanelsController $nav = id(new AphrontSideNavFilterView()) ->setBaseURI($base_uri); + $item = id(new PHUIListItemView()) + ->setName(pht('manage')) + ->setType(PHUIListItemView::TYPE_LABEL); + + $nav->addMenuItem($item); + foreach ($panels as $panel) { $key = $panel->getManagementPanelKey(); $label = $panel->getManagementPanelLabel(); diff --git a/src/applications/diffusion/management/DiffusionRepositoryActionsManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryActionsManagementPanel.php index 1f47a68de3..83697e52e3 100644 --- a/src/applications/diffusion/management/DiffusionRepositoryActionsManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositoryActionsManagementPanel.php @@ -37,9 +37,10 @@ final class DiffusionRepositoryActionsManagementPanel ); } - protected function buildManagementPanelActions() { + public function buildManagementPanelCurtain() { $repository = $this->getRepository(); $viewer = $this->getViewer(); + $action_list = $this->getNewActionList(); $can_edit = PhabricatorPolicyFilter::hasCapability( $viewer, @@ -48,14 +49,15 @@ final class DiffusionRepositoryActionsManagementPanel $actions_uri = $this->getEditPageURI(); - return array( + $action_list->addAction( id(new PhabricatorActionView()) ->setIcon('fa-pencil') ->setName(pht('Edit Actions')) ->setHref($actions_uri) ->setDisabled(!$can_edit) - ->setWorkflow(!$can_edit), - ); + ->setWorkflow(!$can_edit)); + + return $this->getNewCurtainView($action_list); } public function buildManagementPanelContent() { @@ -63,8 +65,7 @@ final class DiffusionRepositoryActionsManagementPanel $viewer = $this->getViewer(); $view = id(new PHUIPropertyListView()) - ->setViewer($viewer) - ->setActionList($this->newActions()); + ->setViewer($viewer); $notify = $repository->getDetail('herald-disabled') ? pht('Off') diff --git a/src/applications/diffusion/management/DiffusionRepositoryAutomationManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryAutomationManagementPanel.php index 14182a0444..b37aa05ecf 100644 --- a/src/applications/diffusion/management/DiffusionRepositoryAutomationManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositoryAutomationManagementPanel.php @@ -46,9 +46,10 @@ final class DiffusionRepositoryAutomationManagementPanel return 'fa-truck'; } - protected function buildManagementPanelActions() { + public function buildManagementPanelCurtain() { $repository = $this->getRepository(); $viewer = $this->getViewer(); + $action_list = $this->getNewActionList(); $can_edit = PhabricatorPolicyFilter::hasCapability( $viewer, @@ -60,20 +61,23 @@ final class DiffusionRepositoryAutomationManagementPanel $automation_uri = $this->getEditPageURI(); $test_uri = $repository->getPathURI('edit/testautomation/'); - return array( + $action_list->addAction( id(new PhabricatorActionView()) ->setIcon('fa-pencil') ->setName(pht('Edit Automation')) ->setHref($automation_uri) ->setDisabled(!$can_edit) - ->setWorkflow(!$can_edit), + ->setWorkflow(!$can_edit)); + + $action_list->addAction( id(new PhabricatorActionView()) ->setIcon('fa-gamepad') ->setName(pht('Test Configuration')) ->setWorkflow(true) ->setDisabled(!$can_test) - ->setHref($test_uri), - ); + ->setHref($test_uri)); + + return $this->getNewCurtainView($action_list); } public function buildManagementPanelContent() { @@ -81,8 +85,7 @@ final class DiffusionRepositoryAutomationManagementPanel $viewer = $this->getViewer(); $view = id(new PHUIPropertyListView()) - ->setViewer($viewer) - ->setActionList($this->newActions()); + ->setViewer($viewer); $blueprint_phids = $repository->getAutomationBlueprintPHIDs(); if (!$blueprint_phids) { diff --git a/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php index 45c2ca142a..a5e09e40d3 100644 --- a/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php @@ -33,9 +33,10 @@ final class DiffusionRepositoryBasicsManagementPanel ); } - protected function buildManagementPanelActions() { + public function buildManagementPanelCurtain() { $repository = $this->getRepository(); $viewer = $this->getViewer(); + $action_list = $this->getNewActionList(); $can_edit = PhabricatorPolicyFilter::hasCapability( $viewer, @@ -67,38 +68,47 @@ final class DiffusionRepositoryBasicsManagementPanel $can_dangerous = ($can_edit && $repository->canAllowDangerousChanges()); } - return array( + $action_list->addAction( id(new PhabricatorActionView()) ->setIcon('fa-pencil') ->setName(pht('Edit Basic Information')) ->setHref($edit_uri) ->setDisabled(!$can_edit) - ->setWorkflow(!$can_edit), + ->setWorkflow(!$can_edit)); + + $action_list->addAction( id(new PhabricatorActionView()) ->setIcon('fa-text-width') ->setName(pht('Edit Text Encoding')) ->setHref($encoding_uri) ->setDisabled(!$can_edit) - ->setWorkflow(!$can_edit), + ->setWorkflow(!$can_edit)); + + $action_list->addAction( id(new PhabricatorActionView()) ->setIcon($dangerous_icon) ->setName($dangerous_name) ->setHref($dangerous_uri) ->setDisabled(!$can_dangerous) - ->setWorkflow(true), + ->setWorkflow(true)); + + $action_list->addAction( id(new PhabricatorActionView()) ->setHref($activate_uri) ->setIcon($activate_icon) ->setName($activate_label) ->setDisabled(!$can_edit) - ->setWorkflow(true), + ->setWorkflow(true)); + + $action_list->addAction( id(new PhabricatorActionView()) ->setName(pht('Delete Repository')) ->setIcon('fa-times') ->setHref($delete_uri) ->setDisabled(true) - ->setWorkflow(true), - ); + ->setWorkflow(true)); + + return $this->getNewCurtainView($action_list); } public function buildManagementPanelContent() { @@ -108,6 +118,7 @@ final class DiffusionRepositoryBasicsManagementPanel $repository = $this->getRepository(); $is_new = $repository->isNewlyInitialized(); + $info_view = null; if ($is_new) { $messages = array(); @@ -131,8 +142,6 @@ final class DiffusionRepositoryBasicsManagementPanel $info_view = id(new PHUIInfoView()) ->setSeverity(PHUIInfoView::SEVERITY_NOTICE) ->setErrors($messages); - - $basics->setInfoView($info_view); } $result[] = $basics; @@ -142,7 +151,7 @@ final class DiffusionRepositoryBasicsManagementPanel $result[] = $this->newBox(pht('Description'), $description); } - return $result; + return array($info_view, $result); } private function buildBasics() { @@ -150,8 +159,7 @@ final class DiffusionRepositoryBasicsManagementPanel $viewer = $this->getViewer(); $view = id(new PHUIPropertyListView()) - ->setViewer($viewer) - ->setActionList($this->newActions()); + ->setViewer($viewer); $name = $repository->getName(); $view->addProperty(pht('Name'), $name); diff --git a/src/applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php index b3e7926cfc..aa2bb49ccb 100644 --- a/src/applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php @@ -41,9 +41,10 @@ final class DiffusionRepositoryBranchesManagementPanel ); } - protected function buildManagementPanelActions() { + public function buildManagementPanelCurtain() { $repository = $this->getRepository(); $viewer = $this->getViewer(); + $action_list = $this->getNewActionList(); $can_edit = PhabricatorPolicyFilter::hasCapability( $viewer, @@ -52,14 +53,15 @@ final class DiffusionRepositoryBranchesManagementPanel $branches_uri = $this->getEditPageURI(); - return array( + $action_list->addAction( id(new PhabricatorActionView()) ->setIcon('fa-pencil') ->setName(pht('Edit Branches')) ->setHref($branches_uri) ->setDisabled(!$can_edit) - ->setWorkflow(!$can_edit), - ); + ->setWorkflow(!$can_edit)); + + return $this->getNewCurtainView($action_list); } public function buildManagementPanelContent() { @@ -67,8 +69,7 @@ final class DiffusionRepositoryBranchesManagementPanel $viewer = $this->getViewer(); $view = id(new PHUIPropertyListView()) - ->setViewer($viewer) - ->setActionList($this->newActions()); + ->setViewer($viewer); $default_branch = nonempty( $repository->getHumanReadableDetail('default-branch'), diff --git a/src/applications/diffusion/management/DiffusionRepositoryDocumentationManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryDocumentationManagementPanel.php index ca2c577b38..9d067cd90b 100644 --- a/src/applications/diffusion/management/DiffusionRepositoryDocumentationManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositoryDocumentationManagementPanel.php @@ -21,6 +21,10 @@ final class DiffusionRepositoryDocumentationManagementPanel return null; } + public function buildManagementPanelCurtain() { + return null; + } + public function getPanelNavigationURI() { return PhabricatorEnv::getDoclink( 'Diffusion User Guide: Managing Repositories'); diff --git a/src/applications/diffusion/management/DiffusionRepositoryHistoryManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryHistoryManagementPanel.php index c1a812dca0..4ce2367f20 100644 --- a/src/applications/diffusion/management/DiffusionRepositoryHistoryManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositoryHistoryManagementPanel.php @@ -21,5 +21,8 @@ final class DiffusionRepositoryHistoryManagementPanel return $this->newTimeline(); } + public function buildManagementPanelCurtain() { + return null; + } } diff --git a/src/applications/diffusion/management/DiffusionRepositoryManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryManagementPanel.php index 34047cdb89..0098fe1df9 100644 --- a/src/applications/diffusion/management/DiffusionRepositoryManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositoryManagementPanel.php @@ -37,6 +37,7 @@ abstract class DiffusionRepositoryManagementPanel abstract public function getManagementPanelLabel(); abstract public function getManagementPanelOrder(); abstract public function buildManagementPanelContent(); + abstract public function buildManagementPanelCurtain(); public function getManagementPanelIcon() { return 'fa-pencil'; @@ -51,41 +52,20 @@ abstract class DiffusionRepositoryManagementPanel return true; } - final protected function newActions() { - $actions = $this->buildManagementPanelActions(); - if (!$actions) { - return null; - } - + public function getNewActionList() { $viewer = $this->getViewer(); + $action_id = celerity_generate_unique_node_id(); - $action_list = id(new PhabricatorActionListView()) - ->setViewer($viewer); - - foreach ($actions as $action) { - $action_list->addAction($action); - } - - return $action_list; + return id(new PhabricatorActionListView()) + ->setViewer($viewer) + ->setID($action_id); } - public function buildManagementPanelCurtain() { - // TODO: Delete or fix this, curtains always render in the left gutter - // at the moment. - return null; - - $actions = $this->newActions(); - if (!$actions) { - return null; - } - + public function getNewCurtainView(PhabricatorActionListView $action_list) { $viewer = $this->getViewer(); - - $curtain = id(new PHUICurtainView()) + return id(new PHUICurtainView()) ->setViewer($viewer) - ->setActionList($actions); - - return $curtain; + ->setActionList($action_list); } public static function getAllPanels() { diff --git a/src/applications/diffusion/management/DiffusionRepositoryPoliciesManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryPoliciesManagementPanel.php index 081869fbaa..6b2972e30c 100644 --- a/src/applications/diffusion/management/DiffusionRepositoryPoliciesManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositoryPoliciesManagementPanel.php @@ -54,9 +54,10 @@ final class DiffusionRepositoryPoliciesManagementPanel ); } - protected function buildManagementPanelActions() { + public function buildManagementPanelCurtain() { $repository = $this->getRepository(); $viewer = $this->getViewer(); + $action_list = $this->getNewActionList(); $can_edit = PhabricatorPolicyFilter::hasCapability( $viewer, @@ -65,14 +66,15 @@ final class DiffusionRepositoryPoliciesManagementPanel $edit_uri = $this->getEditPageURI(); - return array( + $action_list->addAction( id(new PhabricatorActionView()) ->setIcon('fa-pencil') ->setName(pht('Edit Policies')) ->setHref($edit_uri) ->setDisabled(!$can_edit) - ->setWorkflow(!$can_edit), - ); + ->setWorkflow(!$can_edit)); + + return $this->getNewCurtainView($action_list); } public function buildManagementPanelContent() { @@ -80,8 +82,7 @@ final class DiffusionRepositoryPoliciesManagementPanel $viewer = $this->getViewer(); $view = id(new PHUIPropertyListView()) - ->setViewer($viewer) - ->setActionList($this->newActions()); + ->setViewer($viewer); $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( $viewer, diff --git a/src/applications/diffusion/management/DiffusionRepositoryStagingManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryStagingManagementPanel.php index 79b716e82a..bab7e72857 100644 --- a/src/applications/diffusion/management/DiffusionRepositoryStagingManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositoryStagingManagementPanel.php @@ -37,9 +37,10 @@ final class DiffusionRepositoryStagingManagementPanel ); } - protected function buildManagementPanelActions() { + public function buildManagementPanelCurtain() { $repository = $this->getRepository(); $viewer = $this->getViewer(); + $action_list = $this->getNewActionList(); $can_edit = PhabricatorPolicyFilter::hasCapability( $viewer, @@ -48,14 +49,15 @@ final class DiffusionRepositoryStagingManagementPanel $staging_uri = $this->getEditPageURI(); - return array( + $action_list->addAction( id(new PhabricatorActionView()) ->setIcon('fa-pencil') ->setName(pht('Edit Staging')) ->setHref($staging_uri) ->setDisabled(!$can_edit) - ->setWorkflow(!$can_edit), - ); + ->setWorkflow(!$can_edit)); + + return $this->getNewCurtainView($action_list); } public function buildManagementPanelContent() { @@ -63,8 +65,7 @@ final class DiffusionRepositoryStagingManagementPanel $viewer = $this->getViewer(); $view = id(new PHUIPropertyListView()) - ->setViewer($viewer) - ->setActionList($this->newActions()); + ->setViewer($viewer); $staging_uri = $repository->getStagingURI(); if (!$staging_uri) { diff --git a/src/applications/diffusion/management/DiffusionRepositoryStatusManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryStatusManagementPanel.php index 324338443d..23b2cd1684 100644 --- a/src/applications/diffusion/management/DiffusionRepositoryStatusManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositoryStatusManagementPanel.php @@ -28,9 +28,10 @@ final class DiffusionRepositoryStatusManagementPanel return 'fa-check grey'; } - protected function buildManagementPanelActions() { + public function buildManagementPanelCurtain() { $repository = $this->getRepository(); $viewer = $this->getViewer(); + $action_list = $this->getNewActionList(); $can_edit = PhabricatorPolicyFilter::hasCapability( $viewer, @@ -39,14 +40,15 @@ final class DiffusionRepositoryStatusManagementPanel $update_uri = $repository->getPathURI('edit/update/'); - return array( + $action_list->addAction( id(new PhabricatorActionView()) ->setIcon('fa-refresh') ->setName(pht('Update Now')) ->setWorkflow(true) ->setDisabled(!$can_edit) - ->setHref($update_uri), - ); + ->setHref($update_uri)); + + return $this->getNewCurtainView($action_list); } public function buildManagementPanelContent() { @@ -54,8 +56,7 @@ final class DiffusionRepositoryStatusManagementPanel $viewer = $this->getViewer(); $view = id(new PHUIPropertyListView()) - ->setViewer($viewer) - ->setActionList($this->newActions()); + ->setViewer($viewer); $view->addProperty( pht('Update Frequency'), diff --git a/src/applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php index 9cf210632d..3d6733d5d3 100644 --- a/src/applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositoryStorageManagementPanel.php @@ -25,6 +25,22 @@ final class DiffusionRepositoryStorageManagementPanel } } + public function buildManagementPanelCurtain() { + $repository = $this->getRepository(); + $viewer = $this->getViewer(); + $action_list = $this->getNewActionList(); + + $doc_href = PhabricatorEnv::getDoclink('Cluster: Repositories'); + + $action_list->addAction( + id(new PhabricatorActionView()) + ->setIcon('fa-book') + ->setHref($doc_href) + ->setName(pht('Cluster Documentation'))); + + return $this->getNewCurtainView($action_list); + } + public function buildManagementPanelContent() { return array( $this->buildStorageStatusPanel(), @@ -55,13 +71,9 @@ final class DiffusionRepositoryStorageManagementPanel $view->addProperty(pht('Storage Path'), $storage_path); $view->addProperty(pht('Storage Cluster'), $storage_service); - $header = id(new PHUIHeaderView()) - ->setHeader(pht('Storage')); - - return id(new PHUIObjectBoxView()) - ->setHeader($header) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) - ->addPropertyList($view); + $box = $this->newBox(pht('Storage'), null); + $box->addPropertyList($view); + return $box; } private function buildClusterStatusPanel() { @@ -231,21 +243,9 @@ final class DiffusionRepositoryStorageManagementPanel 'date', )); - $doc_href = PhabricatorEnv::getDoclink('Cluster: Repositories'); - - $header = id(new PHUIHeaderView()) - ->setHeader(pht('Cluster Status')) - ->addActionLink( - id(new PHUIButtonView()) - ->setIcon('fa-book') - ->setHref($doc_href) - ->setTag('a') - ->setText(pht('Documentation'))); - - return id(new PHUIObjectBoxView()) - ->setHeader($header) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) - ->setTable($table); + $box = $this->newBox(pht('Cluster Status'), null); + $box->setTable($table); + return $box; } } diff --git a/src/applications/diffusion/management/DiffusionRepositorySubversionManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositorySubversionManagementPanel.php index c6b236d5b9..5b9384d195 100644 --- a/src/applications/diffusion/management/DiffusionRepositorySubversionManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositorySubversionManagementPanel.php @@ -36,9 +36,10 @@ final class DiffusionRepositorySubversionManagementPanel ); } - protected function buildManagementPanelActions() { + public function buildManagementPanelCurtain() { $repository = $this->getRepository(); $viewer = $this->getViewer(); + $action_list = $this->getNewActionList(); $can_edit = PhabricatorPolicyFilter::hasCapability( $viewer, @@ -47,14 +48,15 @@ final class DiffusionRepositorySubversionManagementPanel $subversion_uri = $this->getEditPageURI(); - return array( + $action_list->addAction( id(new PhabricatorActionView()) ->setIcon('fa-pencil') ->setName(pht('Edit Properties')) ->setHref($subversion_uri) ->setDisabled(!$can_edit) - ->setWorkflow(!$can_edit), - ); + ->setWorkflow(!$can_edit)); + + return $this->getNewCurtainView($action_list); } public function buildManagementPanelContent() { @@ -62,8 +64,7 @@ final class DiffusionRepositorySubversionManagementPanel $viewer = $this->getViewer(); $view = id(new PHUIPropertyListView()) - ->setViewer($viewer) - ->setActionList($this->newActions()); + ->setViewer($viewer); $default_branch = nonempty( $repository->getHumanReadableDetail('svn-subpath'), diff --git a/src/applications/diffusion/management/DiffusionRepositorySymbolsManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositorySymbolsManagementPanel.php index 996473f4f1..22d8780077 100644 --- a/src/applications/diffusion/management/DiffusionRepositorySymbolsManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositorySymbolsManagementPanel.php @@ -34,9 +34,10 @@ final class DiffusionRepositorySymbolsManagementPanel ); } - protected function buildManagementPanelActions() { + public function buildManagementPanelCurtain() { $repository = $this->getRepository(); $viewer = $this->getViewer(); + $action_list = $this->getNewActionList(); $can_edit = PhabricatorPolicyFilter::hasCapability( $viewer, @@ -45,14 +46,15 @@ final class DiffusionRepositorySymbolsManagementPanel $symbols_uri = $this->getEditPageURI(); - return array( + $action_list->addAction( id(new PhabricatorActionView()) ->setIcon('fa-pencil') ->setName(pht('Edit Symbols')) ->setHref($symbols_uri) ->setDisabled(!$can_edit) - ->setWorkflow(!$can_edit), - ); + ->setWorkflow(!$can_edit)); + + return $this->getNewCurtainView($action_list); } public function buildManagementPanelContent() { @@ -60,8 +62,7 @@ final class DiffusionRepositorySymbolsManagementPanel $viewer = $this->getViewer(); $view = id(new PHUIPropertyListView()) - ->setViewer($viewer) - ->setActionList($this->newActions()); + ->setViewer($viewer); $languages = $repository->getSymbolLanguages(); if ($languages) { diff --git a/src/applications/diffusion/management/DiffusionRepositoryURIsManagementPanel.php b/src/applications/diffusion/management/DiffusionRepositoryURIsManagementPanel.php index 333c2f03c8..4fe9e00475 100644 --- a/src/applications/diffusion/management/DiffusionRepositoryURIsManagementPanel.php +++ b/src/applications/diffusion/management/DiffusionRepositoryURIsManagementPanel.php @@ -17,6 +17,35 @@ final class DiffusionRepositoryURIsManagementPanel return 400; } + public function buildManagementPanelCurtain() { + $repository = $this->getRepository(); + $viewer = $this->getViewer(); + $action_list = $this->getNewActionList(); + + $can_edit = PhabricatorPolicyFilter::hasCapability( + $viewer, + $repository, + PhabricatorPolicyCapability::CAN_EDIT); + + $doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: URIs'); + $add_href = $repository->getPathURI('uri/edit/'); + + $action_list->addAction( + id(new PhabricatorActionView()) + ->setIcon('fa-plus') + ->setHref($add_href) + ->setDisabled(!$can_edit) + ->setName(pht('Add New URI'))); + + $action_list->addAction( + id(new PhabricatorActionView()) + ->setIcon('fa-book') + ->setHref($doc_href) + ->setName(pht('URI Documentation'))); + + return $this->getNewCurtainView($action_list); + } + public function buildManagementPanelContent() { $repository = $this->getRepository(); $viewer = $this->getViewer(); @@ -95,24 +124,6 @@ final class DiffusionRepositoryURIsManagementPanel null, )); - $doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: URIs'); - $add_href = $repository->getPathURI('uri/edit/'); - - $header = id(new PHUIHeaderView()) - ->setHeader(pht('Repository URIs')) - ->addActionLink( - id(new PHUIButtonView()) - ->setIcon('fa-plus') - ->setHref($add_href) - ->setTag('a') - ->setText(pht('Add New URI'))) - ->addActionLink( - id(new PHUIButtonView()) - ->setIcon('fa-book') - ->setHref($doc_href) - ->setTag('a') - ->setText(pht('Documentation'))); - $is_new = $repository->isNewlyInitialized(); $messages = array(); @@ -123,11 +134,7 @@ final class DiffusionRepositoryURIsManagementPanel $host_message = pht('Phabricator is hosting this repository.'); } - $messages[] = array( - id(new PHUIIconView())->setIcon('fa-folder'), - ' ', - $host_message, - ); + $messages[] = $host_message; } else { if ($is_new) { $observe_message = pht( @@ -137,22 +144,17 @@ final class DiffusionRepositoryURIsManagementPanel 'This repository is hosted remotely. Phabricator is observing it.'); } - $messages[] = array( - id(new PHUIIconView())->setIcon('fa-download'), - ' ', - $observe_message, - ); + $messages[] = $observe_message; } $info_view = id(new PHUIInfoView()) ->setSeverity(PHUIInfoView::SEVERITY_NOTICE) ->setErrors($messages); - return id(new PHUIObjectBoxView()) - ->setHeader($header) - ->setInfoView($info_view) - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) - ->setTable($table); + $box = $this->newBox(pht('Repository URIs'), null); + $box->setTable($table); + + return array($info_view, $box); } }