1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52: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')
->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();

View file

@ -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')

View file

@ -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) {

View file

@ -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);

View file

@ -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'),

View file

@ -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');

View file

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

View file

@ -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() {

View file

@ -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,

View file

@ -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) {

View file

@ -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'),

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() {
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;
}
}

View file

@ -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'),

View file

@ -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) {

View file

@ -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);
}
}