Path: blob/master/src/applications/harbormaster/view/HarbormasterUnitSummaryView.php
12256 views
<?php12final class HarbormasterUnitSummaryView extends AphrontView {34private $buildable;5private $messages;6private $limit;7private $showViewAll;89public function setBuildable(HarbormasterBuildable $buildable) {10$this->buildable = $buildable;11return $this;12}1314public function setUnitMessages(array $messages) {15$this->messages = $messages;16return $this;17}1819public function setLimit($limit) {20$this->limit = $limit;21return $this;22}2324public function setShowViewAll($show_view_all) {25$this->showViewAll = $show_view_all;26return $this;27}2829public function render() {30$messages = $this->messages;31$buildable = $this->buildable;3233$id = $buildable->getID();34$full_uri = "/harbormaster/unit/{$id}/";3536$messages = msort($messages, 'getSortKey');37$head_unit = head($messages);38if ($head_unit) {39$status = $head_unit->getResult();4041$tag_text = HarbormasterUnitStatus::getUnitStatusLabel($status);42$tag_color = HarbormasterUnitStatus::getUnitStatusColor($status);43$tag_icon = HarbormasterUnitStatus::getUnitStatusIcon($status);44} else {45$tag_text = pht('No Unit Tests');46$tag_color = 'grey';47$tag_icon = 'fa-ban';48}4950$tag = id(new PHUITagView())51->setType(PHUITagView::TYPE_SHADE)52->setColor($tag_color)53->setIcon($tag_icon)54->setName($tag_text);5556$header = id(new PHUIHeaderView())57->setHeader(array(pht('Unit Tests'), $tag));5859if ($this->showViewAll) {60$view_all = id(new PHUIButtonView())61->setTag('a')62->setHref($full_uri)63->setIcon('fa-list-ul')64->setText('View All');65$header->addActionLink($view_all);66}6768$box = id(new PHUIObjectBoxView())69->setHeader($header)70->setBackground(PHUIObjectBoxView::BLUE_PROPERTY);7172$table = id(new HarbormasterUnitPropertyView())73->setViewer($this->getViewer())74->setUnitMessages($messages);7576if ($this->showViewAll) {77$table->setFullResultsURI($full_uri);78}7980if ($this->limit) {81$table->setLimit($this->limit);82}8384$box->setTable($table);8586return $box;87}8889}909192