1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-30 09:20:58 +01:00

Hide lint and unit error details

Summary:
Before: {F10754}

After: {F10753}

Test Plan:
View revision with lint warnings and unit errors.
Click on Details.
Click on Details.
Click on Details.
Click on Details.

Reviewers: asukhachev, epriestley

Reviewed By: epriestley

CC: aran, Koolvin

Differential Revision: https://secure.phabricator.com/D2351
This commit is contained in:
vrana 2012-04-30 16:08:01 -07:00
parent 4f9e5323ed
commit 4cc61687aa
6 changed files with 93 additions and 2 deletions

View file

@ -987,6 +987,18 @@ celerity_register_resource_map(array(
),
'disk' => '/rsrc/js/application/differential/behavior-show-all-comments.js',
),
'javelin-behavior-differential-show-field-details' =>
array(
'uri' => '/res/1dfd4d10/rsrc/js/application/differential/behavior-show-field-details.js',
'type' => 'js',
'requires' =>
array(
0 => 'javelin-behavior',
1 => 'javelin-stratcom',
2 => 'javelin-dom',
),
'disk' => '/rsrc/js/application/differential/behavior-show-field-details.js',
),
'javelin-behavior-differential-show-more' =>
array(
'uri' => '/res/e92c5272/rsrc/js/application/differential/behavior-show-more.js',

View file

@ -52,6 +52,8 @@ final class DifferentialLintFieldSpecification
$lmsg = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff);
$ldata = $this->getDiffProperty('arc:lint');
$ltail = null;
$have_details = false;
if ($ldata) {
$ldata = igroup($ldata, 'path');
$lint_messages = array();
@ -78,11 +80,20 @@ final class DifferentialLintFieldSpecification
),
$line_link);
}
if ($description != '') {
$have_details = true;
}
$message_markup[] = hsprintf(
'<li>'.
'<span class="lint-severity-%s">%s</span> (%s) %s '.
'at line '.$line_link.
'<p>%s</p>'.
javelin_render_tag(
'div',
array(
'sigil' => 'differential-field-detail',
'style' => 'display: none;',
),
'%s').
'</li>',
$severity,
ucwords($severity),
@ -106,6 +117,17 @@ final class DifferentialLintFieldSpecification
'</div>';
}
Javelin::initBehavior('differential-show-field-details');
if ($have_details) {
$lmsg .= ' - '.javelin_render_tag(
'a',
array(
'href' => '#details',
'sigil' => 'differential-show-field-details',
),
'Details');
}
return $lstar.' '.$lmsg.$ltail;
}
}

View file

@ -8,6 +8,8 @@
phutil_require_module('phabricator', 'applications/differential/field/specification/base');
phutil_require_module('phabricator', 'applications/differential/view/revisionupdatehistory');
phutil_require_module('phabricator', 'infrastructure/javelin/api');
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
phutil_require_module('phutil', 'markup');
phutil_require_module('phutil', 'utils');

View file

@ -53,6 +53,7 @@ final class DifferentialUnitFieldSpecification
$postponed_count = 0;
$udata = $this->getDiffProperty('arc:unit');
$utail = null;
$have_details = false;
if ($udata) {
$unit_messages = array();
@ -66,6 +67,10 @@ final class DifferentialUnitFieldSpecification
$userdata = phutil_utf8_shorten(idx($test, 'userdata'), 512);
$userdata = $engine->markupText($userdata);
if ($userdata != '') {
$have_details = true;
}
$unit_messages[] =
'<li>'.
'<span class="unit-result-'.phutil_escape_html($result).'">'.
@ -73,7 +78,13 @@ final class DifferentialUnitFieldSpecification
'</span>'.
' '.
phutil_escape_html($name).
'<p>'.$userdata.'</p>'.
javelin_render_tag(
'div',
array(
'sigil' => 'differential-field-detail',
'style' => 'display: none;',
),
$userdata).
'</li>';
} else if ($result == DifferentialUnitTestResult::RESULT_POSTPONED) {
@ -98,6 +109,17 @@ final class DifferentialUnitFieldSpecification
$umsg = $postponed_count.' '.$umsg;
}
Javelin::initBehavior('differential-show-field-details');
if ($have_details) {
$umsg .= ' - '.javelin_render_tag(
'a',
array(
'href' => '#details',
'sigil' => 'differential-show-field-details',
),
'Details');
}
return $ustar.' '.$umsg.$utail;
}

View file

@ -11,6 +11,8 @@ phutil_require_module('phabricator', 'applications/differential/constants/unitte
phutil_require_module('phabricator', 'applications/differential/field/specification/base');
phutil_require_module('phabricator', 'applications/differential/view/revisionupdatehistory');
phutil_require_module('phabricator', 'applications/markup/engine');
phutil_require_module('phabricator', 'infrastructure/javelin/api');
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
phutil_require_module('phutil', 'markup');
phutil_require_module('phutil', 'utils');

View file

@ -0,0 +1,31 @@
/**
* @provides javelin-behavior-differential-show-field-details
* @requires javelin-behavior
* javelin-stratcom
* javelin-dom
*/
JX.behavior('differential-show-field-details', function() {
JX.Stratcom.listen(
'click',
'differential-show-field-details',
function(e) {
var node = e.getNode('tag:td');
var data = JX.Stratcom.getData(node);
var details = JX.DOM.scry(
node,
'div',
'differential-field-detail');
for (var i=0; i < details.length; i++) {
if (!data.detailsShown) {
JX.DOM.show(details[i]);
} else {
JX.DOM.hide(details[i]);
}
}
data.detailsShown = !data.detailsShown;
e.kill();
});
});