mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 05:50:55 +01:00
Further improve unit/lint rendering
Summary: I think this improves things, let me know if you have feedback. Also addresses T840. Test Plan: See screenshots... Reviewers: vrana, btrahan, jungejason Reviewed By: vrana CC: aran, zeeg Maniphest Tasks: T840 Differential Revision: https://secure.phabricator.com/D2357
This commit is contained in:
parent
8988667dcc
commit
f04d8ab1a7
13 changed files with 538 additions and 242 deletions
|
@ -88,7 +88,7 @@ $package_spec = array(
|
||||||
'differential.pkg.css' => array(
|
'differential.pkg.css' => array(
|
||||||
'differential-core-view-css',
|
'differential-core-view-css',
|
||||||
'differential-changeset-view-css',
|
'differential-changeset-view-css',
|
||||||
'differential-revision-detail-css',
|
'differential-results-table-css',
|
||||||
'differential-revision-history-css',
|
'differential-revision-history-css',
|
||||||
'differential-table-of-contents-css',
|
'differential-table-of-contents-css',
|
||||||
'differential-revision-comment-css',
|
'differential-revision-comment-css',
|
||||||
|
|
|
@ -571,6 +571,15 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'disk' => '/rsrc/css/application/differential/local-commits-view.css',
|
'disk' => '/rsrc/css/application/differential/local-commits-view.css',
|
||||||
),
|
),
|
||||||
|
'differential-results-table-css' =>
|
||||||
|
array(
|
||||||
|
'uri' => '/res/470b474d/rsrc/css/application/differential/results-table.css',
|
||||||
|
'type' => 'css',
|
||||||
|
'requires' =>
|
||||||
|
array(
|
||||||
|
),
|
||||||
|
'disk' => '/rsrc/css/application/differential/results-table.css',
|
||||||
|
),
|
||||||
'differential-revision-add-comment-css' =>
|
'differential-revision-add-comment-css' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/849748d3/rsrc/css/application/differential/add-comment.css',
|
'uri' => '/res/849748d3/rsrc/css/application/differential/add-comment.css',
|
||||||
|
@ -598,15 +607,6 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'disk' => '/rsrc/css/application/differential/revision-comment-list.css',
|
'disk' => '/rsrc/css/application/differential/revision-comment-list.css',
|
||||||
),
|
),
|
||||||
'differential-revision-detail-css' =>
|
|
||||||
array(
|
|
||||||
'uri' => '/res/a838bf31/rsrc/css/application/differential/revision-detail.css',
|
|
||||||
'type' => 'css',
|
|
||||||
'requires' =>
|
|
||||||
array(
|
|
||||||
),
|
|
||||||
'disk' => '/rsrc/css/application/differential/revision-detail.css',
|
|
||||||
),
|
|
||||||
'differential-revision-history-css' =>
|
'differential-revision-history-css' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/0d7d515d/rsrc/css/application/differential/revision-history.css',
|
'uri' => '/res/0d7d515d/rsrc/css/application/differential/revision-history.css',
|
||||||
|
@ -989,7 +989,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'javelin-behavior-differential-show-field-details' =>
|
'javelin-behavior-differential-show-field-details' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/1dfd4d10/rsrc/js/application/differential/behavior-show-field-details.js',
|
'uri' => '/res/8d57f459/rsrc/js/application/differential/behavior-show-field-details.js',
|
||||||
'type' => 'js',
|
'type' => 'js',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
@ -2503,14 +2503,14 @@ celerity_register_resource_map(array(
|
||||||
'uri' => '/res/pkg/0c96375e/core.pkg.js',
|
'uri' => '/res/pkg/0c96375e/core.pkg.js',
|
||||||
'type' => 'js',
|
'type' => 'js',
|
||||||
),
|
),
|
||||||
'cf6f734a' =>
|
'27683aba' =>
|
||||||
array(
|
array(
|
||||||
'name' => 'differential.pkg.css',
|
'name' => 'differential.pkg.css',
|
||||||
'symbols' =>
|
'symbols' =>
|
||||||
array(
|
array(
|
||||||
0 => 'differential-core-view-css',
|
0 => 'differential-core-view-css',
|
||||||
1 => 'differential-changeset-view-css',
|
1 => 'differential-changeset-view-css',
|
||||||
2 => 'differential-revision-detail-css',
|
2 => 'differential-results-table-css',
|
||||||
3 => 'differential-revision-history-css',
|
3 => 'differential-revision-history-css',
|
||||||
4 => 'differential-table-of-contents-css',
|
4 => 'differential-table-of-contents-css',
|
||||||
5 => 'differential-revision-comment-css',
|
5 => 'differential-revision-comment-css',
|
||||||
|
@ -2522,7 +2522,7 @@ celerity_register_resource_map(array(
|
||||||
11 => 'differential-local-commits-view-css',
|
11 => 'differential-local-commits-view-css',
|
||||||
12 => 'inline-comment-summary-css',
|
12 => 'inline-comment-summary-css',
|
||||||
),
|
),
|
||||||
'uri' => '/res/pkg/cf6f734a/differential.pkg.css',
|
'uri' => '/res/pkg/27683aba/differential.pkg.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
),
|
),
|
||||||
70509835 =>
|
70509835 =>
|
||||||
|
@ -2645,7 +2645,7 @@ celerity_register_resource_map(array(
|
||||||
'aphront-dialog-view-css' => '9c4e265b',
|
'aphront-dialog-view-css' => '9c4e265b',
|
||||||
'aphront-error-view-css' => '9c4e265b',
|
'aphront-error-view-css' => '9c4e265b',
|
||||||
'aphront-form-view-css' => '9c4e265b',
|
'aphront-form-view-css' => '9c4e265b',
|
||||||
'aphront-headsup-action-list-view-css' => 'cf6f734a',
|
'aphront-headsup-action-list-view-css' => '27683aba',
|
||||||
'aphront-headsup-view-css' => '9c4e265b',
|
'aphront-headsup-view-css' => '9c4e265b',
|
||||||
'aphront-list-filter-view-css' => '9c4e265b',
|
'aphront-list-filter-view-css' => '9c4e265b',
|
||||||
'aphront-pager-view-css' => '9c4e265b',
|
'aphront-pager-view-css' => '9c4e265b',
|
||||||
|
@ -2655,19 +2655,19 @@ celerity_register_resource_map(array(
|
||||||
'aphront-tokenizer-control-css' => '9c4e265b',
|
'aphront-tokenizer-control-css' => '9c4e265b',
|
||||||
'aphront-tooltip-css' => '9c4e265b',
|
'aphront-tooltip-css' => '9c4e265b',
|
||||||
'aphront-typeahead-control-css' => '9c4e265b',
|
'aphront-typeahead-control-css' => '9c4e265b',
|
||||||
'differential-changeset-view-css' => 'cf6f734a',
|
'differential-changeset-view-css' => '27683aba',
|
||||||
'differential-core-view-css' => 'cf6f734a',
|
'differential-core-view-css' => '27683aba',
|
||||||
'differential-inline-comment-editor' => '70509835',
|
'differential-inline-comment-editor' => '70509835',
|
||||||
'differential-local-commits-view-css' => 'cf6f734a',
|
'differential-local-commits-view-css' => '27683aba',
|
||||||
'differential-revision-add-comment-css' => 'cf6f734a',
|
'differential-results-table-css' => '27683aba',
|
||||||
'differential-revision-comment-css' => 'cf6f734a',
|
'differential-revision-add-comment-css' => '27683aba',
|
||||||
'differential-revision-comment-list-css' => 'cf6f734a',
|
'differential-revision-comment-css' => '27683aba',
|
||||||
'differential-revision-detail-css' => 'cf6f734a',
|
'differential-revision-comment-list-css' => '27683aba',
|
||||||
'differential-revision-history-css' => 'cf6f734a',
|
'differential-revision-history-css' => '27683aba',
|
||||||
'differential-table-of-contents-css' => 'cf6f734a',
|
'differential-table-of-contents-css' => '27683aba',
|
||||||
'diffusion-commit-view-css' => 'c8ce2d88',
|
'diffusion-commit-view-css' => 'c8ce2d88',
|
||||||
'diffusion-icons-css' => 'c8ce2d88',
|
'diffusion-icons-css' => 'c8ce2d88',
|
||||||
'inline-comment-summary-css' => 'cf6f734a',
|
'inline-comment-summary-css' => '27683aba',
|
||||||
'javelin-behavior' => '8a5de8a3',
|
'javelin-behavior' => '8a5de8a3',
|
||||||
'javelin-behavior-aphront-basic-tokenizer' => '97f65640',
|
'javelin-behavior-aphront-basic-tokenizer' => '97f65640',
|
||||||
'javelin-behavior-aphront-drag-and-drop' => '70509835',
|
'javelin-behavior-aphront-drag-and-drop' => '70509835',
|
||||||
|
@ -2721,7 +2721,7 @@ celerity_register_resource_map(array(
|
||||||
'maniphest-task-summary-css' => '7839ae2d',
|
'maniphest-task-summary-css' => '7839ae2d',
|
||||||
'maniphest-transaction-detail-css' => '7839ae2d',
|
'maniphest-transaction-detail-css' => '7839ae2d',
|
||||||
'phabricator-app-buttons-css' => '9c4e265b',
|
'phabricator-app-buttons-css' => '9c4e265b',
|
||||||
'phabricator-content-source-view-css' => 'cf6f734a',
|
'phabricator-content-source-view-css' => '27683aba',
|
||||||
'phabricator-core-buttons-css' => '9c4e265b',
|
'phabricator-core-buttons-css' => '9c4e265b',
|
||||||
'phabricator-core-css' => '9c4e265b',
|
'phabricator-core-css' => '9c4e265b',
|
||||||
'phabricator-directory-css' => '9c4e265b',
|
'phabricator-directory-css' => '9c4e265b',
|
||||||
|
@ -2732,7 +2732,7 @@ celerity_register_resource_map(array(
|
||||||
'phabricator-keyboard-shortcut' => '0c96375e',
|
'phabricator-keyboard-shortcut' => '0c96375e',
|
||||||
'phabricator-keyboard-shortcut-manager' => '0c96375e',
|
'phabricator-keyboard-shortcut-manager' => '0c96375e',
|
||||||
'phabricator-menu-item' => '0c96375e',
|
'phabricator-menu-item' => '0c96375e',
|
||||||
'phabricator-object-selector-css' => 'cf6f734a',
|
'phabricator-object-selector-css' => '27683aba',
|
||||||
'phabricator-paste-file-upload' => '0c96375e',
|
'phabricator-paste-file-upload' => '0c96375e',
|
||||||
'phabricator-prefab' => '0c96375e',
|
'phabricator-prefab' => '0c96375e',
|
||||||
'phabricator-project-tag-css' => '7839ae2d',
|
'phabricator-project-tag-css' => '7839ae2d',
|
||||||
|
|
|
@ -260,6 +260,7 @@ phutil_register_library_map(array(
|
||||||
'DifferentialPathFieldSpecification' => 'applications/differential/field/specification/path',
|
'DifferentialPathFieldSpecification' => 'applications/differential/field/specification/path',
|
||||||
'DifferentialPrimaryPaneView' => 'applications/differential/view/primarypane',
|
'DifferentialPrimaryPaneView' => 'applications/differential/view/primarypane',
|
||||||
'DifferentialReplyHandler' => 'applications/differential/replyhandler',
|
'DifferentialReplyHandler' => 'applications/differential/replyhandler',
|
||||||
|
'DifferentialResultsTableView' => 'applications/differential/view/resultstableview',
|
||||||
'DifferentialRevertPlanFieldSpecification' => 'applications/differential/field/specification/revertplan',
|
'DifferentialRevertPlanFieldSpecification' => 'applications/differential/field/specification/revertplan',
|
||||||
'DifferentialReviewRequestMail' => 'applications/differential/mail/reviewrequest',
|
'DifferentialReviewRequestMail' => 'applications/differential/mail/reviewrequest',
|
||||||
'DifferentialReviewedByFieldSpecification' => 'applications/differential/field/specification/reviewedby',
|
'DifferentialReviewedByFieldSpecification' => 'applications/differential/field/specification/reviewedby',
|
||||||
|
@ -1245,6 +1246,7 @@ phutil_register_library_map(array(
|
||||||
'DifferentialPathFieldSpecification' => 'DifferentialFieldSpecification',
|
'DifferentialPathFieldSpecification' => 'DifferentialFieldSpecification',
|
||||||
'DifferentialPrimaryPaneView' => 'AphrontView',
|
'DifferentialPrimaryPaneView' => 'AphrontView',
|
||||||
'DifferentialReplyHandler' => 'PhabricatorMailReplyHandler',
|
'DifferentialReplyHandler' => 'PhabricatorMailReplyHandler',
|
||||||
|
'DifferentialResultsTableView' => 'AphrontView',
|
||||||
'DifferentialRevertPlanFieldSpecification' => 'DifferentialFieldSpecification',
|
'DifferentialRevertPlanFieldSpecification' => 'DifferentialFieldSpecification',
|
||||||
'DifferentialReviewRequestMail' => 'DifferentialMail',
|
'DifferentialReviewRequestMail' => 'DifferentialMail',
|
||||||
'DifferentialReviewedByFieldSpecification' => 'DifferentialFieldSpecification',
|
'DifferentialReviewedByFieldSpecification' => 'DifferentialFieldSpecification',
|
||||||
|
@ -1490,7 +1492,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorDefaultFileStorageEngineSelector' => 'PhabricatorFileStorageEngineSelector',
|
'PhabricatorDefaultFileStorageEngineSelector' => 'PhabricatorFileStorageEngineSelector',
|
||||||
'PhabricatorDefaultSearchEngineSelector' => 'PhabricatorSearchEngineSelector',
|
'PhabricatorDefaultSearchEngineSelector' => 'PhabricatorSearchEngineSelector',
|
||||||
'PhabricatorDirectoryController' => 'PhabricatorController',
|
'PhabricatorDirectoryController' => 'PhabricatorController',
|
||||||
'PhabricatorDirectoryMainController' => 'PhabricatorController',
|
'PhabricatorDirectoryMainController' => 'PhabricatorDirectoryController',
|
||||||
'PhabricatorDisabledUserController' => 'PhabricatorAuthController',
|
'PhabricatorDisabledUserController' => 'PhabricatorAuthController',
|
||||||
'PhabricatorDraft' => 'PhabricatorDraftDAO',
|
'PhabricatorDraft' => 'PhabricatorDraftDAO',
|
||||||
'PhabricatorDraftDAO' => 'PhabricatorLiskDAO',
|
'PhabricatorDraftDAO' => 'PhabricatorLiskDAO',
|
||||||
|
|
|
@ -32,33 +32,50 @@ final class DifferentialLintFieldSpecification
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getLintExcuse() {
|
private function getLintExcuse() {
|
||||||
$excuse = $this->getDiffProperty('arc:lint-excuse');
|
return $this->getDiffProperty('arc:lint-excuse');
|
||||||
$excuse = phutil_escape_html($excuse);
|
|
||||||
$excuse = nl2br($excuse);
|
|
||||||
|
|
||||||
$excuse_markup = '';
|
|
||||||
if (strlen($excuse)) {
|
|
||||||
$excuse_markup = '<p><strong>Explanation for failure(s): </strong></p>'.
|
|
||||||
'<span class="lint-excuse">'.$excuse.'</span>';
|
|
||||||
}
|
|
||||||
return $excuse_markup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderValueForRevisionView() {
|
public function renderValueForRevisionView() {
|
||||||
$diff = $this->getDiff();
|
$diff = $this->getDiff();
|
||||||
$path_changesets = mpull($diff->loadChangesets(), 'getId', 'getFilename');
|
$path_changesets = mpull($diff->loadChangesets(), 'getID', 'getFilename');
|
||||||
|
|
||||||
$lstar = DifferentialRevisionUpdateHistoryView::renderDiffLintStar($diff);
|
$lstar = DifferentialRevisionUpdateHistoryView::renderDiffLintStar($diff);
|
||||||
$lmsg = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff);
|
$lmsg = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff);
|
||||||
$ldata = $this->getDiffProperty('arc:lint');
|
$ldata = $this->getDiffProperty('arc:lint');
|
||||||
$ltail = null;
|
$ltail = null;
|
||||||
$have_details = false;
|
|
||||||
|
$rows = array();
|
||||||
|
|
||||||
|
$rows[] = array(
|
||||||
|
'style' => 'star',
|
||||||
|
'name' => $lstar,
|
||||||
|
'value' => $lmsg,
|
||||||
|
'show' => true,
|
||||||
|
);
|
||||||
|
|
||||||
|
$excuse = $this->getLintExcuse();
|
||||||
|
if ($excuse) {
|
||||||
|
$rows[] = array(
|
||||||
|
'style' => 'excuse',
|
||||||
|
'name' => 'Excuse',
|
||||||
|
'value' => nl2br(phutil_escape_html($excuse)),
|
||||||
|
'show' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$show_limit = 10;
|
||||||
|
$hidden = array();
|
||||||
|
|
||||||
if ($ldata) {
|
if ($ldata) {
|
||||||
$ldata = igroup($ldata, 'path');
|
$ldata = igroup($ldata, 'path');
|
||||||
$lint_messages = array();
|
|
||||||
foreach ($ldata as $path => $messages) {
|
foreach ($ldata as $path => $messages) {
|
||||||
$message_markup = array();
|
|
||||||
|
$rows[] = array(
|
||||||
|
'style' => 'section',
|
||||||
|
'name' => phutil_escape_html($path),
|
||||||
|
'show' => $show_limit,
|
||||||
|
);
|
||||||
|
|
||||||
foreach ($messages as $message) {
|
foreach ($messages as $message) {
|
||||||
$path = idx($message, 'path');
|
$path = idx($message, 'path');
|
||||||
$line = idx($message, 'line');
|
$line = idx($message, 'line');
|
||||||
|
@ -69,7 +86,7 @@ final class DifferentialLintFieldSpecification
|
||||||
$name = idx($message, 'name');
|
$name = idx($message, 'name');
|
||||||
$description = idx($message, 'description');
|
$description = idx($message, 'description');
|
||||||
|
|
||||||
$line_link = phutil_escape_html($line);
|
$line_link = 'line '.phutil_escape_html($line);
|
||||||
if (isset($path_changesets[$path])) {
|
if (isset($path_changesets[$path])) {
|
||||||
// TODO: Create standalone links for large diffs. Logic is in
|
// TODO: Create standalone links for large diffs. Logic is in
|
||||||
// DifferentialDiffTableOfContentsView::renderChangesetLink().
|
// DifferentialDiffTableOfContentsView::renderChangesetLink().
|
||||||
|
@ -80,54 +97,104 @@ final class DifferentialLintFieldSpecification
|
||||||
),
|
),
|
||||||
$line_link);
|
$line_link);
|
||||||
}
|
}
|
||||||
if ($description != '') {
|
|
||||||
$have_details = true;
|
if ($show_limit) {
|
||||||
|
--$show_limit;
|
||||||
|
$show = true;
|
||||||
|
} else {
|
||||||
|
$show = false;
|
||||||
|
if (empty($hidden[$severity])) {
|
||||||
|
$hidden[$severity] = 0;
|
||||||
|
}
|
||||||
|
$hidden[$severity]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rows[] = array(
|
||||||
|
'style' => $this->getSeverityStyle($severity),
|
||||||
|
'name' => phutil_escape_html(ucwords($severity)),
|
||||||
|
'value' => hsprintf(
|
||||||
|
"(%s) %s at {$line_link}",
|
||||||
|
$code,
|
||||||
|
$name),
|
||||||
|
'show' => $show,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (strlen($description)) {
|
||||||
|
$rows[] = array(
|
||||||
|
'style' => 'details',
|
||||||
|
'value' => nl2br(phutil_escape_html($description)),
|
||||||
|
'show' => false,
|
||||||
|
);
|
||||||
|
if (empty($hidden['details'])) {
|
||||||
|
$hidden['details'] = 0;
|
||||||
|
}
|
||||||
|
$hidden['details']++;
|
||||||
}
|
}
|
||||||
$message_markup[] = hsprintf(
|
|
||||||
'<li>'.
|
|
||||||
'<span class="lint-severity-%s">%s</span> (%s) %s '.
|
|
||||||
'at line '.$line_link.
|
|
||||||
javelin_render_tag(
|
|
||||||
'div',
|
|
||||||
array(
|
|
||||||
'sigil' => 'differential-field-detail',
|
|
||||||
'style' => 'display: none;',
|
|
||||||
),
|
|
||||||
'%s').
|
|
||||||
'</li>',
|
|
||||||
$severity,
|
|
||||||
ucwords($severity),
|
|
||||||
$code,
|
|
||||||
$name,
|
|
||||||
$description);
|
|
||||||
}
|
}
|
||||||
$lint_messages[] =
|
|
||||||
'<li class="lint-file-block">'.
|
|
||||||
'Lint for <strong>'.phutil_escape_html($path).'</strong>'.
|
|
||||||
'<ul>'.implode("\n", $message_markup).'</ul>'.
|
|
||||||
'</li>';
|
|
||||||
}
|
}
|
||||||
$lexcuse = $this->getLintExcuse();
|
|
||||||
$ltail =
|
|
||||||
'<div class="differential-lint-block">'.
|
|
||||||
$lexcuse.
|
|
||||||
'<ul>'.
|
|
||||||
implode("\n", $lint_messages).
|
|
||||||
'</ul>'.
|
|
||||||
'</div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Javelin::initBehavior('differential-show-field-details');
|
$show_string = $this->renderShowString($hidden);
|
||||||
if ($have_details) {
|
|
||||||
$lmsg .= ' - '.javelin_render_tag(
|
|
||||||
'a',
|
|
||||||
array(
|
|
||||||
'href' => '#details',
|
|
||||||
'sigil' => 'differential-show-field-details',
|
|
||||||
),
|
|
||||||
'Details');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $lstar.' '.$lmsg.$ltail;
|
$view = new DifferentialResultsTableView();
|
||||||
|
$view->setRows($rows);
|
||||||
|
$view->setShowMoreString($show_string);
|
||||||
|
|
||||||
|
return $view->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getSeverityStyle($severity) {
|
||||||
|
$map = array(
|
||||||
|
ArcanistLintSeverity::SEVERITY_ERROR => 'red',
|
||||||
|
ArcanistLintSeverity::SEVERITY_WARNING => 'yellow',
|
||||||
|
ArcanistLintSeverity::SEVERITY_AUTOFIX => 'yellow',
|
||||||
|
ArcanistLintSeverity::SEVERITY_ADVICE => 'yellow',
|
||||||
|
);
|
||||||
|
return idx($map, $severity);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function renderShowString(array $hidden) {
|
||||||
|
if (!$hidden) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reorder hidden things by severity.
|
||||||
|
$hidden = array_select_keys(
|
||||||
|
$hidden,
|
||||||
|
array(
|
||||||
|
ArcanistLintSeverity::SEVERITY_ERROR,
|
||||||
|
ArcanistLintSeverity::SEVERITY_WARNING,
|
||||||
|
ArcanistLintSeverity::SEVERITY_AUTOFIX,
|
||||||
|
ArcanistLintSeverity::SEVERITY_ADVICE,
|
||||||
|
'details',
|
||||||
|
)) + $hidden;
|
||||||
|
|
||||||
|
$singular = array(
|
||||||
|
ArcanistLintSeverity::SEVERITY_ERROR => 'Error',
|
||||||
|
ArcanistLintSeverity::SEVERITY_WARNING => 'Warning',
|
||||||
|
ArcanistLintSeverity::SEVERITY_AUTOFIX => 'Auto-Fix',
|
||||||
|
ArcanistLintSeverity::SEVERITY_ADVICE => 'Advice',
|
||||||
|
'details' => 'Detail',
|
||||||
|
);
|
||||||
|
|
||||||
|
$plural = array(
|
||||||
|
ArcanistLintSeverity::SEVERITY_ERROR => 'Errors',
|
||||||
|
ArcanistLintSeverity::SEVERITY_WARNING => 'Warnings',
|
||||||
|
ArcanistLintSeverity::SEVERITY_AUTOFIX => 'Auto-Fixes',
|
||||||
|
ArcanistLintSeverity::SEVERITY_ADVICE => 'Advice',
|
||||||
|
'details' => 'Details',
|
||||||
|
);
|
||||||
|
|
||||||
|
$show = array();
|
||||||
|
foreach ($hidden as $key => $value) {
|
||||||
|
if ($value == 1) {
|
||||||
|
$show[] = $value.' '.idx($singular, $key);
|
||||||
|
} else {
|
||||||
|
$show[] = $value.' '.idx($plural, $key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "Show Full Lint Results (".implode(', ', $show).")";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,11 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
phutil_require_module('arcanist', 'lint/severity');
|
||||||
|
|
||||||
phutil_require_module('phabricator', 'applications/differential/field/specification/base');
|
phutil_require_module('phabricator', 'applications/differential/field/specification/base');
|
||||||
|
phutil_require_module('phabricator', 'applications/differential/view/resultstableview');
|
||||||
phutil_require_module('phabricator', 'applications/differential/view/revisionupdatehistory');
|
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', 'markup');
|
||||||
phutil_require_module('phutil', 'utils');
|
phutil_require_module('phutil', 'utils');
|
||||||
|
|
|
@ -32,16 +32,7 @@ final class DifferentialUnitFieldSpecification
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getUnitExcuse() {
|
private function getUnitExcuse() {
|
||||||
$excuse = $this->getDiffProperty('arc:unit-excuse');
|
return $this->getDiffProperty('arc:unit-excuse');
|
||||||
$excuse = phutil_escape_html($excuse);
|
|
||||||
$excuse = nl2br($excuse);
|
|
||||||
|
|
||||||
$excuse_markup = '';
|
|
||||||
if (strlen($excuse)) {
|
|
||||||
$excuse_markup = '<p>Explanation for failure(s): </p>'.
|
|
||||||
'<span class="unit-excuse">'.$excuse.'</span>';
|
|
||||||
}
|
|
||||||
return $excuse_markup;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderValueForRevisionView() {
|
public function renderValueForRevisionView() {
|
||||||
|
@ -50,77 +41,145 @@ final class DifferentialUnitFieldSpecification
|
||||||
$ustar = DifferentialRevisionUpdateHistoryView::renderDiffUnitStar($diff);
|
$ustar = DifferentialRevisionUpdateHistoryView::renderDiffUnitStar($diff);
|
||||||
$umsg = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage($diff);
|
$umsg = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage($diff);
|
||||||
|
|
||||||
$postponed_count = 0;
|
$rows = array();
|
||||||
$udata = $this->getDiffProperty('arc:unit');
|
|
||||||
$utail = null;
|
|
||||||
$have_details = false;
|
|
||||||
|
|
||||||
|
$rows[] = array(
|
||||||
|
'style' => 'star',
|
||||||
|
'name' => $ustar,
|
||||||
|
'value' => $umsg,
|
||||||
|
'show' => true,
|
||||||
|
);
|
||||||
|
|
||||||
|
$excuse = $this->getUnitExcuse();
|
||||||
|
if ($excuse) {
|
||||||
|
$rows[] = array(
|
||||||
|
'style' => 'excuse',
|
||||||
|
'name' => 'Excuse',
|
||||||
|
'value' => nl2br(phutil_escape_html($excuse)),
|
||||||
|
'show' => true,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$show_limit = 10;
|
||||||
|
$hidden = array();
|
||||||
|
|
||||||
|
$udata = $this->getDiffProperty('arc:unit');
|
||||||
if ($udata) {
|
if ($udata) {
|
||||||
$unit_messages = array();
|
$sort_map = array(
|
||||||
|
ArcanistUnitTestResult::RESULT_BROKEN => 0,
|
||||||
|
ArcanistUnitTestResult::RESULT_FAIL => 1,
|
||||||
|
ArcanistUnitTestResult::RESULT_UNSOUND => 2,
|
||||||
|
ArcanistUnitTestResult::RESULT_SKIP => 3,
|
||||||
|
ArcanistUnitTestResult::RESULT_POSTPONED => 4,
|
||||||
|
ArcanistUnitTestResult::RESULT_PASS => 5,
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($udata as $key => $test) {
|
||||||
|
$udata[$key]['sort'] = idx($sort_map, idx($test, 'result'));
|
||||||
|
}
|
||||||
|
$udata = isort($udata, 'sort');
|
||||||
|
|
||||||
foreach ($udata as $test) {
|
foreach ($udata as $test) {
|
||||||
$name = idx($test, 'name');
|
|
||||||
$result = idx($test, 'result');
|
$result = idx($test, 'result');
|
||||||
|
|
||||||
if ($result != DifferentialUnitTestResult::RESULT_POSTPONED &&
|
$default_hide = false;
|
||||||
$result != DifferentialUnitTestResult::RESULT_PASS) {
|
switch ($result) {
|
||||||
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
|
case ArcanistUnitTestResult::RESULT_POSTPONED:
|
||||||
$userdata = phutil_utf8_shorten(idx($test, 'userdata'), 512);
|
case ArcanistUnitTestResult::RESULT_PASS:
|
||||||
$userdata = $engine->markupText($userdata);
|
$default_hide = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if ($userdata != '') {
|
if ($show_limit && !$default_hide) {
|
||||||
$have_details = true;
|
--$show_limit;
|
||||||
|
$show = true;
|
||||||
|
} else {
|
||||||
|
$show = false;
|
||||||
|
if (empty($hidden[$result])) {
|
||||||
|
$hidden[$result] = 0;
|
||||||
}
|
}
|
||||||
|
$hidden[$result]++;
|
||||||
|
}
|
||||||
|
|
||||||
$unit_messages[] =
|
$rows[] = array(
|
||||||
'<li>'.
|
'style' => $this->getResultStyle($result),
|
||||||
'<span class="unit-result-'.phutil_escape_html($result).'">'.
|
'name' => phutil_escape_html(ucwords($result)),
|
||||||
phutil_escape_html(ucwords($result)).
|
'value' => phutil_escape_html(idx($test, 'name')),
|
||||||
'</span>'.
|
'show' => $show,
|
||||||
' '.
|
);
|
||||||
phutil_escape_html($name).
|
|
||||||
javelin_render_tag(
|
|
||||||
'div',
|
|
||||||
array(
|
|
||||||
'sigil' => 'differential-field-detail',
|
|
||||||
'style' => 'display: none;',
|
|
||||||
),
|
|
||||||
$userdata).
|
|
||||||
'</li>';
|
|
||||||
|
|
||||||
} else if ($result == DifferentialUnitTestResult::RESULT_POSTPONED) {
|
$userdata = idx($test, 'userdata');
|
||||||
$postponed_count++;
|
if ($userdata) {
|
||||||
|
$engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine();
|
||||||
|
$userdata = $engine->markupText($userdata);
|
||||||
|
$rows[] = array(
|
||||||
|
'style' => 'details',
|
||||||
|
'value' => $userdata,
|
||||||
|
'show' => false,
|
||||||
|
);
|
||||||
|
if (empty($hidden['details'])) {
|
||||||
|
$hidden['details'] = 0;
|
||||||
|
}
|
||||||
|
$hidden['details']++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$uexcuse = $this->getUnitExcuse();
|
|
||||||
if ($unit_messages) {
|
|
||||||
$utail =
|
|
||||||
'<div class="differential-unit-block">'.
|
|
||||||
$uexcuse.
|
|
||||||
'<ul>'.
|
|
||||||
implode("\n", $unit_messages).
|
|
||||||
'</ul>'.
|
|
||||||
'</div>';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($postponed_count > 0 &&
|
$show_string = $this->renderShowString($hidden);
|
||||||
$diff->getUnitStatus() == DifferentialUnitStatus::UNIT_POSTPONED) {
|
|
||||||
$umsg = $postponed_count.' '.$umsg;
|
$view = new DifferentialResultsTableView();
|
||||||
|
$view->setRows($rows);
|
||||||
|
$view->setShowMoreString($show_string);
|
||||||
|
|
||||||
|
return $view->render();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getResultStyle($result) {
|
||||||
|
$map = array(
|
||||||
|
ArcanistUnitTestResult::RESULT_PASS => 'green',
|
||||||
|
ArcanistUnitTestResult::RESULT_FAIL => 'red',
|
||||||
|
ArcanistUnitTestResult::RESULT_SKIP => 'blue',
|
||||||
|
ArcanistUnitTestResult::RESULT_BROKEN => 'red',
|
||||||
|
ArcanistUnitTestResult::RESULT_UNSOUND => 'yellow',
|
||||||
|
ArcanistUnitTestResult::RESULT_POSTPONED => 'blue',
|
||||||
|
);
|
||||||
|
return idx($map, $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function renderShowString(array $hidden) {
|
||||||
|
if (!$hidden) {
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Javelin::initBehavior('differential-show-field-details');
|
// Reorder hidden things by severity.
|
||||||
if ($have_details) {
|
$hidden = array_select_keys(
|
||||||
$umsg .= ' - '.javelin_render_tag(
|
$hidden,
|
||||||
'a',
|
array(
|
||||||
array(
|
ArcanistUnitTestResult::RESULT_BROKEN,
|
||||||
'href' => '#details',
|
ArcanistUnitTestResult::RESULT_FAIL,
|
||||||
'sigil' => 'differential-show-field-details',
|
ArcanistUnitTestResult::RESULT_UNSOUND,
|
||||||
),
|
ArcanistUnitTestResult::RESULT_SKIP,
|
||||||
'Details');
|
ArcanistUnitTestResult::RESULT_POSTPONED,
|
||||||
|
ArcanistUnitTestResult::RESULT_PASS,
|
||||||
|
'details',
|
||||||
|
)) + $hidden;
|
||||||
|
|
||||||
|
$noun = array(
|
||||||
|
ArcanistUnitTestResult::RESULT_BROKEN => 'Broken',
|
||||||
|
ArcanistUnitTestResult::RESULT_FAIL => 'Failed',
|
||||||
|
ArcanistUnitTestResult::RESULT_UNSOUND => 'Unsound',
|
||||||
|
ArcanistUnitTestResult::RESULT_SKIP => 'Skipped',
|
||||||
|
ArcanistUnitTestResult::RESULT_POSTPONED => 'Postponed',
|
||||||
|
ArcanistUnitTestResult::RESULT_PASS => 'Passed',
|
||||||
|
'details' => 'Details',
|
||||||
|
);
|
||||||
|
|
||||||
|
$show = array();
|
||||||
|
foreach ($hidden as $key => $value) {
|
||||||
|
$show[] = $value.' '.idx($noun, $key);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ustar.' '.$umsg.$utail;
|
return "Show Full Unit Results (".implode(', ', $show).")";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,12 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
phutil_require_module('phabricator', 'applications/differential/constants/unitstatus');
|
phutil_require_module('arcanist', 'unit/result');
|
||||||
phutil_require_module('phabricator', 'applications/differential/constants/unittestresult');
|
|
||||||
phutil_require_module('phabricator', 'applications/differential/field/specification/base');
|
phutil_require_module('phabricator', 'applications/differential/field/specification/base');
|
||||||
|
phutil_require_module('phabricator', 'applications/differential/view/resultstableview');
|
||||||
phutil_require_module('phabricator', 'applications/differential/view/revisionupdatehistory');
|
phutil_require_module('phabricator', 'applications/differential/view/revisionupdatehistory');
|
||||||
phutil_require_module('phabricator', 'applications/markup/engine');
|
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', 'markup');
|
||||||
phutil_require_module('phutil', 'utils');
|
phutil_require_module('phutil', 'utils');
|
||||||
|
|
|
@ -0,0 +1,131 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright 2012 Facebook, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
final class DifferentialResultsTableView extends AphrontView {
|
||||||
|
|
||||||
|
private $rows;
|
||||||
|
private $showMoreString;
|
||||||
|
|
||||||
|
public function setRows(array $rows) {
|
||||||
|
$this->rows = $rows;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setShowMoreString($show_more_string) {
|
||||||
|
$this->showMoreString = $show_more_string;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function render() {
|
||||||
|
|
||||||
|
$rows = array();
|
||||||
|
|
||||||
|
$any_hidden = false;
|
||||||
|
foreach ($this->rows as $row) {
|
||||||
|
|
||||||
|
$style = idx($row, 'style');
|
||||||
|
switch ($style) {
|
||||||
|
case 'section':
|
||||||
|
$cells = phutil_render_tag(
|
||||||
|
'th',
|
||||||
|
array(
|
||||||
|
'colspan' => 2,
|
||||||
|
),
|
||||||
|
idx($row, 'name'));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$name = phutil_render_tag(
|
||||||
|
'th',
|
||||||
|
array(
|
||||||
|
),
|
||||||
|
idx($row, 'name'));
|
||||||
|
$value = phutil_render_tag(
|
||||||
|
'td',
|
||||||
|
array(
|
||||||
|
),
|
||||||
|
idx($row, 'value'));
|
||||||
|
$cells = $name.$value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$show = idx($row, 'show');
|
||||||
|
|
||||||
|
$rows[] = javelin_render_tag(
|
||||||
|
'tr',
|
||||||
|
array(
|
||||||
|
'style' => $show ? null : 'display: none',
|
||||||
|
'sigil' => $show ? null : 'differential-results-row-toggle',
|
||||||
|
'class' => 'differential-results-row-'.$style,
|
||||||
|
),
|
||||||
|
$cells);
|
||||||
|
|
||||||
|
if (!$show) {
|
||||||
|
$any_hidden = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($any_hidden) {
|
||||||
|
$show_more = javelin_render_tag(
|
||||||
|
'a',
|
||||||
|
array(
|
||||||
|
'href' => '#',
|
||||||
|
'mustcapture' => true,
|
||||||
|
),
|
||||||
|
$this->showMoreString);
|
||||||
|
|
||||||
|
$hide_more = javelin_render_tag(
|
||||||
|
'a',
|
||||||
|
array(
|
||||||
|
'href' => '#',
|
||||||
|
'mustcapture' => true,
|
||||||
|
),
|
||||||
|
'Hide');
|
||||||
|
|
||||||
|
$rows[] = javelin_render_tag(
|
||||||
|
'tr',
|
||||||
|
array(
|
||||||
|
'class' => 'differential-results-row-show',
|
||||||
|
'sigil' => 'differential-results-row-show',
|
||||||
|
),
|
||||||
|
'<th colspan="2">'.$show_more.'</td>');
|
||||||
|
|
||||||
|
$rows[] = javelin_render_tag(
|
||||||
|
'tr',
|
||||||
|
array(
|
||||||
|
'class' => 'differential-results-row-show',
|
||||||
|
'sigil' => 'differential-results-row-hide',
|
||||||
|
'style' => 'display: none',
|
||||||
|
),
|
||||||
|
'<th colspan="2">'.$hide_more.'</th>');
|
||||||
|
|
||||||
|
Javelin::initBehavior('differential-show-field-details');
|
||||||
|
}
|
||||||
|
|
||||||
|
require_celerity_resource('differential-results-table-css');
|
||||||
|
|
||||||
|
return javelin_render_tag(
|
||||||
|
'table',
|
||||||
|
array(
|
||||||
|
'class' => 'differential-results-table',
|
||||||
|
'sigil' => 'differential-results-table',
|
||||||
|
),
|
||||||
|
implode("\n", $rows));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* This file is automatically generated. Lint this module to rebuild it.
|
||||||
|
* @generated
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||||
|
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
||||||
|
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
|
||||||
|
phutil_require_module('phabricator', 'view/base');
|
||||||
|
|
||||||
|
phutil_require_module('phutil', 'markup');
|
||||||
|
phutil_require_module('phutil', 'utils');
|
||||||
|
|
||||||
|
|
||||||
|
phutil_require_source('DifferentialResultsTableView.php');
|
|
@ -47,7 +47,6 @@ final class DifferentialRevisionDetailView extends AphrontView {
|
||||||
public function render() {
|
public function render() {
|
||||||
|
|
||||||
require_celerity_resource('differential-core-view-css');
|
require_celerity_resource('differential-core-view-css');
|
||||||
require_celerity_resource('differential-revision-detail-css');
|
|
||||||
|
|
||||||
$revision = $this->revision;
|
$revision = $this->revision;
|
||||||
|
|
||||||
|
|
79
webroot/rsrc/css/application/differential/results-table.css
Normal file
79
webroot/rsrc/css/application/differential/results-table.css
Normal file
|
@ -0,0 +1,79 @@
|
||||||
|
/**
|
||||||
|
* @provides differential-results-table-css
|
||||||
|
*/
|
||||||
|
|
||||||
|
table.differential-results-table {
|
||||||
|
border-collapse: separate;
|
||||||
|
border-spacing: 1px;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 11px;
|
||||||
|
background: #fcfcec;
|
||||||
|
}
|
||||||
|
|
||||||
|
.differential-results-table th {
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
vertical-align: middle;
|
||||||
|
padding: 2px 4px;
|
||||||
|
margin: 0;
|
||||||
|
width: 70px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.differential-results-table td {
|
||||||
|
padding: 2px 8px;
|
||||||
|
margin: 0;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
.differential-results-table tr.differential-results-row-star th,
|
||||||
|
.differential-results-table tr.differential-results-row-star td {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: bold;
|
||||||
|
background: #dfdfcf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.differential-results-table tr.differential-results-row-section th {
|
||||||
|
font-weight: bold;
|
||||||
|
padding-top: 4px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.differential-results-table tr.differential-results-row-excuse th {
|
||||||
|
background: #3399ff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.differential-results-table tr.differential-results-row-excuse td {
|
||||||
|
padding-top: 1em;
|
||||||
|
padding-right: 1em;
|
||||||
|
padding-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.differential-results-table tr.differential-results-row-red th {
|
||||||
|
background: #ff4422;
|
||||||
|
}
|
||||||
|
|
||||||
|
.differential-results-table tr.differential-results-row-yellow th {
|
||||||
|
background: #ffdd66;
|
||||||
|
}
|
||||||
|
|
||||||
|
.differential-results-table tr.differential-results-row-green th {
|
||||||
|
background: #22dd44;
|
||||||
|
}
|
||||||
|
|
||||||
|
.differential-results-table tr.differential-results-row-blue th {
|
||||||
|
background: #88bbff;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.differential-results-table tr.differential-results-row-details td {
|
||||||
|
color: #888888;
|
||||||
|
}
|
||||||
|
|
||||||
|
.differential-results-table tr.differential-results-row-show th {
|
||||||
|
padding: 4px;
|
||||||
|
color: #888888;
|
||||||
|
font-weight: bold;
|
||||||
|
background: #dfdfcf;
|
||||||
|
}
|
|
@ -1,68 +0,0 @@
|
||||||
/**
|
|
||||||
* @provides differential-revision-detail-css
|
|
||||||
*/
|
|
||||||
|
|
||||||
.differential-unit-block,
|
|
||||||
.differential-lint-block {
|
|
||||||
padding: .5em;
|
|
||||||
background: #fcfcec;
|
|
||||||
margin: .5em 0;
|
|
||||||
font-size: 11px;
|
|
||||||
line-height: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-lint-block .lint-severity-warning {
|
|
||||||
background: #ffff66;
|
|
||||||
padding: 0 0.5em;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-lint-block .lint-severity-error {
|
|
||||||
background: #ff3333;
|
|
||||||
padding: 0 0.5em;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-lint-block .lint-file-block {
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-lint-block li li {
|
|
||||||
margin-left: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-lint-block li li p {
|
|
||||||
margin-left: 1em;
|
|
||||||
color: #666666;
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-unit-block li {
|
|
||||||
margin-left: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-unit-block li p {
|
|
||||||
margin-left: 1em;
|
|
||||||
color: #666666;
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-unit-block .unit-test-result {
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-unit-block .unit-result-fail {
|
|
||||||
background: #ff3333;
|
|
||||||
padding: 0 0.5em;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-unit-block .unit-result-unsound {
|
|
||||||
background: #cc33cc;
|
|
||||||
padding: 0 0.5em;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.differential-lint-block .lint-excuse,
|
|
||||||
.differential-unit-block .unit-excuse {
|
|
||||||
background: #808080;
|
|
||||||
color: #ffff66;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
|
@ -5,27 +5,36 @@
|
||||||
* javelin-dom
|
* javelin-dom
|
||||||
*/
|
*/
|
||||||
|
|
||||||
JX.behavior('differential-show-field-details', function() {
|
JX.behavior('differential-show-field-details', function(config) {
|
||||||
|
|
||||||
JX.Stratcom.listen(
|
JX.Stratcom.listen(
|
||||||
'click',
|
'click',
|
||||||
'differential-show-field-details',
|
['differential-results-row-show', 'tag:a'],
|
||||||
function(e) {
|
function(e) {
|
||||||
var node = e.getNode('tag:td');
|
toggle(e, true);
|
||||||
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();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
JX.Stratcom.listen(
|
||||||
|
'click',
|
||||||
|
['differential-results-row-hide', 'tag:a'],
|
||||||
|
function(e) {
|
||||||
|
toggle(e, false);
|
||||||
|
});
|
||||||
|
|
||||||
|
function toggle(e, show) {
|
||||||
|
e.kill();
|
||||||
|
|
||||||
|
var f = show ? JX.DOM.show : JX.DOM.hide;
|
||||||
|
var g = show ? JX.DOM.hide : JX.DOM.show;
|
||||||
|
|
||||||
|
var table = e.getNode('differential-results-table');
|
||||||
|
var rows = JX.DOM.scry(table, 'tr', 'differential-results-row-toggle');
|
||||||
|
for (var ii = 0; ii < rows.length; ii++) {
|
||||||
|
f(rows[ii]);
|
||||||
|
}
|
||||||
|
|
||||||
|
g(JX.DOM.find(table, 'tr', 'differential-results-row-show'));
|
||||||
|
f(JX.DOM.find(table, 'tr', 'differential-results-row-hide'));
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue