Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15414727
D20970.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D20970.diff
View Options
diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuildUnitMessage.php b/src/applications/harbormaster/storage/build/HarbormasterBuildUnitMessage.php
--- a/src/applications/harbormaster/storage/build/HarbormasterBuildUnitMessage.php
+++ b/src/applications/harbormaster/storage/build/HarbormasterBuildUnitMessage.php
@@ -179,18 +179,23 @@
$is_text = ($format !== self::FORMAT_REMARKUP);
$is_remarkup = ($format === self::FORMAT_REMARKUP);
+ $message = null;
$full_details = $this->getUnitMessageDetails();
+ $byte_length = strlen($full_details);
- if (!strlen($full_details)) {
+ $text_limit = 1024 * 2;
+ $remarkup_limit = 1024 * 8;
+
+ if (!$byte_length) {
if ($summarize) {
return null;
}
- $details = phutil_tag('em', array(), pht('No details provided.'));
+ $message = phutil_tag('em', array(), pht('No details provided.'));
} else if ($summarize) {
if ($is_text) {
$details = id(new PhutilUTF8StringTruncator())
- ->setMaximumBytes(2048)
+ ->setMaximumBytes($text_limit)
->truncateString($full_details);
$details = phutil_split_lines($details);
@@ -201,7 +206,34 @@
$details = implode('', $details);
} else {
- $details = $full_details;
+ if ($byte_length > $remarkup_limit) {
+ $uri = $this->getURI();
+
+ if ($uri) {
+ $link = phutil_tag(
+ 'a',
+ array(
+ 'href' => $uri,
+ 'target' => '_blank',
+ ),
+ pht('View Details'));
+ } else {
+ $link = null;
+ }
+
+ $message = array();
+ $message[] = phutil_tag(
+ 'em',
+ array(),
+ pht('This test has too much data to display inline.'));
+ if ($link) {
+ $message[] = $link;
+ }
+
+ $message = phutil_implode_html(" \xC2\xB7 ", $message);
+ } else {
+ $details = $full_details;
+ }
}
} else {
$details = $full_details;
@@ -212,19 +244,47 @@
$classes = array();
$classes[] = 'harbormaster-unit-details';
- if ($is_remarkup) {
+ if ($message !== null) {
+ // If we have a message, show that instead of rendering any test details.
+ $details = $message;
+ } else if ($is_remarkup) {
$details = new PHUIRemarkupView($viewer, $details);
} else {
$classes[] = 'harbormaster-unit-details-text';
$classes[] = 'PhabricatorMonospaced';
}
- return phutil_tag(
+ $warning = null;
+ if (!$summarize) {
+ $warnings = array();
+
+ if ($is_remarkup && ($byte_length > $remarkup_limit)) {
+ $warnings[] = pht(
+ 'This test result has %s bytes of Remarkup test details. Remarkup '.
+ 'blocks longer than %s bytes are not rendered inline when showing '.
+ 'test summaries.',
+ new PhutilNumber($byte_length),
+ new PhutilNumber($remarkup_limit));
+ }
+
+ if ($warnings) {
+ $warning = id(new PHUIInfoView())
+ ->setSeverity(PHUIInfoView::SEVERITY_WARNING)
+ ->setErrors($warnings);
+ }
+ }
+
+ $content = phutil_tag(
'div',
array(
'class' => implode(' ', $classes),
),
$details);
+
+ return array(
+ $warning,
+ $content,
+ );
}
public function getUnitMessageDisplayName() {
@@ -262,6 +322,18 @@
return implode("\0", $parts);
}
+ public function getURI() {
+ $id = $this->getID();
+
+ if (!$id) {
+ return null;
+ }
+
+ return urisprintf(
+ '/harbormaster/unit/view/%d/',
+ $id);
+ }
+
public function save() {
if ($this->nameIndex === null) {
$this->nameIndex = HarbormasterString::newIndex($this->getName());
diff --git a/src/applications/harbormaster/view/HarbormasterUnitPropertyView.php b/src/applications/harbormaster/view/HarbormasterUnitPropertyView.php
--- a/src/applications/harbormaster/view/HarbormasterUnitPropertyView.php
+++ b/src/applications/harbormaster/view/HarbormasterUnitPropertyView.php
@@ -72,13 +72,13 @@
}
$name = $message->getUnitMessageDisplayName();
- $id = $message->getID();
+ $uri = $message->getURI();
- if ($id) {
+ if ($uri) {
$name = phutil_tag(
'a',
array(
- 'href' => "/harbormaster/unit/view/{$id}/",
+ 'href' => $uri,
),
$name);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 21, 2:09 AM (2 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7341758
Default Alt Text
D20970.diff (4 KB)
Attached To
Mode
D20970: In summary interfaces, don't render very large inline remarkup details for unit test messages
Attached
Detach File
Event Timeline
Log In to Comment