@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at recaptime-dev/main 90 lines 2.2 kB view raw
1<?php 2 3final class HarbormasterUnitSummaryView extends AphrontView { 4 5 private $buildable; 6 private $messages; 7 private $limit; 8 private $showViewAll; 9 10 public function setBuildable(HarbormasterBuildable $buildable) { 11 $this->buildable = $buildable; 12 return $this; 13 } 14 15 public function setUnitMessages(array $messages) { 16 $this->messages = $messages; 17 return $this; 18 } 19 20 public function setLimit($limit) { 21 $this->limit = $limit; 22 return $this; 23 } 24 25 public function setShowViewAll($show_view_all) { 26 $this->showViewAll = $show_view_all; 27 return $this; 28 } 29 30 public function render() { 31 $messages = $this->messages; 32 $buildable = $this->buildable; 33 34 $id = $buildable->getID(); 35 $full_uri = "/harbormaster/unit/{$id}/"; 36 37 $messages = msort($messages, 'getSortKey'); 38 $head_unit = head($messages); 39 if ($head_unit) { 40 $status = $head_unit->getResult(); 41 42 $tag_text = HarbormasterUnitStatus::getUnitStatusLabel($status); 43 $tag_color = HarbormasterUnitStatus::getUnitStatusColor($status); 44 $tag_icon = HarbormasterUnitStatus::getUnitStatusIcon($status); 45 } else { 46 $tag_text = pht('No Unit Tests'); 47 $tag_color = 'grey'; 48 $tag_icon = 'fa-ban'; 49 } 50 51 $tag = id(new PHUITagView()) 52 ->setType(PHUITagView::TYPE_SHADE) 53 ->setColor($tag_color) 54 ->setIcon($tag_icon) 55 ->setName($tag_text); 56 57 $header = id(new PHUIHeaderView()) 58 ->setHeader(array(pht('Unit Tests'), $tag)); 59 60 if ($this->showViewAll) { 61 $view_all = id(new PHUIButtonView()) 62 ->setTag('a') 63 ->setHref($full_uri) 64 ->setIcon('fa-list-ul') 65 ->setText('View All'); 66 $header->addActionLink($view_all); 67 } 68 69 $box = id(new PHUIObjectBoxView()) 70 ->setHeader($header) 71 ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY); 72 73 $table = id(new HarbormasterUnitPropertyView()) 74 ->setViewer($this->getViewer()) 75 ->setUnitMessages($messages); 76 77 if ($this->showViewAll) { 78 $table->setFullResultsURI($full_uri); 79 } 80 81 if ($this->limit) { 82 $table->setLimit($this->limit); 83 } 84 85 $box->setTable($table); 86 87 return $box; 88 } 89 90}