3 final class DiffusionRepositoryLimitsManagementPanel
4 extends DiffusionRepositoryManagementPanel
{
6 const PANELKEY
= 'limits';
8 public function getManagementPanelLabel() {
12 public function getManagementPanelOrder() {
16 public function shouldEnableForRepository(
17 PhabricatorRepository
$repository) {
18 return $repository->isGit();
21 public function getManagementPanelIcon() {
22 $repository = $this->getRepository();
26 if ($repository->getFilesizeLimit()) {
33 return 'fa-signal grey';
37 protected function getEditEngineFieldKeys() {
45 public function buildManagementPanelCurtain() {
46 $repository = $this->getRepository();
47 $viewer = $this->getViewer();
48 $action_list = $this->newActionList();
50 $can_edit = PhabricatorPolicyFilter
::hasCapability(
53 PhabricatorPolicyCapability
::CAN_EDIT
);
55 $limits_uri = $this->getEditPageURI();
57 $action_list->addAction(
58 id(new PhabricatorActionView())
59 ->setIcon('fa-pencil')
60 ->setName(pht('Edit Limits'))
61 ->setHref($limits_uri)
62 ->setDisabled(!$can_edit)
63 ->setWorkflow(!$can_edit));
65 return $this->newCurtainView()
66 ->setActionList($action_list);
69 public function buildManagementPanelContent() {
70 $repository = $this->getRepository();
71 $viewer = $this->getViewer();
73 $view = id(new PHUIPropertyListView())
76 $byte_limit = $repository->getFilesizeLimit();
78 $filesize_display = pht('%s Bytes', new PhutilNumber($byte_limit));
80 $filesize_display = pht('Unlimited');
81 $filesize_display = phutil_tag('em', array(), $filesize_display);
84 $view->addProperty(pht('Filesize Limit'), $filesize_display);
86 $copy_limit = $repository->getCopyTimeLimit();
88 $copy_display = pht('%s Seconds', new PhutilNumber($copy_limit));
90 $copy_default = $repository->getDefaultCopyTimeLimit();
92 'Default (%s Seconds)',
93 new PhutilNumber($copy_default));
94 $copy_display = phutil_tag('em', array(), $copy_display);
97 $view->addProperty(pht('Clone/Fetch Timeout'), $copy_display);
99 $touch_limit = $repository->getTouchLimit();
101 $touch_display = pht('%s Paths', new PhutilNumber($touch_limit));
103 $touch_display = pht('Unlimited');
104 $touch_display = phutil_tag('em', array(), $touch_display);
107 $view->addProperty(pht('Touched Paths Limit'), $touch_display);
109 return $this->newBox(pht('Limits'), $view);