1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 08:42:41 +01:00

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
This commit is contained in:
Chad Little 2017-05-23 11:27:21 -07:00
parent cd136a6af8
commit 1a75ae2405
15 changed files with 162 additions and 148 deletions

View file

@ -83,11 +83,11 @@ final class DiffusionRepositoryManagePanelsController
->setTag('a') ->setTag('a')
->setText(pht('View Repository')) ->setText(pht('View Repository'))
->setHref($repository->getURI()) ->setHref($repository->getURI())
->setIcon('fa-code')); ->setIcon('fa-code')
->setColor(PHUIButtonView::GREEN));
$view = id(new PHUITwoColumnView()) $view = id(new PHUITwoColumnView())
->setHeader($header) ->setHeader($header)
->setNavigation($nav)
->setMainColumn($content); ->setMainColumn($content);
$curtain = $panel->buildManagementPanelCurtain(); $curtain = $panel->buildManagementPanelCurtain();
@ -98,6 +98,7 @@ final class DiffusionRepositoryManagePanelsController
return $this->newPage() return $this->newPage()
->setTitle($title) ->setTitle($title)
->setCrumbs($crumbs) ->setCrumbs($crumbs)
->setNavigation($nav)
->appendChild($view); ->appendChild($view);
} }
@ -112,6 +113,12 @@ final class DiffusionRepositoryManagePanelsController
$nav = id(new AphrontSideNavFilterView()) $nav = id(new AphrontSideNavFilterView())
->setBaseURI($base_uri); ->setBaseURI($base_uri);
$item = id(new PHUIListItemView())
->setName(pht('manage'))
->setType(PHUIListItemView::TYPE_LABEL);
$nav->addMenuItem($item);
foreach ($panels as $panel) { foreach ($panels as $panel) {
$key = $panel->getManagementPanelKey(); $key = $panel->getManagementPanelKey();
$label = $panel->getManagementPanelLabel(); $label = $panel->getManagementPanelLabel();

View file

@ -37,9 +37,10 @@ final class DiffusionRepositoryActionsManagementPanel
); );
} }
protected function buildManagementPanelActions() { public function buildManagementPanelCurtain() {
$repository = $this->getRepository(); $repository = $this->getRepository();
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$action_list = $this->getNewActionList();
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
@ -48,14 +49,15 @@ final class DiffusionRepositoryActionsManagementPanel
$actions_uri = $this->getEditPageURI(); $actions_uri = $this->getEditPageURI();
return array( $action_list->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setIcon('fa-pencil') ->setIcon('fa-pencil')
->setName(pht('Edit Actions')) ->setName(pht('Edit Actions'))
->setHref($actions_uri) ->setHref($actions_uri)
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(!$can_edit), ->setWorkflow(!$can_edit));
);
return $this->getNewCurtainView($action_list);
} }
public function buildManagementPanelContent() { public function buildManagementPanelContent() {
@ -63,8 +65,7 @@ final class DiffusionRepositoryActionsManagementPanel
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$view = id(new PHUIPropertyListView()) $view = id(new PHUIPropertyListView())
->setViewer($viewer) ->setViewer($viewer);
->setActionList($this->newActions());
$notify = $repository->getDetail('herald-disabled') $notify = $repository->getDetail('herald-disabled')
? pht('Off') ? pht('Off')

View file

@ -46,9 +46,10 @@ final class DiffusionRepositoryAutomationManagementPanel
return 'fa-truck'; return 'fa-truck';
} }
protected function buildManagementPanelActions() { public function buildManagementPanelCurtain() {
$repository = $this->getRepository(); $repository = $this->getRepository();
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$action_list = $this->getNewActionList();
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
@ -60,20 +61,23 @@ final class DiffusionRepositoryAutomationManagementPanel
$automation_uri = $this->getEditPageURI(); $automation_uri = $this->getEditPageURI();
$test_uri = $repository->getPathURI('edit/testautomation/'); $test_uri = $repository->getPathURI('edit/testautomation/');
return array( $action_list->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setIcon('fa-pencil') ->setIcon('fa-pencil')
->setName(pht('Edit Automation')) ->setName(pht('Edit Automation'))
->setHref($automation_uri) ->setHref($automation_uri)
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(!$can_edit), ->setWorkflow(!$can_edit));
$action_list->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setIcon('fa-gamepad') ->setIcon('fa-gamepad')
->setName(pht('Test Configuration')) ->setName(pht('Test Configuration'))
->setWorkflow(true) ->setWorkflow(true)
->setDisabled(!$can_test) ->setDisabled(!$can_test)
->setHref($test_uri), ->setHref($test_uri));
);
return $this->getNewCurtainView($action_list);
} }
public function buildManagementPanelContent() { public function buildManagementPanelContent() {
@ -81,8 +85,7 @@ final class DiffusionRepositoryAutomationManagementPanel
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$view = id(new PHUIPropertyListView()) $view = id(new PHUIPropertyListView())
->setViewer($viewer) ->setViewer($viewer);
->setActionList($this->newActions());
$blueprint_phids = $repository->getAutomationBlueprintPHIDs(); $blueprint_phids = $repository->getAutomationBlueprintPHIDs();
if (!$blueprint_phids) { if (!$blueprint_phids) {

View file

@ -33,9 +33,10 @@ final class DiffusionRepositoryBasicsManagementPanel
); );
} }
protected function buildManagementPanelActions() { public function buildManagementPanelCurtain() {
$repository = $this->getRepository(); $repository = $this->getRepository();
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$action_list = $this->getNewActionList();
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
@ -67,38 +68,47 @@ final class DiffusionRepositoryBasicsManagementPanel
$can_dangerous = ($can_edit && $repository->canAllowDangerousChanges()); $can_dangerous = ($can_edit && $repository->canAllowDangerousChanges());
} }
return array( $action_list->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setIcon('fa-pencil') ->setIcon('fa-pencil')
->setName(pht('Edit Basic Information')) ->setName(pht('Edit Basic Information'))
->setHref($edit_uri) ->setHref($edit_uri)
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(!$can_edit), ->setWorkflow(!$can_edit));
$action_list->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setIcon('fa-text-width') ->setIcon('fa-text-width')
->setName(pht('Edit Text Encoding')) ->setName(pht('Edit Text Encoding'))
->setHref($encoding_uri) ->setHref($encoding_uri)
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(!$can_edit), ->setWorkflow(!$can_edit));
$action_list->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setIcon($dangerous_icon) ->setIcon($dangerous_icon)
->setName($dangerous_name) ->setName($dangerous_name)
->setHref($dangerous_uri) ->setHref($dangerous_uri)
->setDisabled(!$can_dangerous) ->setDisabled(!$can_dangerous)
->setWorkflow(true), ->setWorkflow(true));
$action_list->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setHref($activate_uri) ->setHref($activate_uri)
->setIcon($activate_icon) ->setIcon($activate_icon)
->setName($activate_label) ->setName($activate_label)
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(true), ->setWorkflow(true));
$action_list->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setName(pht('Delete Repository')) ->setName(pht('Delete Repository'))
->setIcon('fa-times') ->setIcon('fa-times')
->setHref($delete_uri) ->setHref($delete_uri)
->setDisabled(true) ->setDisabled(true)
->setWorkflow(true), ->setWorkflow(true));
);
return $this->getNewCurtainView($action_list);
} }
public function buildManagementPanelContent() { public function buildManagementPanelContent() {
@ -108,6 +118,7 @@ final class DiffusionRepositoryBasicsManagementPanel
$repository = $this->getRepository(); $repository = $this->getRepository();
$is_new = $repository->isNewlyInitialized(); $is_new = $repository->isNewlyInitialized();
$info_view = null;
if ($is_new) { if ($is_new) {
$messages = array(); $messages = array();
@ -131,8 +142,6 @@ final class DiffusionRepositoryBasicsManagementPanel
$info_view = id(new PHUIInfoView()) $info_view = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_NOTICE) ->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
->setErrors($messages); ->setErrors($messages);
$basics->setInfoView($info_view);
} }
$result[] = $basics; $result[] = $basics;
@ -142,7 +151,7 @@ final class DiffusionRepositoryBasicsManagementPanel
$result[] = $this->newBox(pht('Description'), $description); $result[] = $this->newBox(pht('Description'), $description);
} }
return $result; return array($info_view, $result);
} }
private function buildBasics() { private function buildBasics() {
@ -150,8 +159,7 @@ final class DiffusionRepositoryBasicsManagementPanel
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$view = id(new PHUIPropertyListView()) $view = id(new PHUIPropertyListView())
->setViewer($viewer) ->setViewer($viewer);
->setActionList($this->newActions());
$name = $repository->getName(); $name = $repository->getName();
$view->addProperty(pht('Name'), $name); $view->addProperty(pht('Name'), $name);

View file

@ -41,9 +41,10 @@ final class DiffusionRepositoryBranchesManagementPanel
); );
} }
protected function buildManagementPanelActions() { public function buildManagementPanelCurtain() {
$repository = $this->getRepository(); $repository = $this->getRepository();
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$action_list = $this->getNewActionList();
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
@ -52,14 +53,15 @@ final class DiffusionRepositoryBranchesManagementPanel
$branches_uri = $this->getEditPageURI(); $branches_uri = $this->getEditPageURI();
return array( $action_list->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setIcon('fa-pencil') ->setIcon('fa-pencil')
->setName(pht('Edit Branches')) ->setName(pht('Edit Branches'))
->setHref($branches_uri) ->setHref($branches_uri)
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(!$can_edit), ->setWorkflow(!$can_edit));
);
return $this->getNewCurtainView($action_list);
} }
public function buildManagementPanelContent() { public function buildManagementPanelContent() {
@ -67,8 +69,7 @@ final class DiffusionRepositoryBranchesManagementPanel
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$view = id(new PHUIPropertyListView()) $view = id(new PHUIPropertyListView())
->setViewer($viewer) ->setViewer($viewer);
->setActionList($this->newActions());
$default_branch = nonempty( $default_branch = nonempty(
$repository->getHumanReadableDetail('default-branch'), $repository->getHumanReadableDetail('default-branch'),

View file

@ -21,6 +21,10 @@ final class DiffusionRepositoryDocumentationManagementPanel
return null; return null;
} }
public function buildManagementPanelCurtain() {
return null;
}
public function getPanelNavigationURI() { public function getPanelNavigationURI() {
return PhabricatorEnv::getDoclink( return PhabricatorEnv::getDoclink(
'Diffusion User Guide: Managing Repositories'); 'Diffusion User Guide: Managing Repositories');

View file

@ -21,5 +21,8 @@ final class DiffusionRepositoryHistoryManagementPanel
return $this->newTimeline(); return $this->newTimeline();
} }
public function buildManagementPanelCurtain() {
return null;
}
} }

