@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
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+537 -241
+1 -1
scripts/celerity_mapper.php
··· 88 88 'differential.pkg.css' => array( 89 89 'differential-core-view-css', 90 90 'differential-changeset-view-css', 91 - 'differential-revision-detail-css', 91 + 'differential-results-table-css', 92 92 'differential-revision-history-css', 93 93 'differential-table-of-contents-css', 94 94 'differential-revision-comment-css',
+26 -26
src/__celerity_resource_map__.php
··· 571 571 ), 572 572 'disk' => '/rsrc/css/application/differential/local-commits-view.css', 573 573 ), 574 + 'differential-results-table-css' => 575 + array( 576 + 'uri' => '/res/470b474d/rsrc/css/application/differential/results-table.css', 577 + 'type' => 'css', 578 + 'requires' => 579 + array( 580 + ), 581 + 'disk' => '/rsrc/css/application/differential/results-table.css', 582 + ), 574 583 'differential-revision-add-comment-css' => 575 584 array( 576 585 'uri' => '/res/849748d3/rsrc/css/application/differential/add-comment.css', ··· 597 606 array( 598 607 ), 599 608 'disk' => '/rsrc/css/application/differential/revision-comment-list.css', 600 - ), 601 - 'differential-revision-detail-css' => 602 - array( 603 - 'uri' => '/res/a838bf31/rsrc/css/application/differential/revision-detail.css', 604 - 'type' => 'css', 605 - 'requires' => 606 - array( 607 - ), 608 - 'disk' => '/rsrc/css/application/differential/revision-detail.css', 609 609 ), 610 610 'differential-revision-history-css' => 611 611 array( ··· 989 989 ), 990 990 'javelin-behavior-differential-show-field-details' => 991 991 array( 992 - 'uri' => '/res/1dfd4d10/rsrc/js/application/differential/behavior-show-field-details.js', 992 + 'uri' => '/res/8d57f459/rsrc/js/application/differential/behavior-show-field-details.js', 993 993 'type' => 'js', 994 994 'requires' => 995 995 array( ··· 2503 2503 'uri' => '/res/pkg/0c96375e/core.pkg.js', 2504 2504 'type' => 'js', 2505 2505 ), 2506 - 'cf6f734a' => 2506 + '27683aba' => 2507 2507 array( 2508 2508 'name' => 'differential.pkg.css', 2509 2509 'symbols' => 2510 2510 array( 2511 2511 0 => 'differential-core-view-css', 2512 2512 1 => 'differential-changeset-view-css', 2513 - 2 => 'differential-revision-detail-css', 2513 + 2 => 'differential-results-table-css', 2514 2514 3 => 'differential-revision-history-css', 2515 2515 4 => 'differential-table-of-contents-css', 2516 2516 5 => 'differential-revision-comment-css', ··· 2522 2522 11 => 'differential-local-commits-view-css', 2523 2523 12 => 'inline-comment-summary-css', 2524 2524 ), 2525 - 'uri' => '/res/pkg/cf6f734a/differential.pkg.css', 2525 + 'uri' => '/res/pkg/27683aba/differential.pkg.css', 2526 2526 'type' => 'css', 2527 2527 ), 2528 2528 70509835 => ··· 2645 2645 'aphront-dialog-view-css' => '9c4e265b', 2646 2646 'aphront-error-view-css' => '9c4e265b', 2647 2647 'aphront-form-view-css' => '9c4e265b', 2648 - 'aphront-headsup-action-list-view-css' => 'cf6f734a', 2648 + 'aphront-headsup-action-list-view-css' => '27683aba', 2649 2649 'aphront-headsup-view-css' => '9c4e265b', 2650 2650 'aphront-list-filter-view-css' => '9c4e265b', 2651 2651 'aphront-pager-view-css' => '9c4e265b', ··· 2655 2655 'aphront-tokenizer-control-css' => '9c4e265b', 2656 2656 'aphront-tooltip-css' => '9c4e265b', 2657 2657 'aphront-typeahead-control-css' => '9c4e265b', 2658 - 'differential-changeset-view-css' => 'cf6f734a', 2659 - 'differential-core-view-css' => 'cf6f734a', 2658 + 'differential-changeset-view-css' => '27683aba', 2659 + 'differential-core-view-css' => '27683aba', 2660 2660 'differential-inline-comment-editor' => '70509835', 2661 - 'differential-local-commits-view-css' => 'cf6f734a', 2662 - 'differential-revision-add-comment-css' => 'cf6f734a', 2663 - 'differential-revision-comment-css' => 'cf6f734a', 2664 - 'differential-revision-comment-list-css' => 'cf6f734a', 2665 - 'differential-revision-detail-css' => 'cf6f734a', 2666 - 'differential-revision-history-css' => 'cf6f734a', 2667 - 'differential-table-of-contents-css' => 'cf6f734a', 2661 + 'differential-local-commits-view-css' => '27683aba', 2662 + 'differential-results-table-css' => '27683aba', 2663 + 'differential-revision-add-comment-css' => '27683aba', 2664 + 'differential-revision-comment-css' => '27683aba', 2665 + 'differential-revision-comment-list-css' => '27683aba', 2666 + 'differential-revision-history-css' => '27683aba', 2667 + 'differential-table-of-contents-css' => '27683aba', 2668 2668 'diffusion-commit-view-css' => 'c8ce2d88', 2669 2669 'diffusion-icons-css' => 'c8ce2d88', 2670 - 'inline-comment-summary-css' => 'cf6f734a', 2670 + 'inline-comment-summary-css' => '27683aba', 2671 2671 'javelin-behavior' => '8a5de8a3', 2672 2672 'javelin-behavior-aphront-basic-tokenizer' => '97f65640', 2673 2673 'javelin-behavior-aphront-drag-and-drop' => '70509835', ··· 2721 2721 'maniphest-task-summary-css' => '7839ae2d', 2722 2722 'maniphest-transaction-detail-css' => '7839ae2d', 2723 2723 'phabricator-app-buttons-css' => '9c4e265b', 2724 - 'phabricator-content-source-view-css' => 'cf6f734a', 2724 + 'phabricator-content-source-view-css' => '27683aba', 2725 2725 'phabricator-core-buttons-css' => '9c4e265b', 2726 2726 'phabricator-core-css' => '9c4e265b', 2727 2727 'phabricator-directory-css' => '9c4e265b', ··· 2732 2732 'phabricator-keyboard-shortcut' => '0c96375e', 2733 2733 'phabricator-keyboard-shortcut-manager' => '0c96375e', 2734 2734 'phabricator-menu-item' => '0c96375e', 2735 - 'phabricator-object-selector-css' => 'cf6f734a', 2735 + 'phabricator-object-selector-css' => '27683aba', 2736 2736 'phabricator-paste-file-upload' => '0c96375e', 2737 2737 'phabricator-prefab' => '0c96375e', 2738 2738 'phabricator-project-tag-css' => '7839ae2d',
+3 -1
src/__phutil_library_map__.php
··· 260 260 'DifferentialPathFieldSpecification' => 'applications/differential/field/specification/path', 261 261 'DifferentialPrimaryPaneView' => 'applications/differential/view/primarypane', 262 262 'DifferentialReplyHandler' => 'applications/differential/replyhandler', 263 + 'DifferentialResultsTableView' => 'applications/differential/view/resultstableview', 263 264 'DifferentialRevertPlanFieldSpecification' => 'applications/differential/field/specification/revertplan', 264 265 'DifferentialReviewRequestMail' => 'applications/differential/mail/reviewrequest', 265 266 'DifferentialReviewedByFieldSpecification' => 'applications/differential/field/specification/reviewedby', ··· 1245 1246 'DifferentialPathFieldSpecification' => 'DifferentialFieldSpecification', 1246 1247 'DifferentialPrimaryPaneView' => 'AphrontView', 1247 1248 'DifferentialReplyHandler' => 'PhabricatorMailReplyHandler', 1249 + 'DifferentialResultsTableView' => 'AphrontView', 1248 1250 'DifferentialRevertPlanFieldSpecification' => 'DifferentialFieldSpecification', 1249 1251 'DifferentialReviewRequestMail' => 'DifferentialMail', 1250 1252 'DifferentialReviewedByFieldSpecification' => 'DifferentialFieldSpecification', ··· 1490 1492 'PhabricatorDefaultFileStorageEngineSelector' => 'PhabricatorFileStorageEngineSelector', 1491 1493 'PhabricatorDefaultSearchEngineSelector' => 'PhabricatorSearchEngineSelector', 1492 1494 'PhabricatorDirectoryController' => 'PhabricatorController', 1493 - 'PhabricatorDirectoryMainController' => 'PhabricatorController', 1495 + 'PhabricatorDirectoryMainController' => 'PhabricatorDirectoryController', 1494 1496 'PhabricatorDisabledUserController' => 'PhabricatorAuthController', 1495 1497 'PhabricatorDraft' => 'PhabricatorDraftDAO', 1496 1498 'PhabricatorDraftDAO' => 'PhabricatorLiskDAO',
+124 -57
src/applications/differential/field/specification/lint/DifferentialLintFieldSpecification.php
··· 32 32 } 33 33 34 34 private function getLintExcuse() { 35 - $excuse = $this->getDiffProperty('arc:lint-excuse'); 36 - $excuse = phutil_escape_html($excuse); 37 - $excuse = nl2br($excuse); 38 - 39 - $excuse_markup = ''; 40 - if (strlen($excuse)) { 41 - $excuse_markup = '<p><strong>Explanation for failure(s): </strong></p>'. 42 - '<span class="lint-excuse">'.$excuse.'</span>'; 43 - } 44 - return $excuse_markup; 35 + return $this->getDiffProperty('arc:lint-excuse'); 45 36 } 46 37 47 38 public function renderValueForRevisionView() { 48 39 $diff = $this->getDiff(); 49 - $path_changesets = mpull($diff->loadChangesets(), 'getId', 'getFilename'); 40 + $path_changesets = mpull($diff->loadChangesets(), 'getID', 'getFilename'); 50 41 51 42 $lstar = DifferentialRevisionUpdateHistoryView::renderDiffLintStar($diff); 52 43 $lmsg = DifferentialRevisionUpdateHistoryView::getDiffLintMessage($diff); 53 44 $ldata = $this->getDiffProperty('arc:lint'); 54 45 $ltail = null; 55 - $have_details = false; 46 + 47 + $rows = array(); 48 + 49 + $rows[] = array( 50 + 'style' => 'star', 51 + 'name' => $lstar, 52 + 'value' => $lmsg, 53 + 'show' => true, 54 + ); 55 + 56 + $excuse = $this->getLintExcuse(); 57 + if ($excuse) { 58 + $rows[] = array( 59 + 'style' => 'excuse', 60 + 'name' => 'Excuse', 61 + 'value' => nl2br(phutil_escape_html($excuse)), 62 + 'show' => true, 63 + ); 64 + } 65 + 66 + $show_limit = 10; 67 + $hidden = array(); 56 68 57 69 if ($ldata) { 58 70 $ldata = igroup($ldata, 'path'); 59 - $lint_messages = array(); 60 71 foreach ($ldata as $path => $messages) { 61 - $message_markup = array(); 72 + 73 + $rows[] = array( 74 + 'style' => 'section', 75 + 'name' => phutil_escape_html($path), 76 + 'show' => $show_limit, 77 + ); 78 + 62 79 foreach ($messages as $message) { 63 80 $path = idx($message, 'path'); 64 81 $line = idx($message, 'line'); ··· 69 86 $name = idx($message, 'name'); 70 87 $description = idx($message, 'description'); 71 88 72 - $line_link = phutil_escape_html($line); 89 + $line_link = 'line '.phutil_escape_html($line); 73 90 if (isset($path_changesets[$path])) { 74 91 // TODO: Create standalone links for large diffs. Logic is in 75 92 // DifferentialDiffTableOfContentsView::renderChangesetLink(). ··· 80 97 ), 81 98 $line_link); 82 99 } 83 - if ($description != '') { 84 - $have_details = true; 100 + 101 + if ($show_limit) { 102 + --$show_limit; 103 + $show = true; 104 + } else { 105 + $show = false; 106 + if (empty($hidden[$severity])) { 107 + $hidden[$severity] = 0; 108 + } 109 + $hidden[$severity]++; 110 + } 111 + 112 + $rows[] = array( 113 + 'style' => $this->getSeverityStyle($severity), 114 + 'name' => phutil_escape_html(ucwords($severity)), 115 + 'value' => hsprintf( 116 + "(%s) %s at {$line_link}", 117 + $code, 118 + $name), 119 + 'show' => $show, 120 + ); 121 + 122 + if (strlen($description)) { 123 + $rows[] = array( 124 + 'style' => 'details', 125 + 'value' => nl2br(phutil_escape_html($description)), 126 + 'show' => false, 127 + ); 128 + if (empty($hidden['details'])) { 129 + $hidden['details'] = 0; 130 + } 131 + $hidden['details']++; 85 132 } 86 - $message_markup[] = hsprintf( 87 - '<li>'. 88 - '<span class="lint-severity-%s">%s</span> (%s) %s '. 89 - 'at line '.$line_link. 90 - javelin_render_tag( 91 - 'div', 92 - array( 93 - 'sigil' => 'differential-field-detail', 94 - 'style' => 'display: none;', 95 - ), 96 - '%s'). 97 - '</li>', 98 - $severity, 99 - ucwords($severity), 100 - $code, 101 - $name, 102 - $description); 103 133 } 104 - $lint_messages[] = 105 - '<li class="lint-file-block">'. 106 - 'Lint for <strong>'.phutil_escape_html($path).'</strong>'. 107 - '<ul>'.implode("\n", $message_markup).'</ul>'. 108 - '</li>'; 109 134 } 110 - $lexcuse = $this->getLintExcuse(); 111 - $ltail = 112 - '<div class="differential-lint-block">'. 113 - $lexcuse. 114 - '<ul>'. 115 - implode("\n", $lint_messages). 116 - '</ul>'. 117 - '</div>'; 118 135 } 119 136 120 - Javelin::initBehavior('differential-show-field-details'); 121 - if ($have_details) { 122 - $lmsg .= ' - '.javelin_render_tag( 123 - 'a', 124 - array( 125 - 'href' => '#details', 126 - 'sigil' => 'differential-show-field-details', 127 - ), 128 - 'Details'); 137 + $show_string = $this->renderShowString($hidden); 138 + 139 + $view = new DifferentialResultsTableView(); 140 + $view->setRows($rows); 141 + $view->setShowMoreString($show_string); 142 + 143 + return $view->render(); 144 + } 145 + 146 + private function getSeverityStyle($severity) { 147 + $map = array( 148 + ArcanistLintSeverity::SEVERITY_ERROR => 'red', 149 + ArcanistLintSeverity::SEVERITY_WARNING => 'yellow', 150 + ArcanistLintSeverity::SEVERITY_AUTOFIX => 'yellow', 151 + ArcanistLintSeverity::SEVERITY_ADVICE => 'yellow', 152 + ); 153 + return idx($map, $severity); 154 + } 155 + 156 + private function renderShowString(array $hidden) { 157 + if (!$hidden) { 158 + return null; 129 159 } 130 160 131 - return $lstar.' '.$lmsg.$ltail; 161 + // Reorder hidden things by severity. 162 + $hidden = array_select_keys( 163 + $hidden, 164 + array( 165 + ArcanistLintSeverity::SEVERITY_ERROR, 166 + ArcanistLintSeverity::SEVERITY_WARNING, 167 + ArcanistLintSeverity::SEVERITY_AUTOFIX, 168 + ArcanistLintSeverity::SEVERITY_ADVICE, 169 + 'details', 170 + )) + $hidden; 171 + 172 + $singular = array( 173 + ArcanistLintSeverity::SEVERITY_ERROR => 'Error', 174 + ArcanistLintSeverity::SEVERITY_WARNING => 'Warning', 175 + ArcanistLintSeverity::SEVERITY_AUTOFIX => 'Auto-Fix', 176 + ArcanistLintSeverity::SEVERITY_ADVICE => 'Advice', 177 + 'details' => 'Detail', 178 + ); 179 + 180 + $plural = array( 181 + ArcanistLintSeverity::SEVERITY_ERROR => 'Errors', 182 + ArcanistLintSeverity::SEVERITY_WARNING => 'Warnings', 183 + ArcanistLintSeverity::SEVERITY_AUTOFIX => 'Auto-Fixes', 184 + ArcanistLintSeverity::SEVERITY_ADVICE => 'Advice', 185 + 'details' => 'Details', 186 + ); 187 + 188 + $show = array(); 189 + foreach ($hidden as $key => $value) { 190 + if ($value == 1) { 191 + $show[] = $value.' '.idx($singular, $key); 192 + } else { 193 + $show[] = $value.' '.idx($plural, $key); 194 + } 195 + } 196 + 197 + return "Show Full Lint Results (".implode(', ', $show).")"; 132 198 } 199 + 133 200 }
+3 -2
src/applications/differential/field/specification/lint/__init__.php
··· 6 6 7 7 8 8 9 + phutil_require_module('arcanist', 'lint/severity'); 10 + 9 11 phutil_require_module('phabricator', 'applications/differential/field/specification/base'); 12 + phutil_require_module('phabricator', 'applications/differential/view/resultstableview'); 10 13 phutil_require_module('phabricator', 'applications/differential/view/revisionupdatehistory'); 11 - phutil_require_module('phabricator', 'infrastructure/javelin/api'); 12 - phutil_require_module('phabricator', 'infrastructure/javelin/markup'); 13 14 14 15 phutil_require_module('phutil', 'markup'); 15 16 phutil_require_module('phutil', 'utils');
+123 -64
src/applications/differential/field/specification/unit/DifferentialUnitFieldSpecification.php
··· 32 32 } 33 33 34 34 private function getUnitExcuse() { 35 - $excuse = $this->getDiffProperty('arc:unit-excuse'); 36 - $excuse = phutil_escape_html($excuse); 37 - $excuse = nl2br($excuse); 38 - 39 - $excuse_markup = ''; 40 - if (strlen($excuse)) { 41 - $excuse_markup = '<p>Explanation for failure(s): </p>'. 42 - '<span class="unit-excuse">'.$excuse.'</span>'; 43 - } 44 - return $excuse_markup; 35 + return $this->getDiffProperty('arc:unit-excuse'); 45 36 } 46 37 47 38 public function renderValueForRevisionView() { ··· 50 41 $ustar = DifferentialRevisionUpdateHistoryView::renderDiffUnitStar($diff); 51 42 $umsg = DifferentialRevisionUpdateHistoryView::getDiffUnitMessage($diff); 52 43 53 - $postponed_count = 0; 44 + $rows = array(); 45 + 46 + $rows[] = array( 47 + 'style' => 'star', 48 + 'name' => $ustar, 49 + 'value' => $umsg, 50 + 'show' => true, 51 + ); 52 + 53 + $excuse = $this->getUnitExcuse(); 54 + if ($excuse) { 55 + $rows[] = array( 56 + 'style' => 'excuse', 57 + 'name' => 'Excuse', 58 + 'value' => nl2br(phutil_escape_html($excuse)), 59 + 'show' => true, 60 + ); 61 + } 62 + 63 + $show_limit = 10; 64 + $hidden = array(); 65 + 54 66 $udata = $this->getDiffProperty('arc:unit'); 55 - $utail = null; 56 - $have_details = false; 67 + if ($udata) { 68 + $sort_map = array( 69 + ArcanistUnitTestResult::RESULT_BROKEN => 0, 70 + ArcanistUnitTestResult::RESULT_FAIL => 1, 71 + ArcanistUnitTestResult::RESULT_UNSOUND => 2, 72 + ArcanistUnitTestResult::RESULT_SKIP => 3, 73 + ArcanistUnitTestResult::RESULT_POSTPONED => 4, 74 + ArcanistUnitTestResult::RESULT_PASS => 5, 75 + ); 57 76 58 - if ($udata) { 59 - $unit_messages = array(); 77 + foreach ($udata as $key => $test) { 78 + $udata[$key]['sort'] = idx($sort_map, idx($test, 'result')); 79 + } 80 + $udata = isort($udata, 'sort'); 81 + 60 82 foreach ($udata as $test) { 61 - $name = idx($test, 'name'); 62 83 $result = idx($test, 'result'); 63 84 64 - if ($result != DifferentialUnitTestResult::RESULT_POSTPONED && 65 - $result != DifferentialUnitTestResult::RESULT_PASS) { 66 - $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); 67 - $userdata = phutil_utf8_shorten(idx($test, 'userdata'), 512); 68 - $userdata = $engine->markupText($userdata); 85 + $default_hide = false; 86 + switch ($result) { 87 + case ArcanistUnitTestResult::RESULT_POSTPONED: 88 + case ArcanistUnitTestResult::RESULT_PASS: 89 + $default_hide = true; 90 + break; 91 + } 69 92 70 - if ($userdata != '') { 71 - $have_details = true; 93 + if ($show_limit && !$default_hide) { 94 + --$show_limit; 95 + $show = true; 96 + } else { 97 + $show = false; 98 + if (empty($hidden[$result])) { 99 + $hidden[$result] = 0; 72 100 } 101 + $hidden[$result]++; 102 + } 73 103 74 - $unit_messages[] = 75 - '<li>'. 76 - '<span class="unit-result-'.phutil_escape_html($result).'">'. 77 - phutil_escape_html(ucwords($result)). 78 - '</span>'. 79 - ' '. 80 - phutil_escape_html($name). 81 - javelin_render_tag( 82 - 'div', 83 - array( 84 - 'sigil' => 'differential-field-detail', 85 - 'style' => 'display: none;', 86 - ), 87 - $userdata). 88 - '</li>'; 104 + $rows[] = array( 105 + 'style' => $this->getResultStyle($result), 106 + 'name' => phutil_escape_html(ucwords($result)), 107 + 'value' => phutil_escape_html(idx($test, 'name')), 108 + 'show' => $show, 109 + ); 89 110 90 - } else if ($result == DifferentialUnitTestResult::RESULT_POSTPONED) { 91 - $postponed_count++; 111 + $userdata = idx($test, 'userdata'); 112 + if ($userdata) { 113 + $engine = PhabricatorMarkupEngine::newDifferentialMarkupEngine(); 114 + $userdata = $engine->markupText($userdata); 115 + $rows[] = array( 116 + 'style' => 'details', 117 + 'value' => $userdata, 118 + 'show' => false, 119 + ); 120 + if (empty($hidden['details'])) { 121 + $hidden['details'] = 0; 122 + } 123 + $hidden['details']++; 92 124 } 93 125 } 126 + } 94 127 95 - $uexcuse = $this->getUnitExcuse(); 96 - if ($unit_messages) { 97 - $utail = 98 - '<div class="differential-unit-block">'. 99 - $uexcuse. 100 - '<ul>'. 101 - implode("\n", $unit_messages). 102 - '</ul>'. 103 - '</div>'; 104 - } 128 + $show_string = $this->renderShowString($hidden); 129 + 130 + $view = new DifferentialResultsTableView(); 131 + $view->setRows($rows); 132 + $view->setShowMoreString($show_string); 133 + 134 + return $view->render(); 135 + } 136 + 137 + private function getResultStyle($result) { 138 + $map = array( 139 + ArcanistUnitTestResult::RESULT_PASS => 'green', 140 + ArcanistUnitTestResult::RESULT_FAIL => 'red', 141 + ArcanistUnitTestResult::RESULT_SKIP => 'blue', 142 + ArcanistUnitTestResult::RESULT_BROKEN => 'red', 143 + ArcanistUnitTestResult::RESULT_UNSOUND => 'yellow', 144 + ArcanistUnitTestResult::RESULT_POSTPONED => 'blue', 145 + ); 146 + return idx($map, $result); 147 + } 148 + 149 + private function renderShowString(array $hidden) { 150 + if (!$hidden) { 151 + return null; 105 152 } 106 153 107 - if ($postponed_count > 0 && 108 - $diff->getUnitStatus() == DifferentialUnitStatus::UNIT_POSTPONED) { 109 - $umsg = $postponed_count.' '.$umsg; 110 - } 154 + // Reorder hidden things by severity. 155 + $hidden = array_select_keys( 156 + $hidden, 157 + array( 158 + ArcanistUnitTestResult::RESULT_BROKEN, 159 + ArcanistUnitTestResult::RESULT_FAIL, 160 + ArcanistUnitTestResult::RESULT_UNSOUND, 161 + ArcanistUnitTestResult::RESULT_SKIP, 162 + ArcanistUnitTestResult::RESULT_POSTPONED, 163 + ArcanistUnitTestResult::RESULT_PASS, 164 + 'details', 165 + )) + $hidden; 111 166 112 - Javelin::initBehavior('differential-show-field-details'); 113 - if ($have_details) { 114 - $umsg .= ' - '.javelin_render_tag( 115 - 'a', 116 - array( 117 - 'href' => '#details', 118 - 'sigil' => 'differential-show-field-details', 119 - ), 120 - 'Details'); 167 + $noun = array( 168 + ArcanistUnitTestResult::RESULT_BROKEN => 'Broken', 169 + ArcanistUnitTestResult::RESULT_FAIL => 'Failed', 170 + ArcanistUnitTestResult::RESULT_UNSOUND => 'Unsound', 171 + ArcanistUnitTestResult::RESULT_SKIP => 'Skipped', 172 + ArcanistUnitTestResult::RESULT_POSTPONED => 'Postponed', 173 + ArcanistUnitTestResult::RESULT_PASS => 'Passed', 174 + 'details' => 'Details', 175 + ); 176 + 177 + $show = array(); 178 + foreach ($hidden as $key => $value) { 179 + $show[] = $value.' '.idx($noun, $key); 121 180 } 122 181 123 - return $ustar.' '.$umsg.$utail; 182 + return "Show Full Unit Results (".implode(', ', $show).")"; 124 183 } 125 184 126 185 }
+3 -4
src/applications/differential/field/specification/unit/__init__.php
··· 6 6 7 7 8 8 9 - phutil_require_module('phabricator', 'applications/differential/constants/unitstatus'); 10 - phutil_require_module('phabricator', 'applications/differential/constants/unittestresult'); 9 + phutil_require_module('arcanist', 'unit/result'); 10 + 11 11 phutil_require_module('phabricator', 'applications/differential/field/specification/base'); 12 + phutil_require_module('phabricator', 'applications/differential/view/resultstableview'); 12 13 phutil_require_module('phabricator', 'applications/differential/view/revisionupdatehistory'); 13 14 phutil_require_module('phabricator', 'applications/markup/engine'); 14 - phutil_require_module('phabricator', 'infrastructure/javelin/api'); 15 - phutil_require_module('phabricator', 'infrastructure/javelin/markup'); 16 15 17 16 phutil_require_module('phutil', 'markup'); 18 17 phutil_require_module('phutil', 'utils');
+131
src/applications/differential/view/resultstableview/DifferentialResultsTableView.php
··· 1 + <?php 2 + 3 + /* 4 + * Copyright 2012 Facebook, Inc. 5 + * 6 + * Licensed under the Apache License, Version 2.0 (the "License"); 7 + * you may not use this file except in compliance with the License. 8 + * You may obtain a copy of the License at 9 + * 10 + * http://www.apache.org/licenses/LICENSE-2.0 11 + * 12 + * Unless required by applicable law or agreed to in writing, software 13 + * distributed under the License is distributed on an "AS IS" BASIS, 14 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 + * See the License for the specific language governing permissions and 16 + * limitations under the License. 17 + */ 18 + 19 + final class DifferentialResultsTableView extends AphrontView { 20 + 21 + private $rows; 22 + private $showMoreString; 23 + 24 + public function setRows(array $rows) { 25 + $this->rows = $rows; 26 + return $this; 27 + } 28 + 29 + public function setShowMoreString($show_more_string) { 30 + $this->showMoreString = $show_more_string; 31 + return $this; 32 + } 33 + 34 + public function render() { 35 + 36 + $rows = array(); 37 + 38 + $any_hidden = false; 39 + foreach ($this->rows as $row) { 40 + 41 + $style = idx($row, 'style'); 42 + switch ($style) { 43 + case 'section': 44 + $cells = phutil_render_tag( 45 + 'th', 46 + array( 47 + 'colspan' => 2, 48 + ), 49 + idx($row, 'name')); 50 + break; 51 + default: 52 + $name = phutil_render_tag( 53 + 'th', 54 + array( 55 + ), 56 + idx($row, 'name')); 57 + $value = phutil_render_tag( 58 + 'td', 59 + array( 60 + ), 61 + idx($row, 'value')); 62 + $cells = $name.$value; 63 + break; 64 + } 65 + 66 + $show = idx($row, 'show'); 67 + 68 + $rows[] = javelin_render_tag( 69 + 'tr', 70 + array( 71 + 'style' => $show ? null : 'display: none', 72 + 'sigil' => $show ? null : 'differential-results-row-toggle', 73 + 'class' => 'differential-results-row-'.$style, 74 + ), 75 + $cells); 76 + 77 + if (!$show) { 78 + $any_hidden = true; 79 + } 80 + } 81 + 82 + if ($any_hidden) { 83 + $show_more = javelin_render_tag( 84 + 'a', 85 + array( 86 + 'href' => '#', 87 + 'mustcapture' => true, 88 + ), 89 + $this->showMoreString); 90 + 91 + $hide_more = javelin_render_tag( 92 + 'a', 93 + array( 94 + 'href' => '#', 95 + 'mustcapture' => true, 96 + ), 97 + 'Hide'); 98 + 99 + $rows[] = javelin_render_tag( 100 + 'tr', 101 + array( 102 + 'class' => 'differential-results-row-show', 103 + 'sigil' => 'differential-results-row-show', 104 + ), 105 + '<th colspan="2">'.$show_more.'</td>'); 106 + 107 + $rows[] = javelin_render_tag( 108 + 'tr', 109 + array( 110 + 'class' => 'differential-results-row-show', 111 + 'sigil' => 'differential-results-row-hide', 112 + 'style' => 'display: none', 113 + ), 114 + '<th colspan="2">'.$hide_more.'</th>'); 115 + 116 + Javelin::initBehavior('differential-show-field-details'); 117 + } 118 + 119 + require_celerity_resource('differential-results-table-css'); 120 + 121 + return javelin_render_tag( 122 + 'table', 123 + array( 124 + 'class' => 'differential-results-table', 125 + 'sigil' => 'differential-results-table', 126 + ), 127 + implode("\n", $rows)); 128 + } 129 + 130 + 131 + }
+18
src/applications/differential/view/resultstableview/__init__.php
··· 1 + <?php 2 + /** 3 + * This file is automatically generated. Lint this module to rebuild it. 4 + * @generated 5 + */ 6 + 7 + 8 + 9 + phutil_require_module('phabricator', 'infrastructure/celerity/api'); 10 + phutil_require_module('phabricator', 'infrastructure/javelin/api'); 11 + phutil_require_module('phabricator', 'infrastructure/javelin/markup'); 12 + phutil_require_module('phabricator', 'view/base'); 13 + 14 + phutil_require_module('phutil', 'markup'); 15 + phutil_require_module('phutil', 'utils'); 16 + 17 + 18 + phutil_require_source('DifferentialResultsTableView.php');
-1
src/applications/differential/view/revisiondetail/DifferentialRevisionDetailView.php
··· 47 47 public function render() { 48 48 49 49 require_celerity_resource('differential-core-view-css'); 50 - require_celerity_resource('differential-revision-detail-css'); 51 50 52 51 $revision = $this->revision; 53 52
+79
webroot/rsrc/css/application/differential/results-table.css
··· 1 + /** 2 + * @provides differential-results-table-css 3 + */ 4 + 5 + table.differential-results-table { 6 + border-collapse: separate; 7 + border-spacing: 1px; 8 + width: 100%; 9 + font-size: 11px; 10 + background: #fcfcec; 11 + } 12 + 13 + .differential-results-table th { 14 + font-weight: bold; 15 + text-align: center; 16 + white-space: nowrap; 17 + vertical-align: middle; 18 + padding: 2px 4px; 19 + margin: 0; 20 + width: 70px; 21 + } 22 + 23 + .differential-results-table td { 24 + padding: 2px 8px; 25 + margin: 0; 26 + vertical-align: middle; 27 + } 28 + 29 + .differential-results-table tr.differential-results-row-star th, 30 + .differential-results-table tr.differential-results-row-star td { 31 + font-size: 12px; 32 + font-weight: bold; 33 + background: #dfdfcf; 34 + } 35 + 36 + 37 + .differential-results-table tr.differential-results-row-section th { 38 + font-weight: bold; 39 + padding-top: 4px; 40 + text-align: left; 41 + } 42 + 43 + .differential-results-table tr.differential-results-row-excuse th { 44 + background: #3399ff; 45 + } 46 + 47 + .differential-results-table tr.differential-results-row-excuse td { 48 + padding-top: 1em; 49 + padding-right: 1em; 50 + padding-bottom: 1em; 51 + } 52 + 53 + .differential-results-table tr.differential-results-row-red th { 54 + background: #ff4422; 55 + } 56 + 57 + .differential-results-table tr.differential-results-row-yellow th { 58 + background: #ffdd66; 59 + } 60 + 61 + .differential-results-table tr.differential-results-row-green th { 62 + background: #22dd44; 63 + } 64 + 65 + .differential-results-table tr.differential-results-row-blue th { 66 + background: #88bbff; 67 + } 68 + 69 + 70 + .differential-results-table tr.differential-results-row-details td { 71 + color: #888888; 72 + } 73 + 74 + .differential-results-table tr.differential-results-row-show th { 75 + padding: 4px; 76 + color: #888888; 77 + font-weight: bold; 78 + background: #dfdfcf; 79 + }
-68
webroot/rsrc/css/application/differential/revision-detail.css
··· 1 - /** 2 - * @provides differential-revision-detail-css 3 - */ 4 - 5 - .differential-unit-block, 6 - .differential-lint-block { 7 - padding: .5em; 8 - background: #fcfcec; 9 - margin: .5em 0; 10 - font-size: 11px; 11 - line-height: 1.5em; 12 - } 13 - 14 - .differential-lint-block .lint-severity-warning { 15 - background: #ffff66; 16 - padding: 0 0.5em; 17 - font-weight: bold; 18 - } 19 - 20 - .differential-lint-block .lint-severity-error { 21 - background: #ff3333; 22 - padding: 0 0.5em; 23 - font-weight: bold; 24 - } 25 - 26 - .differential-lint-block .lint-file-block { 27 - } 28 - 29 - .differential-lint-block li li { 30 - margin-left: 1.5em; 31 - } 32 - 33 - .differential-lint-block li li p { 34 - margin-left: 1em; 35 - color: #666666; 36 - } 37 - 38 - .differential-unit-block li { 39 - margin-left: 1.5em; 40 - } 41 - 42 - .differential-unit-block li p { 43 - margin-left: 1em; 44 - color: #666666; 45 - } 46 - 47 - .differential-unit-block .unit-test-result { 48 - padding: 0; 49 - } 50 - 51 - .differential-unit-block .unit-result-fail { 52 - background: #ff3333; 53 - padding: 0 0.5em; 54 - font-weight: bold; 55 - } 56 - 57 - .differential-unit-block .unit-result-unsound { 58 - background: #cc33cc; 59 - padding: 0 0.5em; 60 - font-weight: bold; 61 - } 62 - 63 - .differential-lint-block .lint-excuse, 64 - .differential-unit-block .unit-excuse { 65 - background: #808080; 66 - color: #ffff66; 67 - font-size: 12px; 68 - }
+26 -17
webroot/rsrc/js/application/differential/behavior-show-field-details.js
··· 5 5 * javelin-dom 6 6 */ 7 7 8 - JX.behavior('differential-show-field-details', function() { 8 + JX.behavior('differential-show-field-details', function(config) { 9 9 10 10 JX.Stratcom.listen( 11 11 'click', 12 - 'differential-show-field-details', 12 + ['differential-results-row-show', 'tag:a'], 13 13 function(e) { 14 - var node = e.getNode('tag:td'); 15 - var data = JX.Stratcom.getData(node); 16 - var details = JX.DOM.scry( 17 - node, 18 - 'div', 19 - 'differential-field-detail'); 20 - for (var i=0; i < details.length; i++) { 21 - if (!data.detailsShown) { 22 - JX.DOM.show(details[i]); 23 - } else { 24 - JX.DOM.hide(details[i]); 25 - } 26 - } 27 - data.detailsShown = !data.detailsShown; 28 - e.kill(); 14 + toggle(e, true); 15 + }); 16 + 17 + JX.Stratcom.listen( 18 + 'click', 19 + ['differential-results-row-hide', 'tag:a'], 20 + function(e) { 21 + toggle(e, false); 29 22 }); 23 + 24 + function toggle(e, show) { 25 + e.kill(); 26 + 27 + var f = show ? JX.DOM.show : JX.DOM.hide; 28 + var g = show ? JX.DOM.hide : JX.DOM.show; 29 + 30 + var table = e.getNode('differential-results-table'); 31 + var rows = JX.DOM.scry(table, 'tr', 'differential-results-row-toggle'); 32 + for (var ii = 0; ii < rows.length; ii++) { 33 + f(rows[ii]); 34 + } 35 + 36 + g(JX.DOM.find(table, 'tr', 'differential-results-row-show')); 37 + f(JX.DOM.find(table, 'tr', 'differential-results-row-hide')); 38 + } 30 39 31 40 });