@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.

Unify more build, property, auditor, and status information into "CommitGraphView"

Summary:
Ref T13552. In unifying the various Graph/List/Table commit views, some information was dropped -- particularly, audit status.

Restore most of it. The result isn't very pretty, but has most of the required information.

Test Plan: {F7637411}

Maniphest Tasks: T13552

Differential Revision: https://secure.phabricator.com/D21417

+215 -68
+3 -3
resources/celerity/map.php
··· 9 9 'names' => array( 10 10 'conpherence.pkg.css' => '0e3cf785', 11 11 'conpherence.pkg.js' => '020aebcf', 12 - 'core.pkg.css' => '9b2e2e20', 12 + 'core.pkg.css' => '9cb7cb3f', 13 13 'core.pkg.js' => '845355f4', 14 14 'dark-console.pkg.js' => '187792c2', 15 15 'differential.pkg.css' => '5c459f92', ··· 133 133 'rsrc/css/phui/object-item/phui-oi-color.css' => 'b517bfa0', 134 134 'rsrc/css/phui/object-item/phui-oi-drag-ui.css' => 'da15d3dc', 135 135 'rsrc/css/phui/object-item/phui-oi-flush-ui.css' => '490e2e2e', 136 - 'rsrc/css/phui/object-item/phui-oi-list-view.css' => 'd7723ecc', 136 + 'rsrc/css/phui/object-item/phui-oi-list-view.css' => '4b0def39', 137 137 'rsrc/css/phui/object-item/phui-oi-simple-ui.css' => '6a30fa46', 138 138 'rsrc/css/phui/phui-action-list.css' => '1b0085b2', 139 139 'rsrc/css/phui/phui-action-panel.css' => '6c386cbf', ··· 866 866 'phui-oi-color-css' => 'b517bfa0', 867 867 'phui-oi-drag-ui-css' => 'da15d3dc', 868 868 'phui-oi-flush-ui-css' => '490e2e2e', 869 - 'phui-oi-list-view-css' => 'd7723ecc', 869 + 'phui-oi-list-view-css' => '4b0def39', 870 870 'phui-oi-simple-ui-css' => '6a30fa46', 871 871 'phui-pager-css' => 'd022c7ad', 872 872 'phui-pinboard-view-css' => '1f08f5d8',
+2 -1
src/applications/audit/query/PhabricatorCommitSearchEngine.php
··· 222 222 $bucket = $this->getResultBucket($query); 223 223 224 224 $template = id(new DiffusionCommitGraphView()) 225 - ->setViewer($viewer); 225 + ->setViewer($viewer) 226 + ->setShowAuditors(true); 226 227 227 228 $views = array(); 228 229 if ($bucket) {
+163 -64
src/applications/diffusion/view/DiffusionCommitGraphView.php
··· 14 14 private $buildableMap; 15 15 private $revisionMap; 16 16 17 + private $showAuditors; 18 + 17 19 public function setHistory(array $history) { 18 20 assert_instances_of($history, 'DiffusionPathChange'); 19 21 $this->history = $history; ··· 32 34 33 35 public function getCommits() { 34 36 return $this->commits; 37 + } 38 + 39 + public function setShowAuditors($show_auditors) { 40 + $this->showAuditors = $show_auditors; 41 + return $this; 42 + } 43 + 44 + public function getShowAuditors() { 45 + return $this->showAuditors; 35 46 } 36 47 37 48 public function setParents(array $parents) { ··· 92 103 } 93 104 94 105 private function newObjectItemViews() { 106 + $viewer = $this->getViewer(); 107 + 95 108 require_celerity_resource('diffusion-css'); 96 109 97 110 $show_builds = $this->shouldShowBuilds(); 98 111 $show_revisions = $this->shouldShowRevisions(); 112 + $show_auditors = $this->shouldShowAuditors(); 113 + 114 + $phids = array(); 115 + 116 + if ($show_revisions) { 117 + $revision_map = $this->getRevisionMap(); 118 + foreach ($revision_map as $revisions) { 119 + foreach ($revisions as $revision) { 120 + $phids[] = $revision->getPHID(); 121 + } 122 + } 123 + } 124 + 125 + if ($show_auditors) { 126 + $commits = $this->getCommitMap(); 127 + foreach ($commits as $commit) { 128 + $audits = $commit->getAudits(); 129 + foreach ($audits as $auditor) { 130 + $phids[] = $auditor->getAuditorPHID(); 131 + } 132 + } 133 + } 134 + 135 + $handles = $viewer->loadHandles($phids); 99 136 100 137 $views = array(); 101 138 ··· 111 148 $short_hash = $this->getCommitObjectName($hash); 112 149 $is_disabled = $this->getCommitIsDisabled($commit); 113 150 114 - $author_view = $this->getCommitAuthorView($commit); 115 - 116 151 $item_view = id(new PHUIObjectItemView()) 152 + ->setViewer($viewer) 117 153 ->setHeader($commit_description) 118 154 ->setObjectName($short_hash) 119 155 ->setHref($commit_link) 120 156 ->setDisabled($is_disabled); 121 157 122 - if ($author_view !== null) { 123 - $item_view->addAttribute($author_view); 158 + $this->addBrowseAction($item_view, $hash); 159 + 160 + if ($show_builds) { 161 + $this->addBuildAction($item_view, $hash); 124 162 } 125 163 126 - $browse_button = $this->newBrowseButton($hash); 164 + $this->addAuditAction($item_view, $hash); 127 165 128 - $build_view = null; 129 - if ($show_builds) { 130 - $build_view = $this->newBuildView($hash); 166 + if ($show_auditors) { 167 + $auditor_list = $item_view->newPropertyList(); 168 + if ($commit) { 169 + $auditors = $this->newAuditorList($commit, $handles); 170 + $auditor_list->addProperty(pht('Auditors'), $auditors); 171 + } 131 172 } 132 173 133 - $item_view->setSideColumn( 134 - array( 135 - $build_view, 136 - $browse_button, 137 - )); 174 + $property_list = $item_view->newPropertyList(); 175 + 176 + if ($commit) { 177 + $author_view = $this->getCommitAuthorView($commit); 178 + if ($author_view) { 179 + $property_list->addProperty( 180 + pht('Author'), 181 + $this->getCommitAuthorView($commit)); 182 + } 183 + } 138 184 139 - $revision_view = null; 140 185 if ($show_revisions) { 141 - $revision_view = $this->newRevisionView($hash); 142 - } 186 + if ($commit) { 187 + $revisions = $this->getRevisions($commit); 188 + if ($revisions) { 189 + $revision = head($revisions); 190 + $handle = $handles[$revision->getPHID()]; 143 191 144 - if ($revision_view !== null) { 145 - $item_view->addAttribute($revision_view); 192 + $property_list->addProperty( 193 + pht('Revision'), 194 + $handle->renderLink()); 195 + } 196 + } 146 197 } 147 198 148 199 $views[$hash] = $item_view; ··· 172 223 $item_view = $views[$hash]; 173 224 174 225 $list_view = id(new PHUIObjectItemListView()) 226 + ->setViewer($viewer) 175 227 ->setFlush(true) 176 228 ->addItem($item_view); 177 229 ··· 268 320 return $show_revisions; 269 321 } 270 322 323 + private function shouldShowAuditors() { 324 + return $this->getShowAuditors(); 325 + } 326 + 271 327 private function newHistoryItems() { 272 328 $items = array(); 273 329 ··· 367 423 return $commit->newCommitAuthorView($viewer); 368 424 } 369 425 370 - private function newBrowseButton($hash) { 371 - $repository = $this->getRepository(); 372 - 373 - if ($repository) { 374 - $drequest = $this->getDiffusionRequest(); 375 - 376 - return $this->linkBrowse( 377 - $drequest->getPath(), 378 - array( 379 - 'commit' => $hash, 380 - 'branch' => $drequest->getBranch(), 381 - ), 382 - $as_button = true); 383 - } 384 - 385 - return null; 386 - } 387 - 388 426 private function getCommit($hash) { 389 427 $commit_map = $this->getCommitMap(); 390 428 return idx($commit_map, $hash); ··· 399 437 return $this->commitMap; 400 438 } 401 439 402 - private function newBuildView($hash) { 440 + private function addBrowseAction(PHUIObjectItemView $item, $hash) { 441 + $repository = $this->getRepository(); 442 + 443 + if (!$repository) { 444 + return; 445 + } 446 + 447 + $drequest = $this->getDiffusionRequest(); 448 + $path = $drequest->getPath(); 449 + 450 + $uri = $drequest->generateURI( 451 + array( 452 + 'action' => 'browse', 453 + 'path' => $path, 454 + )); 455 + 456 + $item->newAction() 457 + ->setIcon('fa-folder-open-o bluegrey') 458 + ->setName(pht('Browse Repository')) 459 + ->setHref($uri); 460 + } 461 + 462 + private function addBuildAction(PHUIObjectItemView $item, $hash) { 463 + $is_disabled = true; 464 + 465 + $buildable = null; 466 + 403 467 $commit = $this->getCommit($hash); 404 468 if (!$commit) { 405 - return null; 469 + $buildable = $this->getBuildable($commit); 470 + } 471 + 472 + if ($buildable) { 473 + $icon = $buildable->getStatusIcon(); 474 + $color = $buildable->getStatusColor(); 475 + $name = $buildable->getStatusDisplayName(); 476 + $uri = $buildable->getURI(); 477 + } else { 478 + $icon = 'fa-times'; 479 + $color = 'grey'; 480 + $name = pht('No Builds'); 481 + $uri = null; 406 482 } 407 483 408 - $buildable = $this->getBuildable($commit); 409 - if (!$buildable) { 410 - return null; 484 + $item->newAction() 485 + ->setIcon($icon.' '.$color) 486 + ->setName($name) 487 + ->setHref($uri) 488 + ->setDisabled(($uri === null)); 489 + } 490 + 491 + private function addAuditAction(PHUIObjectItemView $item_view, $hash) { 492 + $commit = $this->getCommit($hash); 493 + 494 + if ($commit) { 495 + $status = $commit->getAuditStatusObject(); 496 + 497 + $text = $status->getName(); 498 + $color = $status->getColor(); 499 + $icon = $status->getIcon(); 500 + 501 + $uri = $commit->getURI(); 502 + 503 + $is_disabled = $status->isNoAudit(); 504 + } else { 505 + $text = pht('No Audit'); 506 + $color = 'grey'; 507 + $icon = 'fa-times'; 508 + $uri = null; 509 + 510 + $is_disabled = true; 411 511 } 412 512 413 - return $this->renderBuildable($buildable, 'button'); 513 + $item_view->newAction() 514 + ->setIcon($icon.' '.$color) 515 + ->setName($text) 516 + ->setHref($uri) 517 + ->setDisabled($is_disabled); 414 518 } 415 519 416 520 private function getBuildable(PhabricatorRepositoryCommit $commit) { ··· 426 530 } 427 531 428 532 return $this->buildableMap; 429 - } 430 - 431 - private function newRevisionView($hash) { 432 - $commit = $this->getCommit($hash); 433 - if (!$commit) { 434 - return null; 435 - } 436 - 437 - $revisions = $this->getRevisions($commit); 438 - if (!$revisions) { 439 - return null; 440 - } 441 - 442 - $revision = head($revisions); 443 - 444 - return id(new PHUITagView()) 445 - ->setName($revision->getMonogram()) 446 - ->setType(PHUITagView::TYPE_SHADE) 447 - ->setColor(PHUITagView::COLOR_BLUE) 448 - ->setHref($revision->getURI()) 449 - ->setBorder(PHUITagView::BORDER_NONE) 450 - ->setSlimShady(true); 451 533 } 452 534 453 535 private function getRevisions(PhabricatorRepositoryCommit $commit) { ··· 508 590 ->execute(); 509 591 510 592 return $commits; 593 + } 594 + 595 + private function newAuditorList( 596 + PhabricatorRepositoryCommit $commit, 597 + $handles) { 598 + 599 + $auditors = $commit->getAudits(); 600 + if (!$auditors) { 601 + return phutil_tag('em', array(), pht('None')); 602 + } 603 + 604 + $auditor_phids = mpull($auditors, 'getAuditorPHID'); 605 + $auditor_list = $handles->newSublist($auditor_phids) 606 + ->renderList() 607 + ->setAsInline(true); 608 + 609 + return $auditor_list; 511 610 } 512 611 513 612 }
+41
src/view/phui/PHUIObjectItemView.php
··· 16 16 private $bylines = array(); 17 17 private $grippable; 18 18 private $actions = array(); 19 + private $actionItems = array(); 19 20 private $headIcons = array(); 20 21 private $disabled; 21 22 private $imageURI; ··· 29 30 private $coverImage; 30 31 private $description; 31 32 private $clickable; 33 + private $propertyLists = array(); 32 34 33 35 private $selectableName; 34 36 private $selectableValue; ··· 210 212 'attributes' => $attributes, 211 213 ); 212 214 return $this; 215 + } 216 + 217 + public function newAction() { 218 + $action = new PhabricatorActionView(); 219 + $this->actionItems[] = $action; 220 + return $action; 221 + } 222 + 223 + public function newPropertyList() { 224 + $list = new PHUIPropertyListView(); 225 + $this->propertyLists[] = $list; 226 + return $list; 213 227 } 214 228 215 229 /** ··· 598 612 ''); 599 613 } 600 614 615 + $property_lists = null; 616 + if ($this->propertyLists) { 617 + $property_lists[] = phutil_tag( 618 + 'div', 619 + array(), 620 + $this->propertyLists); 621 + } 622 + 601 623 $content = phutil_tag( 602 624 'div', 603 625 array( ··· 606 628 array( 607 629 $subhead, 608 630 $attrs, 631 + $property_lists, 609 632 $this->renderChildren(), 610 633 )); 611 634 ··· 733 756 )); 734 757 } 735 758 759 + $column4 = null; 760 + if ($this->actionItems) { 761 + $action_list = id(new PhabricatorActionListView()) 762 + ->setViewer($viewer); 763 + 764 + foreach ($this->actionItems as $action_item) { 765 + $action_list->addAction($action_item); 766 + } 767 + 768 + $column4 = phutil_tag( 769 + 'div', 770 + array( 771 + 'class' => 'phui-oi-col2 phui-oi-action-list', 772 + ), 773 + $action_list); 774 + } 775 + 736 776 $table = phutil_tag( 737 777 'div', 738 778 array( ··· 745 785 $column1, 746 786 $column2, 747 787 $column3, 788 + $column4, 748 789 ))); 749 790 750 791 $box = phutil_tag(
+6
webroot/rsrc/css/phui/object-item/phui-oi-list-view.css
··· 725 725 padding: 8px 0; 726 726 background: linear-gradient({$lightbluebackground}, #fff 66%, #fff); 727 727 } 728 + 729 + .phui-oi-action-list { 730 + background: {$lightbluebackground}; 731 + border-left: 1px solid {$thinblueborder}; 732 + padding: 4px; 733 + }