Add hosting, serving, and push policy options to repository edit
Summary: Basically straight from D7391. The differences are basically: - Policy stuff is all application-scope instead of global-scope. - Made a few strings a little nicer. - Deleted a bit of dead code. - Added a big "THIS DOESN'T WORK YET" warning. Test Plan: See screenshots. Reviewers: hach-que, btrahan Reviewed By: hach-que CC: aran Maniphest Tasks: T2230 Differential Revision: https://secure.phabricator.com/D7416
This commit is contained in:
@@ -23,8 +23,7 @@ final class DiffusionRepositoryEditMainController
|
||||
$is_git = true;
|
||||
break;
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
||||
// TOOD: This will be true for hosted SVN repositories.
|
||||
$has_local = false;
|
||||
$has_local = $repository->isHosted();
|
||||
$is_svn = true;
|
||||
break;
|
||||
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
||||
@@ -63,6 +62,10 @@ final class DiffusionRepositoryEditMainController
|
||||
$encoding_properties =
|
||||
$this->buildEncodingProperties($repository, $encoding_actions);
|
||||
|
||||
$hosting_properties = $this->buildHostingProperties(
|
||||
$repository,
|
||||
$this->buildHostingActions($repository));
|
||||
|
||||
$branches_properties = null;
|
||||
if ($has_branches) {
|
||||
$branches_properties = $this->buildBranchesProperties(
|
||||
@@ -114,6 +117,7 @@ final class DiffusionRepositoryEditMainController
|
||||
->setHeader($header)
|
||||
->addPropertyList($basic_properties)
|
||||
->addPropertyList($policy_properties)
|
||||
->addPropertyList($hosting_properties)
|
||||
->addPropertyList($remote_properties);
|
||||
|
||||
if ($local_properties) {
|
||||
@@ -298,6 +302,10 @@ final class DiffusionRepositoryEditMainController
|
||||
pht('Editable By'),
|
||||
$descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
|
||||
|
||||
$pushable = $repository->isHosted()
|
||||
? $descriptions[DiffusionCapabilityPush::CAPABILITY]
|
||||
: phutil_tag('em', array(), pht('Not a Hosted Repository'));
|
||||
$view->addProperty(pht('Pushable By'), $pushable);
|
||||
|
||||
return $view;
|
||||
}
|
||||
@@ -501,4 +509,57 @@ final class DiffusionRepositoryEditMainController
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
private function buildHostingActions(PhabricatorRepository $repository) {
|
||||
$user = $this->getRequest()->getUser();
|
||||
|
||||
$view = id(new PhabricatorActionListView())
|
||||
->setObjectURI($this->getRequest()->getRequestURI())
|
||||
->setUser($user);
|
||||
|
||||
$edit = id(new PhabricatorActionView())
|
||||
->setIcon('edit')
|
||||
->setName(pht('Edit Hosting'))
|
||||
->setHref(
|
||||
$this->getRepositoryControllerURI($repository, 'edit/hosting/'));
|
||||
$view->addAction($edit);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
private function buildHostingProperties(
|
||||
PhabricatorRepository $repository,
|
||||
PhabricatorActionListView $actions) {
|
||||
|
||||
$user = $this->getRequest()->getUser();
|
||||
|
||||
$view = id(new PHUIPropertyListView())
|
||||
->setUser($user)
|
||||
->setActionList($actions)
|
||||
->addSectionHeader(pht('Hosting'));
|
||||
|
||||
$hosting = $repository->isHosted()
|
||||
? pht('Hosted on Phabricator')
|
||||
: pht('Hosted Elsewhere');
|
||||
$view->addProperty(pht('Hosting'), phutil_tag('em', array(), $hosting));
|
||||
|
||||
$view->addProperty(
|
||||
pht('Serve over HTTP'),
|
||||
phutil_tag(
|
||||
'em',
|
||||
array(),
|
||||
PhabricatorRepository::getProtocolAvailabilityName(
|
||||
$repository->getServeOverHTTP())));
|
||||
|
||||
$view->addProperty(
|
||||
pht('Serve over SSH'),
|
||||
phutil_tag(
|
||||
'em',
|
||||
array(),
|
||||
PhabricatorRepository::getProtocolAvailabilityName(
|
||||
$repository->getServeOverSSH())));
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user