@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
at recaptime-dev/main 73 lines 1.8 kB view raw
1<?php 2 3final class HarbormasterUnitMessageListController 4 extends HarbormasterController { 5 6 public function shouldAllowPublic() { 7 return true; 8 } 9 10 public function handleRequest(AphrontRequest $request) { 11 $viewer = $this->getViewer(); 12 13 $buildable = id(new HarbormasterBuildableQuery()) 14 ->setViewer($viewer) 15 ->withIDs(array($request->getURIData('id'))) 16 ->needBuilds(true) 17 ->needTargets(true) 18 ->executeOne(); 19 if (!$buildable) { 20 return new Aphront404Response(); 21 } 22 23 $id = $buildable->getID(); 24 25 $target_phids = array(); 26 foreach ($buildable->getBuilds() as $build) { 27 foreach ($build->getBuildTargets() as $target) { 28 $target_phids[] = $target->getPHID(); 29 } 30 } 31 32 $unit_data = array(); 33 if ($target_phids) { 34 $unit_data = id(new HarbormasterBuildUnitMessageQuery()) 35 ->setViewer($viewer) 36 ->withBuildTargetPHIDs($target_phids) 37 ->execute(); 38 } else { 39 $unit_data = array(); 40 } 41 42 $unit = id(new HarbormasterUnitSummaryView()) 43 ->setViewer($viewer) 44 ->setBuildable($buildable) 45 ->setUnitMessages($unit_data); 46 47 $crumbs = $this->buildApplicationCrumbs(); 48 $this->addBuildableCrumb($crumbs, $buildable); 49 $crumbs->addTextCrumb(pht('Unit Tests')); 50 $crumbs->setBorder(true); 51 52 $title = array( 53 $buildable->getMonogram(), 54 pht('Unit Tests'), 55 ); 56 57 $header = id(new PHUIHeaderView()) 58 ->setHeader($buildable->getMonogram().' '.pht('Unit Tests')); 59 60 $view = id(new PHUITwoColumnView()) 61 ->setHeader($header) 62 ->setFooter(array( 63 $unit, 64 )); 65 66 return $this->newPage() 67 ->setTitle($title) 68 ->setCrumbs($crumbs) 69 ->appendChild($view); 70 71 } 72 73}