mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-20 04:20:55 +01:00
Rough in basics + policies + history repository management panels
Summary: Ref T10748. This is roughly where I'm headed, if it makes some kind of sense? The "Edit" links in sub-sections don't work yet since I haven't built the thing. Probably depends on D15736. Test Plan: Manually navigated to `/manage/`, clicked around. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10748 Differential Revision: https://secure.phabricator.com/D15737
This commit is contained in:
parent
adf42db5ea
commit
e582e9172b
7 changed files with 312 additions and 2 deletions
|
@ -739,6 +739,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionRefTableController' => 'applications/diffusion/controller/DiffusionRefTableController.php',
|
'DiffusionRefTableController' => 'applications/diffusion/controller/DiffusionRefTableController.php',
|
||||||
'DiffusionRefsQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php',
|
'DiffusionRefsQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionRefsQueryConduitAPIMethod.php',
|
||||||
'DiffusionRenameHistoryQuery' => 'applications/diffusion/query/DiffusionRenameHistoryQuery.php',
|
'DiffusionRenameHistoryQuery' => 'applications/diffusion/query/DiffusionRenameHistoryQuery.php',
|
||||||
|
'DiffusionRepositoryBasicsManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryBasicsManagementPanel.php',
|
||||||
'DiffusionRepositoryByIDRemarkupRule' => 'applications/diffusion/remarkup/DiffusionRepositoryByIDRemarkupRule.php',
|
'DiffusionRepositoryByIDRemarkupRule' => 'applications/diffusion/remarkup/DiffusionRepositoryByIDRemarkupRule.php',
|
||||||
'DiffusionRepositoryClusterManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryClusterManagementPanel.php',
|
'DiffusionRepositoryClusterManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryClusterManagementPanel.php',
|
||||||
'DiffusionRepositoryController' => 'applications/diffusion/controller/DiffusionRepositoryController.php',
|
'DiffusionRepositoryController' => 'applications/diffusion/controller/DiffusionRepositoryController.php',
|
||||||
|
@ -763,11 +764,13 @@ phutil_register_library_map(array(
|
||||||
'DiffusionRepositoryEditSubversionController' => 'applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php',
|
'DiffusionRepositoryEditSubversionController' => 'applications/diffusion/controller/DiffusionRepositoryEditSubversionController.php',
|
||||||
'DiffusionRepositoryEditUpdateController' => 'applications/diffusion/controller/DiffusionRepositoryEditUpdateController.php',
|
'DiffusionRepositoryEditUpdateController' => 'applications/diffusion/controller/DiffusionRepositoryEditUpdateController.php',
|
||||||
'DiffusionRepositoryEditproController' => 'applications/diffusion/controller/DiffusionRepositoryEditproController.php',
|
'DiffusionRepositoryEditproController' => 'applications/diffusion/controller/DiffusionRepositoryEditproController.php',
|
||||||
|
'DiffusionRepositoryHistoryManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryHistoryManagementPanel.php',
|
||||||
'DiffusionRepositoryListController' => 'applications/diffusion/controller/DiffusionRepositoryListController.php',
|
'DiffusionRepositoryListController' => 'applications/diffusion/controller/DiffusionRepositoryListController.php',
|
||||||
'DiffusionRepositoryManageController' => 'applications/diffusion/controller/DiffusionRepositoryManageController.php',
|
'DiffusionRepositoryManageController' => 'applications/diffusion/controller/DiffusionRepositoryManageController.php',
|
||||||
'DiffusionRepositoryManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryManagementPanel.php',
|
'DiffusionRepositoryManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryManagementPanel.php',
|
||||||
'DiffusionRepositoryNewController' => 'applications/diffusion/controller/DiffusionRepositoryNewController.php',
|
'DiffusionRepositoryNewController' => 'applications/diffusion/controller/DiffusionRepositoryNewController.php',
|
||||||
'DiffusionRepositoryPath' => 'applications/diffusion/data/DiffusionRepositoryPath.php',
|
'DiffusionRepositoryPath' => 'applications/diffusion/data/DiffusionRepositoryPath.php',
|
||||||
|
'DiffusionRepositoryPoliciesManagementPanel' => 'applications/diffusion/management/DiffusionRepositoryPoliciesManagementPanel.php',
|
||||||
'DiffusionRepositoryRef' => 'applications/diffusion/data/DiffusionRepositoryRef.php',
|
'DiffusionRepositoryRef' => 'applications/diffusion/data/DiffusionRepositoryRef.php',
|
||||||
'DiffusionRepositoryRemarkupRule' => 'applications/diffusion/remarkup/DiffusionRepositoryRemarkupRule.php',
|
'DiffusionRepositoryRemarkupRule' => 'applications/diffusion/remarkup/DiffusionRepositoryRemarkupRule.php',
|
||||||
'DiffusionRepositorySearchConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionRepositorySearchConduitAPIMethod.php',
|
'DiffusionRepositorySearchConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionRepositorySearchConduitAPIMethod.php',
|
||||||
|
@ -4934,6 +4937,7 @@ phutil_register_library_map(array(
|
||||||
'DiffusionRefTableController' => 'DiffusionController',
|
'DiffusionRefTableController' => 'DiffusionController',
|
||||||
'DiffusionRefsQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
|
'DiffusionRefsQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
|
||||||
'DiffusionRenameHistoryQuery' => 'Phobject',
|
'DiffusionRenameHistoryQuery' => 'Phobject',
|
||||||
|
'DiffusionRepositoryBasicsManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||||
'DiffusionRepositoryByIDRemarkupRule' => 'PhabricatorObjectRemarkupRule',
|
'DiffusionRepositoryByIDRemarkupRule' => 'PhabricatorObjectRemarkupRule',
|
||||||
'DiffusionRepositoryClusterManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
'DiffusionRepositoryClusterManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||||
'DiffusionRepositoryController' => 'DiffusionController',
|
'DiffusionRepositoryController' => 'DiffusionController',
|
||||||
|
@ -4958,11 +4962,13 @@ phutil_register_library_map(array(
|
||||||
'DiffusionRepositoryEditSubversionController' => 'DiffusionRepositoryEditController',
|
'DiffusionRepositoryEditSubversionController' => 'DiffusionRepositoryEditController',
|
||||||
'DiffusionRepositoryEditUpdateController' => 'DiffusionRepositoryEditController',
|
'DiffusionRepositoryEditUpdateController' => 'DiffusionRepositoryEditController',
|
||||||
'DiffusionRepositoryEditproController' => 'DiffusionRepositoryEditController',
|
'DiffusionRepositoryEditproController' => 'DiffusionRepositoryEditController',
|
||||||
|
'DiffusionRepositoryHistoryManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||||
'DiffusionRepositoryListController' => 'DiffusionController',
|
'DiffusionRepositoryListController' => 'DiffusionController',
|
||||||
'DiffusionRepositoryManageController' => 'DiffusionController',
|
'DiffusionRepositoryManageController' => 'DiffusionController',
|
||||||
'DiffusionRepositoryManagementPanel' => 'Phobject',
|
'DiffusionRepositoryManagementPanel' => 'Phobject',
|
||||||
'DiffusionRepositoryNewController' => 'DiffusionController',
|
'DiffusionRepositoryNewController' => 'DiffusionController',
|
||||||
'DiffusionRepositoryPath' => 'Phobject',
|
'DiffusionRepositoryPath' => 'Phobject',
|
||||||
|
'DiffusionRepositoryPoliciesManagementPanel' => 'DiffusionRepositoryManagementPanel',
|
||||||
'DiffusionRepositoryRef' => 'Phobject',
|
'DiffusionRepositoryRef' => 'Phobject',
|
||||||
'DiffusionRepositoryRemarkupRule' => 'PhabricatorObjectRemarkupRule',
|
'DiffusionRepositoryRemarkupRule' => 'PhabricatorObjectRemarkupRule',
|
||||||
'DiffusionRepositorySearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
|
'DiffusionRepositorySearchConduitAPIMethod' => 'PhabricatorSearchEngineAPIMethod',
|
||||||
|
|
|
@ -30,7 +30,8 @@ final class DiffusionRepositoryManageController
|
||||||
foreach ($panels as $panel) {
|
foreach ($panels as $panel) {
|
||||||
$panel
|
$panel
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->setRepository($repository);
|
->setRepository($repository)
|
||||||
|
->setController($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
$selected = $request->getURIData('panel');
|
$selected = $request->getURIData('panel');
|
||||||
|
@ -63,10 +64,30 @@ final class DiffusionRepositoryManageController
|
||||||
$repository->getPathURI('manage/'));
|
$repository->getPathURI('manage/'));
|
||||||
$crumbs->addTextCrumb($panel->getManagementPanelLabel());
|
$crumbs->addTextCrumb($panel->getManagementPanelLabel());
|
||||||
|
|
||||||
|
$header_text = pht(
|
||||||
|
'%s: %s',
|
||||||
|
$repository->getDisplayName(),
|
||||||
|
$panel->getManagementPanelLabel());
|
||||||
|
|
||||||
|
$header = id(new PHUIHeaderView())
|
||||||
|
->setHeader($header_text)
|
||||||
|
->setHeaderIcon('fa-pencil');
|
||||||
|
if ($repository->isTracked()) {
|
||||||
|
$header->setStatus('fa-check', 'bluegrey', pht('Active'));
|
||||||
|
} else {
|
||||||
|
$header->setStatus('fa-ban', 'dark', pht('Inactive'));
|
||||||
|
}
|
||||||
|
|
||||||
$view = id(new PHUITwoColumnView())
|
$view = id(new PHUITwoColumnView())
|
||||||
|
->setHeader($header)
|
||||||
->setNavigation($nav)
|
->setNavigation($nav)
|
||||||
->setMainColumn($content);
|
->setMainColumn($content);
|
||||||
|
|
||||||
|
$curtain = $panel->buildManagementPanelCurtain();
|
||||||
|
if ($curtain) {
|
||||||
|
$view->setCurtain($curtain);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->newPage()
|
return $this->newPage()
|
||||||
->setTitle($title)
|
->setTitle($title)
|
||||||
->setCrumbs($crumbs)
|
->setCrumbs($crumbs)
|
||||||
|
@ -95,5 +116,14 @@ final class DiffusionRepositoryManageController
|
||||||
return $nav;
|
return $nav;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function newTimeline(PhabricatorRepository $repository) {
|
||||||
|
$timeline = $this->buildTransactionTimeline(
|
||||||
|
$repository,
|
||||||
|
new PhabricatorRepositoryTransactionQuery());
|
||||||
|
$timeline->setShouldTerminate(true);
|
||||||
|
|
||||||
|
return $timeline;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,122 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DiffusionRepositoryBasicsManagementPanel
|
||||||
|
extends DiffusionRepositoryManagementPanel {
|
||||||
|
|
||||||
|
const PANELKEY = 'basics';
|
||||||
|
|
||||||
|
public function getManagementPanelLabel() {
|
||||||
|
return pht('Basics');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getManagementPanelOrder() {
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function buildManagementPanelActions() {
|
||||||
|
$repository = $this->getRepository();
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||||
|
$viewer,
|
||||||
|
$repository,
|
||||||
|
PhabricatorPolicyCapability::CAN_EDIT);
|
||||||
|
|
||||||
|
$edit_uri = $repository->getPathURI('manage/');
|
||||||
|
$activate_uri = $repository->getPathURI('edit/activate/');
|
||||||
|
$delete_uri = $repository->getPathURI('edit/delete/');
|
||||||
|
|
||||||
|
if ($repository->isTracked()) {
|
||||||
|
$activate_icon = 'fa-pause';
|
||||||
|
$activate_label = pht('Deactivate Repository');
|
||||||
|
} else {
|
||||||
|
$activate_icon = 'fa-play';
|
||||||
|
$activate_label = pht('Activate Repository');
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
id(new PhabricatorActionView())
|
||||||
|
->setIcon('fa-pencil')
|
||||||
|
->setName(pht('Edit Basic Information'))
|
||||||
|
->setHref($edit_uri)
|
||||||
|
->setDisabled(!$can_edit)
|
||||||
|
->setWorkflow(!$can_edit),
|
||||||
|
id(new PhabricatorActionView())
|
||||||
|
->setHref($activate_uri)
|
||||||
|
->setIcon($activate_icon)
|
||||||
|
->setName($activate_label)
|
||||||
|
->setDisabled(!$can_edit)
|
||||||
|
->setWorkflow(true),
|
||||||
|
id(new PhabricatorActionView())
|
||||||
|
->setName(pht('Delete Repository'))
|
||||||
|
->setIcon('fa-times')
|
||||||
|
->setHref($delete_uri)
|
||||||
|
->setDisabled(true)
|
||||||
|
->setWorkflow(true),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildManagementPanelContent() {
|
||||||
|
$result = array();
|
||||||
|
|
||||||
|
$result[] = $this->newBox(pht('Repository Basics'), $this->buildBasics());
|
||||||
|
|
||||||
|
$description = $this->buildDescription();
|
||||||
|
if ($description) {
|
||||||
|
$result[] = $this->newBox(pht('Description'), $description);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function buildBasics() {
|
||||||
|
$repository = $this->getRepository();
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
|
$view = id(new PHUIPropertyListView())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->setActionList($this->newActions());
|
||||||
|
|
||||||
|
$name = $repository->getName();
|
||||||
|
$view->addProperty(pht('Name'), $name);
|
||||||
|
|
||||||
|
$type = PhabricatorRepositoryType::getNameForRepositoryType(
|
||||||
|
$repository->getVersionControlSystem());
|
||||||
|
$view->addProperty(pht('Type'), $type);
|
||||||
|
|
||||||
|
$callsign = $repository->getCallsign();
|
||||||
|
if (!strlen($callsign)) {
|
||||||
|
$callsign = phutil_tag('em', array(), pht('No Callsign'));
|
||||||
|
}
|
||||||
|
$view->addProperty(pht('Callsign'), $callsign);
|
||||||
|
|
||||||
|
$short_name = $repository->getRepositorySlug();
|
||||||
|
if ($short_name === null) {
|
||||||
|
$short_name = $repository->getCloneName();
|
||||||
|
$short_name = phutil_tag('em', array(), $short_name);
|
||||||
|
}
|
||||||
|
$view->addProperty(pht('Short Name'), $short_name);
|
||||||
|
|
||||||
|
return $view;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function buildDescription() {
|
||||||
|
$repository = $this->getRepository();
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
|
$description = $repository->getDetail('description');
|
||||||
|
|
||||||
|
$view = id(new PHUIPropertyListView())
|
||||||
|
->setViewer($viewer);
|
||||||
|
if (!strlen($description)) {
|
||||||
|
$description = phutil_tag('em', array(), pht('No description provided.'));
|
||||||
|
} else {
|
||||||
|
$description = new PHUIRemarkupView($viewer, $description);
|
||||||
|
}
|
||||||
|
$view->addTextContent($description);
|
||||||
|
|
||||||
|
return $view;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -10,7 +10,7 @@ final class DiffusionRepositoryClusterManagementPanel
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getManagementPanelOrder() {
|
public function getManagementPanelOrder() {
|
||||||
return 12345;
|
return 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildManagementPanelContent() {
|
public function buildManagementPanelContent() {
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DiffusionRepositoryHistoryManagementPanel
|
||||||
|
extends DiffusionRepositoryManagementPanel {
|
||||||
|
|
||||||
|
const PANELKEY = 'history';
|
||||||
|
|
||||||
|
public function getManagementPanelLabel() {
|
||||||
|
return pht('History');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getManagementPanelOrder() {
|
||||||
|
return 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildManagementPanelContent() {
|
||||||
|
return $this->newTimeline();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -5,6 +5,7 @@ abstract class DiffusionRepositoryManagementPanel
|
||||||
|
|
||||||
private $viewer;
|
private $viewer;
|
||||||
private $repository;
|
private $repository;
|
||||||
|
private $controller;
|
||||||
|
|
||||||
final public function setViewer(PhabricatorUser $viewer) {
|
final public function setViewer(PhabricatorUser $viewer) {
|
||||||
$this->viewer = $viewer;
|
$this->viewer = $viewer;
|
||||||
|
@ -24,6 +25,11 @@ abstract class DiffusionRepositoryManagementPanel
|
||||||
return $this->repository;
|
return $this->repository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final public function setController(PhabricatorController $controller) {
|
||||||
|
$this->controller = $controller;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
final public function getManagementPanelKey() {
|
final public function getManagementPanelKey() {
|
||||||
return $this->getPhobjectClassConstant('PANELKEY');
|
return $this->getPhobjectClassConstant('PANELKEY');
|
||||||
}
|
}
|
||||||
|
@ -32,6 +38,47 @@ abstract class DiffusionRepositoryManagementPanel
|
||||||
abstract public function getManagementPanelOrder();
|
abstract public function getManagementPanelOrder();
|
||||||
abstract public function buildManagementPanelContent();
|
abstract public function buildManagementPanelContent();
|
||||||
|
|
||||||
|
protected function buildManagementPanelActions() {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
final protected function newActions() {
|
||||||
|
$actions = $this->buildManagementPanelActions();
|
||||||
|
if (!$actions) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
|
$action_list = 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)
|
||||||
|
->setActionList($actions);
|
||||||
|
|
||||||
|
return $curtain;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getAllPanels() {
|
public static function getAllPanels() {
|
||||||
return id(new PhutilClassMapQuery())
|
return id(new PhutilClassMapQuery())
|
||||||
->setAncestorClass(__CLASS__)
|
->setAncestorClass(__CLASS__)
|
||||||
|
@ -40,4 +87,15 @@ abstract class DiffusionRepositoryManagementPanel
|
||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final protected function newBox($header_text, $body) {
|
||||||
|
return id(new PHUIObjectBoxView())
|
||||||
|
->setHeaderText($header_text)
|
||||||
|
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
|
||||||
|
->appendChild($body);
|
||||||
|
}
|
||||||
|
|
||||||
|
final protected function newTimeline() {
|
||||||
|
return $this->controller->newTimeline($this->getRepository());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class DiffusionRepositoryPoliciesManagementPanel
|
||||||
|
extends DiffusionRepositoryManagementPanel {
|
||||||
|
|
||||||
|
const PANELKEY = 'policies';
|
||||||
|
|
||||||
|
public function getManagementPanelLabel() {
|
||||||
|
return pht('Policies');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getManagementPanelOrder() {
|
||||||
|
return 300;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function buildManagementPanelActions() {
|
||||||
|
$repository = $this->getRepository();
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
||||||
|
$viewer,
|
||||||
|
$repository,
|
||||||
|
PhabricatorPolicyCapability::CAN_EDIT);
|
||||||
|
|
||||||
|
$edit_uri = $repository->getPathURI('manage/');
|
||||||
|
|
||||||
|
return array(
|
||||||
|
id(new PhabricatorActionView())
|
||||||
|
->setIcon('fa-pencil')
|
||||||
|
->setName(pht('Edit Policies'))
|
||||||
|
->setHref($edit_uri)
|
||||||
|
->setDisabled(!$can_edit)
|
||||||
|
->setWorkflow(!$can_edit),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function buildManagementPanelContent() {
|
||||||
|
$repository = $this->getRepository();
|
||||||
|
$viewer = $this->getViewer();
|
||||||
|
|
||||||
|
$view = id(new PHUIPropertyListView())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->setActionList($this->newActions());
|
||||||
|
|
||||||
|
$descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions(
|
||||||
|
$viewer,
|
||||||
|
$repository);
|
||||||
|
|
||||||
|
$view_parts = array();
|
||||||
|
if (PhabricatorSpacesNamespaceQuery::getViewerSpacesExist($viewer)) {
|
||||||
|
$space_phid = PhabricatorSpacesNamespaceQuery::getObjectSpacePHID(
|
||||||
|
$repository);
|
||||||
|
$view_parts[] = $viewer->renderHandle($space_phid);
|
||||||
|
}
|
||||||
|
$view_parts[] = $descriptions[PhabricatorPolicyCapability::CAN_VIEW];
|
||||||
|
|
||||||
|
$view->addProperty(
|
||||||
|
pht('Visible To'),
|
||||||
|
phutil_implode_html(" \xC2\xB7 ", $view_parts));
|
||||||
|
|
||||||
|
$view->addProperty(
|
||||||
|
pht('Editable By'),
|
||||||
|
$descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
|
||||||
|
|
||||||
|
$pushable = $repository->isHosted()
|
||||||
|
? $descriptions[DiffusionPushCapability::CAPABILITY]
|
||||||
|
: phutil_tag('em', array(), pht('Not a Hosted Repository'));
|
||||||
|
$view->addProperty(pht('Pushable By'), $pushable);
|
||||||
|
|
||||||
|
return $this->newBox(pht('Policies'), $view);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue