Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/view/HarbormasterUnitPropertyView.php
| Show All 28 Lines | public function setFullResultsURI($full_results_uri) { | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function setNotice($notice) { | public function setNotice($notice) { | ||||
| $this->notice = $notice; | $this->notice = $notice; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function render() { | public function render() { | ||||
| require_celerity_resource('harbormaster-css'); | $viewer = $this->getViewer(); | ||||
| $messages = $this->unitMessages; | $messages = $this->unitMessages; | ||||
| $messages = msort($messages, 'getSortKey'); | $messages = msort($messages, 'getSortKey'); | ||||
| $limit = $this->limit; | $limit = $this->limit; | ||||
| if ($this->limit) { | if ($this->limit) { | ||||
| $display_messages = array_slice($messages, 0, $limit); | $display_messages = array_slice($messages, 0, $limit); | ||||
| Show All 31 Lines | foreach ($display_messages as $message) { | ||||
| $name = phutil_tag( | $name = phutil_tag( | ||||
| 'a', | 'a', | ||||
| array( | array( | ||||
| 'href' => "/harbormaster/unit/view/{$id}/", | 'href' => "/harbormaster/unit/view/{$id}/", | ||||
| ), | ), | ||||
| $name); | $name); | ||||
| } | } | ||||
| $details = $message->getUnitMessageDetails(); | |||||
| if (strlen($details)) { | |||||
| $name = array( | $name = array( | ||||
| $name, | $name, | ||||
| $this->renderUnitTestDetails($details), | $message->newUnitMessageDetailsView($viewer, true), | ||||
| ); | ); | ||||
| } | |||||
| $rows[] = array( | $rows[] = array( | ||||
| $result_icon, | $result_icon, | ||||
| $duration, | $duration, | ||||
| $name, | $name, | ||||
| ); | ); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | public function render() { | ||||
| if ($this->notice) { | if ($this->notice) { | ||||
| $table->setNotice($this->notice); | $table->setNotice($this->notice); | ||||
| } | } | ||||
| return $table; | return $table; | ||||
| } | } | ||||
| private function renderUnitTestDetails($full_details) { | |||||
| $details = id(new PhutilUTF8StringTruncator()) | |||||
| ->setMaximumBytes(2048) | |||||
| ->truncateString($full_details); | |||||
| $details = phutil_split_lines($details); | |||||
| $limit = 3; | |||||
| if (count($details) > $limit) { | |||||
| $details = array_slice($details, 0, $limit); | |||||
| } | |||||
| $details = implode('', $details); | |||||
| return phutil_tag( | |||||
| 'div', | |||||
| array( | |||||
| 'class' => 'PhabricatorMonospaced harbormaster-unit-details', | |||||
| ), | |||||
| $details); | |||||
| } | |||||
| } | } | ||||