Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/view/DiffusionTagListView.php
Show All 23 Lines | final class DiffusionTagListView extends DiffusionView { | ||||
public function getRequiredHandlePHIDs() { | public function getRequiredHandlePHIDs() { | ||||
return array_filter(mpull($this->commits, 'getAuthorPHID')); | return array_filter(mpull($this->commits, 'getAuthorPHID')); | ||||
} | } | ||||
public function render() { | public function render() { | ||||
$drequest = $this->getDiffusionRequest(); | $drequest = $this->getDiffusionRequest(); | ||||
$repository = $drequest->getRepository(); | $repository = $drequest->getRepository(); | ||||
$buildables = $this->loadBuildables($this->commits); | |||||
$has_builds = false; | |||||
$rows = array(); | $rows = array(); | ||||
foreach ($this->tags as $tag) { | foreach ($this->tags as $tag) { | ||||
$commit = idx($this->commits, $tag->getCommitIdentifier()); | $commit = idx($this->commits, $tag->getCommitIdentifier()); | ||||
$tag_link = phutil_tag( | $tag_link = phutil_tag( | ||||
'a', | 'a', | ||||
array( | array( | ||||
Show All 35 Lines | foreach ($this->tags as $tag) { | ||||
} else { | } else { | ||||
if ($commit) { | if ($commit) { | ||||
$description = $commit->getSummary(); | $description = $commit->getSummary(); | ||||
} else { | } else { | ||||
$description = $tag->getDescription(); | $description = $tag->getDescription(); | ||||
} | } | ||||
} | } | ||||
$build = null; | |||||
if ($commit) { | |||||
$buildable = idx($buildables, $commit->getPHID()); | |||||
if ($buildable) { | |||||
$build = $this->renderBuildable($buildable); | |||||
$has_builds = true; | |||||
} | |||||
} | |||||
$history = $this->linkTagHistory($tag->getName()); | |||||
$rows[] = array( | $rows[] = array( | ||||
$history, | |||||
$tag_link, | $tag_link, | ||||
$commit_link, | $commit_link, | ||||
$description, | $build, | ||||
$author, | $author, | ||||
$description, | |||||
phabricator_datetime($tag->getEpoch(), $this->user), | phabricator_datetime($tag->getEpoch(), $this->user), | ||||
); | ); | ||||
} | } | ||||
$table = new AphrontTableView($rows); | $table = id(new AphrontTableView($rows)) | ||||
$table->setHeaders( | ->setHeaders( | ||||
array( | array( | ||||
null, | |||||
pht('Tag'), | pht('Tag'), | ||||
pht('Commit'), | pht('Commit'), | ||||
pht('Description'), | null, | ||||
pht('Author'), | pht('Author'), | ||||
pht('Description'), | |||||
pht('Created'), | pht('Created'), | ||||
)); | )) | ||||
$table->setColumnClasses( | ->setColumnClasses( | ||||
array( | array( | ||||
'nudgeright', | |||||
'pri', | 'pri', | ||||
'', | '', | ||||
'', | |||||
'', | |||||
'wide', | 'wide', | ||||
)) | |||||
->setColumnVisibility( | |||||
array( | |||||
true, | |||||
true, | |||||
true, | |||||
$has_builds, | |||||
)); | )); | ||||
return $table->render(); | return $table->render(); | ||||
} | } | ||||
} | } |