Differential D20433 Diff 48786 src/applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/management/DiffusionRepositoryBranchesManagementPanel.php
| Show All 31 Lines | if ($has_any) { | ||||
| return 'fa-code-fork grey'; | return 'fa-code-fork grey'; | ||||
| } | } | ||||
| } | } | ||||
| protected function getEditEngineFieldKeys() { | protected function getEditEngineFieldKeys() { | ||||
| return array( | return array( | ||||
| 'defaultBranch', | 'defaultBranch', | ||||
| 'fetchRefs', | 'fetchRefs', | ||||
| 'trackOnly', | |||||
| 'permanentRefs', | 'permanentRefs', | ||||
| 'trackOnly', | |||||
| ); | ); | ||||
| } | } | ||||
| 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 All 35 Lines | if ($repository->supportsFetchRules()) { | ||||
| $fetch_display = implode(', ', $fetch_only); | $fetch_display = implode(', ', $fetch_only); | ||||
| } else { | } else { | ||||
| $fetch_display = phutil_tag('em', array(), pht('Fetch All Refs')); | $fetch_display = phutil_tag('em', array(), pht('Fetch All Refs')); | ||||
| } | } | ||||
| $view->addProperty(pht('Fetch Refs'), $fetch_display); | $view->addProperty(pht('Fetch Refs'), $fetch_display); | ||||
| } | } | ||||
| $track_only_rules = $repository->getTrackOnlyRules(); | $track_only_rules = $repository->getTrackOnlyRules(); | ||||
| if ($track_only_rules) { | |||||
| $track_only_rules = implode(', ', $track_only_rules); | $track_only_rules = implode(', ', $track_only_rules); | ||||
| $track_only = nonempty( | $view->addProperty(pht('Track Only'), $track_only_rules); | ||||
| $track_only_rules, | } | ||||
| phutil_tag('em', array(), pht('Track All Branches'))); | |||||
| $view->addProperty(pht('Track Only'), $track_only); | |||||
| $publishing_disabled = $repository->isPublishingDisabled(); | $publishing_disabled = $repository->isPublishingDisabled(); | ||||
| if ($publishing_disabled) { | if ($publishing_disabled) { | ||||
| $permanent_display = | $permanent_display = | ||||
| phutil_tag('em', array(), pht('Publishing Disabled')); | phutil_tag('em', array(), pht('Publishing Disabled')); | ||||
| } else { | } else { | ||||
| $permanent_rules = $repository->getPermanentRefRules(); | $permanent_rules = $repository->getPermanentRefRules(); | ||||
| if ($permanent_rules) { | if ($permanent_rules) { | ||||
| Show All 22 Lines | if (!$repository->isImporting()) { | ||||
| ->execute(); | ->execute(); | ||||
| $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); | |||||
| $permanent = $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'); | ||||
| } | } | ||||
| Show All 15 Lines | if (!$repository->isImporting()) { | ||||
| $permanent_status = pht('Not Permanent'); | $permanent_status = pht('Not Permanent'); | ||||
| } | } | ||||
| } | } | ||||
| $rows[] = array( | $rows[] = array( | ||||
| $icon, | $icon, | ||||
| $branch_name, | $branch_name, | ||||
| $status, | $status, | ||||
| $tracking ? pht('Tracking') : pht('Off'), | |||||
| $permanent_status, | $permanent_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('Permanent'), | pht('Permanent'), | ||||
| )); | )); | ||||
| $branch_table->setColumnClasses( | $branch_table->setColumnClasses( | ||||
| array( | array( | ||||
| '', | '', | ||||
| 'pri', | 'pri', | ||||
| '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, | |||||
| )); | )); | ||||
| $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) | ||||
| Show All 10 Lines | |||||