Differential D20423 Diff 48777 src/applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php
| Show All 32 Lines | public function getManagementPanelIcon() { | ||||
| } | } | ||||
| } | } | ||||
| protected function getEditEngineFieldKeys() { | protected function getEditEngineFieldKeys() { | ||||
| return array( | return array( | ||||
| 'defaultBranch', | 'defaultBranch', | ||||
| 'fetchRefs', | 'fetchRefs', | ||||
| 'trackOnly', | 'trackOnly', | ||||
| 'autocloseOnly', | 'permanentRefs', | ||||
| ); | ); | ||||
| } | } | ||||
| public function buildManagementPanelCurtain() { | public function buildManagementPanelCurtain() { | ||||
| $repository = $this->getRepository(); | $repository = $this->getRepository(); | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| $action_list = $this->newActionList(); | $action_list = $this->newActionList(); | ||||
| ▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | $track_only = nonempty( | ||||
| $track_only_rules, | $track_only_rules, | ||||
| phutil_tag('em', array(), pht('Track All Branches'))); | phutil_tag('em', array(), pht('Track All Branches'))); | ||||
| $view->addProperty(pht('Track Only'), $track_only); | $view->addProperty(pht('Track Only'), $track_only); | ||||
| $autoclose_rules = $repository->getAutocloseOnlyRules(); | $autoclose_rules = $repository->getAutocloseOnlyRules(); | ||||
| $autoclose_rules = implode(', ', $autoclose_rules); | $autoclose_rules = implode(', ', $autoclose_rules); | ||||
| $autoclose_only = nonempty( | $autoclose_only = nonempty( | ||||
| $autoclose_rules, | $autoclose_rules, | ||||
| phutil_tag('em', array(), pht('Autoclose On All Branches'))); | phutil_tag('em', array(), pht('All Branches'))); | ||||
| $autoclose_disabled = false; | $autoclose_disabled = false; | ||||
| if ($repository->getDetail('disable-autoclose')) { | if ($repository->getDetail('disable-autoclose')) { | ||||
| $autoclose_disabled = true; | $autoclose_disabled = true; | ||||
| $autoclose_only = | $autoclose_only = | ||||
| phutil_tag('em', array(), pht('Autoclose has been disabled')); | phutil_tag('em', array(), pht('Autoclose has been disabled')); | ||||
| } | } | ||||
| $view->addProperty(pht('Autoclose Only'), $autoclose_only); | $view->addProperty(pht('Permanent Refs'), $autoclose_only); | ||||
amckinley: These variables are named inconsistently now (and variables elsewhere), which I'm guessing will… | |||||
| $content[] = $this->newBox(pht('Branches'), $view); | $content[] = $this->newBox(pht('Branches'), $view); | ||||
| // Branch Autoclose Table | // Branch Autoclose Table | ||||
| if (!$repository->isImporting()) { | if (!$repository->isImporting()) { | ||||
| $request = $this->getRequest(); | $request = $this->getRequest(); | ||||
| $pager = id(new PHUIPagerView()) | $pager = id(new PHUIPagerView()) | ||||
| ->readFromRequest($request); | ->readFromRequest($request); | ||||
| Show All 10 Lines | if (!$repository->isImporting()) { | ||||
| $branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches); | $branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches); | ||||
| $branches = $pager->sliceResults($branches); | $branches = $pager->sliceResults($branches); | ||||
| $can_close_branches = ($repository->isHg()); | $can_close_branches = ($repository->isHg()); | ||||
| $rows = array(); | $rows = array(); | ||||
| foreach ($branches as $branch) { | foreach ($branches as $branch) { | ||||
| $branch_name = $branch->getShortName(); | $branch_name = $branch->getShortName(); | ||||
| $tracking = $repository->shouldTrackBranch($branch_name); | $tracking = $repository->shouldTrackBranch($branch_name); | ||||
| $autoclosing = $repository->shouldAutocloseBranch($branch_name); | $permanent = $repository->shouldAutocloseBranch($branch_name); | ||||
| $default = $repository->getDefaultBranch(); | $default = $repository->getDefaultBranch(); | ||||
| $icon = null; | $icon = null; | ||||
| if ($default == $branch->getShortName()) { | if ($default == $branch->getShortName()) { | ||||
| $icon = id(new PHUIIconView()) | $icon = id(new PHUIIconView()) | ||||
| ->setIcon('fa-code-fork'); | ->setIcon('fa-code-fork'); | ||||
| } | } | ||||
| $fields = $branch->getRawFields(); | $fields = $branch->getRawFields(); | ||||
| $closed = idx($fields, 'closed'); | $closed = idx($fields, 'closed'); | ||||
| if ($closed) { | if ($closed) { | ||||
| $status = pht('Closed'); | $status = pht('Closed'); | ||||
| } else { | } else { | ||||
| $status = pht('Open'); | $status = pht('Open'); | ||||
| } | } | ||||
| if ($autoclose_disabled) { | if ($autoclose_disabled) { | ||||
| $autoclose_status = pht('Disabled (Repository)'); | $autoclose_status = pht('Disabled (Repository)'); | ||||
| } else { | } else { | ||||
| $autoclose_status = pht('Off'); | $autoclose_status = pht('Not Permanent'); | ||||
| } | } | ||||
| $rows[] = array( | $rows[] = array( | ||||
| $icon, | $icon, | ||||
| $branch_name, | $branch_name, | ||||
| $status, | $status, | ||||
| $tracking ? pht('Tracking') : pht('Off'), | $tracking ? pht('Tracking') : pht('Off'), | ||||
| $autoclosing ? pht('Autoclose On') : $autoclose_status, | $permanent ? pht('Permanent') : $autoclose_status, | ||||
| ); | ); | ||||
| } | } | ||||
| $branch_table = new AphrontTableView($rows); | $branch_table = new AphrontTableView($rows); | ||||
| $branch_table->setHeaders( | $branch_table->setHeaders( | ||||
| array( | array( | ||||
| '', | '', | ||||
| pht('Branch'), | pht('Branch'), | ||||
| pht('Status'), | pht('Status'), | ||||
| pht('Track'), | pht('Track'), | ||||
| pht('Autoclose'), | pht('Permanent'), | ||||
| )); | )); | ||||
| $branch_table->setColumnClasses( | $branch_table->setColumnClasses( | ||||
| array( | array( | ||||
| '', | '', | ||||
| 'pri', | 'pri', | ||||
| 'narrow', | 'narrow', | ||||
| 'narrow', | 'narrow', | ||||
| 'wide', | 'wide', | ||||
| )); | )); | ||||
| $branch_table->setColumnVisibility( | $branch_table->setColumnVisibility( | ||||
| array( | array( | ||||
| true, | true, | ||||
| true, | true, | ||||
| $can_close_branches, | $can_close_branches, | ||||
| true, | true, | ||||
| true, | true, | ||||
| )); | )); | ||||
| $box = $this->newBox(pht('Branch Status'), $branch_table); | $box = $this->newBox(pht('Branch Status'), $branch_table); | ||||
| $box->setPager($pager); | $box->setPager($pager); | ||||
| $content[] = $box; | $content[] = $box; | ||||
| } else { | } else { | ||||
| $content[] = id(new PHUIInfoView()) | $content[] = id(new PHUIInfoView()) | ||||
| ->setSeverity(PHUIInfoView::SEVERITY_NOTICE) | ->setSeverity(PHUIInfoView::SEVERITY_NOTICE) | ||||
| ->appendChild(pht('Branch status in unavailable while the repository '. | ->appendChild( | ||||
| 'is still importing.')); | pht( | ||||
| 'Branch status is unavailable while the repository is still '. | |||||
Not Done Inline ActionsShould be "is unavailable"? amckinley: Should be "is unavailable"? | |||||
| 'importing.')); | |||||
| } | } | ||||
| return $content; | return $content; | ||||
| } | } | ||||
| } | } | ||||
These variables are named inconsistently now (and variables elsewhere), which I'm guessing will get cleaned up later, but I'm also not too worried about anyway.