View file

@ -37,6 +37,7 @@ abstract class DiffusionRepositoryManagementPanel
abstract public function getManagementPanelLabel(); abstract public function getManagementPanelLabel();
abstract public function getManagementPanelOrder(); abstract public function getManagementPanelOrder();
abstract public function buildManagementPanelContent(); abstract public function buildManagementPanelContent();
abstract public function buildManagementPanelCurtain();
public function getManagementPanelIcon() { public function getManagementPanelIcon() {
return 'fa-pencil'; return 'fa-pencil';
@ -51,41 +52,20 @@ abstract class DiffusionRepositoryManagementPanel
return true; return true;
} }
final protected function newActions() { public function getNewActionList() {
$actions = $this->buildManagementPanelActions();
if (!$actions) {
return null;
}
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$action_id = celerity_generate_unique_node_id();
$action_list = id(new PhabricatorActionListView()) return id(new PhabricatorActionListView())
->setViewer($viewer);
foreach ($actions as $action) {
$action_list->addAction($action);
}
return $action_list;
}
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;
}
$viewer = $this->getViewer();
$curtain = id(new PHUICurtainView())
->setViewer($viewer) ->setViewer($viewer)
->setActionList($actions); ->setID($action_id);
}
return $curtain; public function getNewCurtainView(PhabricatorActionListView $action_list) {
$viewer = $this->getViewer();
return id(new PHUICurtainView())
->setViewer($viewer)
->setActionList($action_list);
} }
public static function getAllPanels() { public static function getAllPanels() {

View file

@ -54,9 +54,10 @@ final class DiffusionRepositoryPoliciesManagementPanel
); );
} }
protected function buildManagementPanelActions() { public function buildManagementPanelCurtain() {
$repository = $this->getRepository(); $repository = $this->getRepository();
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$action_list = $this->getNewActionList();
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
@ -65,14 +66,15 @@ final class DiffusionRepositoryPoliciesManagementPanel
$edit_uri = $this->getEditPageURI(); $edit_uri = $this->getEditPageURI();
return array( $action_list->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setIcon('fa-pencil') ->setIcon('fa-pencil')
->setName(pht('Edit Policies')) ->setName(pht('Edit Policies'))
->setHref($edit_uri) ->setHref($edit_uri)
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(!$can_edit), ->setWorkflow(!$can_edit));
);
return $this->getNewCurtainView($action_list);
} }
public function buildManagementPanelContent() { public function buildManagementPanelContent() {
@ -80,8 +82,7 @@ final class DiffusionRepositoryPoliciesManagementPanel
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$view = id(new PHUIPropertyListView()) $view = id(new PHUIPropertyListView())
->setViewer($viewer) ->setViewer($viewer);
->setActionList($this->newActions());
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
$viewer, $viewer,

View file

@ -37,9 +37,10 @@ final class DiffusionRepositoryStagingManagementPanel
); );
} }
protected function buildManagementPanelActions() { public function buildManagementPanelCurtain() {
$repository = $this->getRepository(); $repository = $this->getRepository();
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$action_list = $this->getNewActionList();
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
@ -48,14 +49,15 @@ final class DiffusionRepositoryStagingManagementPanel
$staging_uri = $this->getEditPageURI(); $staging_uri = $this->getEditPageURI();
return array( $action_list->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setIcon('fa-pencil') ->setIcon('fa-pencil')
->setName(pht('Edit Staging')) ->setName(pht('Edit Staging'))
->setHref($staging_uri) ->setHref($staging_uri)
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(!$can_edit), ->setWorkflow(!$can_edit));
);
return $this->getNewCurtainView($action_list);
} }
public function buildManagementPanelContent() { public function buildManagementPanelContent() {
@ -63,8 +65,7 @@ final class DiffusionRepositoryStagingManagementPanel
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$view = id(new PHUIPropertyListView()) $view = id(new PHUIPropertyListView())
->setViewer($viewer) ->setViewer($viewer);
->setActionList($this->newActions());
$staging_uri = $repository->getStagingURI(); $staging_uri = $repository->getStagingURI();
if (!$staging_uri) { if (!$staging_uri) {

View file

@ -28,9 +28,10 @@ final class DiffusionRepositoryStatusManagementPanel
return 'fa-check grey'; return 'fa-check grey';
} }
protected function buildManagementPanelActions() { public function buildManagementPanelCurtain() {
$repository = $this->getRepository(); $repository = $this->getRepository();
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$action_list = $this->getNewActionList();
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
@ -39,14 +40,15 @@ final class DiffusionRepositoryStatusManagementPanel
$update_uri = $repository->getPathURI('edit/update/'); $update_uri = $repository->getPathURI('edit/update/');
return array( $action_list->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setIcon('fa-refresh') ->setIcon('fa-refresh')
->setName(pht('Update Now')) ->setName(pht('Update Now'))
->setWorkflow(true) ->setWorkflow(true)
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setHref($update_uri), ->setHref($update_uri));
);
return $this->getNewCurtainView($action_list);
} }
public function buildManagementPanelContent() { public function buildManagementPanelContent() {
@ -54,8 +56,7 @@ final class DiffusionRepositoryStatusManagementPanel
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$view = id(new PHUIPropertyListView()) $view = id(new PHUIPropertyListView())
->setViewer($viewer) ->setViewer($viewer);
->setActionList($this->newActions());
$view->addProperty( $view->addProperty(
pht('Update Frequency'), pht('Update Frequency'),

View file

@ -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() { public function buildManagementPanelContent() {
return array( return array(
$this->buildStorageStatusPanel(), $this->buildStorageStatusPanel(),
@ -55,13 +71,9 @@ final class DiffusionRepositoryStorageManagementPanel
$view->addProperty(pht('Storage Path'), $storage_path); $view->addProperty(pht('Storage Path'), $storage_path);
$view->addProperty(pht('Storage Cluster'), $storage_service); $view->addProperty(pht('Storage Cluster'), $storage_service);
$header = id(new PHUIHeaderView()) $box = $this->newBox(pht('Storage'), null);
->setHeader(pht('Storage')); $box->addPropertyList($view);
return $box;
return id(new PHUIObjectBoxView())
->setHeader($header)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
->addPropertyList($view);
} }
private function buildClusterStatusPanel() { private function buildClusterStatusPanel() {
@ -231,21 +243,9 @@ final class DiffusionRepositoryStorageManagementPanel
'date', 'date',
)); ));
$doc_href = PhabricatorEnv::getDoclink('Cluster: Repositories'); $box = $this->newBox(pht('Cluster Status'), null);
$box->setTable($table);
$header = id(new PHUIHeaderView()) return $box;
->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);
} }
} }

