Differential D21408 Diff 51025 src/applications/diffusion/controller/DiffusionRepositoryController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionRepositoryController.php
| Show First 20 Lines • Show All 293 Lines • ▼ Show 20 Lines | private function buildNormalContent(DiffusionRequest $drequest) { | ||||
| $content[] = $this->buildBrowseTable( | $content[] = $this->buildBrowseTable( | ||||
| $browse_results, | $browse_results, | ||||
| $browse_paths, | $browse_paths, | ||||
| $browse_exception, | $browse_exception, | ||||
| $handles, | $handles, | ||||
| $browse_pager); | $browse_pager); | ||||
| $content[] = $this->buildHistoryTable( | |||||
| $history_results, | |||||
| $history, | |||||
| $history_exception); | |||||
| if ($readme) { | if ($readme) { | ||||
| $content[] = $readme; | $content[] = $readme; | ||||
| } | } | ||||
| try { | try { | ||||
| $branch_button = $this->buildBranchList($drequest); | $branch_button = $this->buildBranchList($drequest); | ||||
| $this->branchButton = $branch_button; | $this->branchButton = $branch_button; | ||||
| } catch (Exception $ex) { | } catch (Exception $ex) { | ||||
| if (!$repository->isImporting()) { | if (!$repository->isImporting()) { | ||||
| $content[] = $this->renderStatusMessage( | $content[] = $this->renderStatusMessage( | ||||
| pht('Unable to Load Branches'), | pht('Unable to Load Branches'), | ||||
| $ex->getMessage()); | $ex->getMessage()); | ||||
| ▲ Show 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | if (strlen($description)) { | ||||
| $view->addTextContent($description); | $view->addTextContent($description); | ||||
| return id(new PHUIObjectBoxView()) | return id(new PHUIObjectBoxView()) | ||||
| ->appendChild($view) | ->appendChild($view) | ||||
| ->addClass('diffusion-profile-description'); | ->addClass('diffusion-profile-description'); | ||||
| } | } | ||||
| return null; | return null; | ||||
| } | } | ||||
| private function buildHistoryTable( | |||||
| $history_results, | |||||
| $history, | |||||
| $history_exception) { | |||||
| $request = $this->getRequest(); | |||||
| $viewer = $request->getUser(); | |||||
| $drequest = $this->getDiffusionRequest(); | |||||
| $repository = $drequest->getRepository(); | |||||
| if ($history_exception) { | |||||
| if ($repository->isImporting()) { | |||||
| return $this->renderStatusMessage( | |||||
| pht('Still Importing...'), | |||||
| pht( | |||||
| 'This repository is still importing. History is not yet '. | |||||
| 'available.')); | |||||
| } else { | |||||
| return $this->renderStatusMessage( | |||||
| pht('Unable to Retrieve History'), | |||||
| $history_exception->getMessage()); | |||||
| } | |||||
| } | |||||
| $history_table = id(new DiffusionHistoryTableView()) | |||||
| ->setUser($viewer) | |||||
| ->setDiffusionRequest($drequest) | |||||
| ->setHistory($history) | |||||
| ->setIsHead(true); | |||||
| if ($history_results) { | |||||
| $history_table->setParents($history_results['parents']); | |||||
| } | |||||
| $panel = id(new PHUIObjectBoxView()) | |||||
| ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) | |||||
| ->addClass('diffusion-mobile-view'); | |||||
| $header = id(new PHUIHeaderView()) | |||||
| ->setHeader(pht('Recent Commits')); | |||||
| $panel->setHeader($header); | |||||
| $panel->setTable($history_table); | |||||
| return $panel; | |||||
| } | |||||
| private function buildBranchList(DiffusionRequest $drequest) { | private function buildBranchList(DiffusionRequest $drequest) { | ||||
| $viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
| if (!$this->needBranchFuture()) { | if (!$this->needBranchFuture()) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| $branches = $this->branchFuture->resolve(); | $branches = $this->branchFuture->resolve(); | ||||
| ▲ Show 20 Lines • Show All 165 Lines • Show Last 20 Lines | |||||