View file

@ -36,9 +36,10 @@ final class DiffusionRepositorySubversionManagementPanel
); );
} }
protected function buildManagementPanelActions() { public function buildManagementPanelCurtain() {
$repository = $this->getRepository(); $repository = $this->getRepository();
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$action_list = $this->getNewActionList();
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
@ -47,14 +48,15 @@ final class DiffusionRepositorySubversionManagementPanel
$subversion_uri = $this->getEditPageURI(); $subversion_uri = $this->getEditPageURI();
return array( $action_list->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setIcon('fa-pencil') ->setIcon('fa-pencil')
->setName(pht('Edit Properties')) ->setName(pht('Edit Properties'))
->setHref($subversion_uri) ->setHref($subversion_uri)
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(!$can_edit), ->setWorkflow(!$can_edit));
);
return $this->getNewCurtainView($action_list);
} }
public function buildManagementPanelContent() { public function buildManagementPanelContent() {
@ -62,8 +64,7 @@ final class DiffusionRepositorySubversionManagementPanel
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$view = id(new PHUIPropertyListView()) $view = id(new PHUIPropertyListView())
->setViewer($viewer) ->setViewer($viewer);
->setActionList($this->newActions());
$default_branch = nonempty( $default_branch = nonempty(
$repository->getHumanReadableDetail('svn-subpath'), $repository->getHumanReadableDetail('svn-subpath'),

View file

@ -34,9 +34,10 @@ final class DiffusionRepositorySymbolsManagementPanel
); );
} }
protected function buildManagementPanelActions() { public function buildManagementPanelCurtain() {
$repository = $this->getRepository(); $repository = $this->getRepository();
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$action_list = $this->getNewActionList();
$can_edit = PhabricatorPolicyFilter::hasCapability( $can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer, $viewer,
@ -45,14 +46,15 @@ final class DiffusionRepositorySymbolsManagementPanel
$symbols_uri = $this->getEditPageURI(); $symbols_uri = $this->getEditPageURI();
return array( $action_list->addAction(
id(new PhabricatorActionView()) id(new PhabricatorActionView())
->setIcon('fa-pencil') ->setIcon('fa-pencil')
->setName(pht('Edit Symbols')) ->setName(pht('Edit Symbols'))
->setHref($symbols_uri) ->setHref($symbols_uri)
->setDisabled(!$can_edit) ->setDisabled(!$can_edit)
->setWorkflow(!$can_edit), ->setWorkflow(!$can_edit));
);
return $this->getNewCurtainView($action_list);
} }
public function buildManagementPanelContent() { public function buildManagementPanelContent() {
@ -60,8 +62,7 @@ final class DiffusionRepositorySymbolsManagementPanel
$viewer = $this->getViewer(); $viewer = $this->getViewer();
$view = id(new PHUIPropertyListView()) $view = id(new PHUIPropertyListView())
->setViewer($viewer) ->setViewer($viewer);
->setActionList($this->newActions());
$languages = $repository->getSymbolLanguages(); $languages = $repository->getSymbolLanguages();
if ($languages) { if ($languages) {

View file

@ -17,6 +17,35 @@ final class DiffusionRepositoryURIsManagementPanel
return 400; 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() { public function buildManagementPanelContent() {
$repository = $this->getRepository(); $repository = $this->getRepository();
$viewer = $this->getViewer(); $viewer = $this->getViewer();
@ -95,24 +124,6 @@ final class DiffusionRepositoryURIsManagementPanel
null, 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(); $is_new = $repository->isNewlyInitialized();
$messages = array(); $messages = array();
@ -123,11 +134,7 @@ final class DiffusionRepositoryURIsManagementPanel
$host_message = pht('Phabricator is hosting this repository.'); $host_message = pht('Phabricator is hosting this repository.');
} }
$messages[] = array( $messages[] = $host_message;
id(new PHUIIconView())->setIcon('fa-folder'),
' ',
$host_message,
);
} else { } else {
if ($is_new) { if ($is_new) {
$observe_message = pht( $observe_message = pht(
@ -137,22 +144,17 @@ final class DiffusionRepositoryURIsManagementPanel
'This repository is hosted remotely. Phabricator is observing it.'); 'This repository is hosted remotely. Phabricator is observing it.');
} }
$messages[] = array( $messages[] = $observe_message;
id(new PHUIIconView())->setIcon('fa-download'),
' ',
$observe_message,
);
} }
$info_view = id(new PHUIInfoView()) $info_view = id(new PHUIInfoView())
->setSeverity(PHUIInfoView::SEVERITY_NOTICE) ->setSeverity(PHUIInfoView::SEVERITY_NOTICE)
->setErrors($messages); ->setErrors($messages);
return id(new PHUIObjectBoxView()) $box = $this->newBox(pht('Repository URIs'), null);
->setHeader($header) $box->setTable($table);
->setInfoView($info_view)
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) return array($info_view, $box);
->setTable($table);
} }
} }