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

Use a list view for DiffusionHistory

Summary: This moves Diffusion History to use an easier to parse list view for commits and their (diff, audit, build) status. I left TableView around, which is used on a repositories home, and we can maybe add a "graph view" history back as another controller. Not sure what the real use is for that kind of feature though. I don't have Harbormaster set up locally so I could use another install to give this a run. I also expect to maybe not live with this UI as final, I like the UX, but the icons for indicating status don't really feel great to me, just OK.

Test Plan:
pull various repositories, check various history displays.

{F4980356}

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

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

+425 -188
+7 -7
resources/celerity/map.php
··· 9 9 'names' => array( 10 10 'conpherence.pkg.css' => 'ff161f2d', 11 11 'conpherence.pkg.js' => 'b5b51108', 12 - 'core.pkg.css' => '19f6f61f', 12 + 'core.pkg.css' => '525ecd1c', 13 13 'core.pkg.js' => '1475bd91', 14 14 'darkconsole.pkg.js' => '1f9a31bc', 15 15 'differential.pkg.css' => '7d4cfa59', ··· 71 71 'rsrc/css/application/differential/revision-history.css' => '0e8eb855', 72 72 'rsrc/css/application/differential/revision-list.css' => 'f3c47d33', 73 73 'rsrc/css/application/differential/table-of-contents.css' => 'ae4b7a55', 74 - 'rsrc/css/application/diffusion/diffusion-history.css' => '0c596546', 74 + 'rsrc/css/application/diffusion/diffusion-history.css' => '4faf40cd', 75 75 'rsrc/css/application/diffusion/diffusion-icons.css' => 'a6a1e2ba', 76 76 'rsrc/css/application/diffusion/diffusion-readme.css' => '18bd3910', 77 77 'rsrc/css/application/diffusion/diffusion-source.css' => '750add59', ··· 132 132 'rsrc/css/phui/object-item/phui-oi-color.css' => 'cd2b9b77', 133 133 'rsrc/css/phui/object-item/phui-oi-drag-ui.css' => '08f4ccc3', 134 134 'rsrc/css/phui/object-item/phui-oi-flush-ui.css' => '9d9685d6', 135 - 'rsrc/css/phui/object-item/phui-oi-list-view.css' => 'ed19241b', 135 + 'rsrc/css/phui/object-item/phui-oi-list-view.css' => '43752968', 136 136 'rsrc/css/phui/object-item/phui-oi-simple-ui.css' => 'a8beebea', 137 137 'rsrc/css/phui/phui-action-list.css' => 'c01858f4', 138 138 'rsrc/css/phui/phui-action-panel.css' => '91c7b835', ··· 158 158 'rsrc/css/phui/phui-header-view.css' => 'a3d1aecd', 159 159 'rsrc/css/phui/phui-hovercard.css' => 'f0592bcf', 160 160 'rsrc/css/phui/phui-icon-set-selector.css' => '87db8fee', 161 - 'rsrc/css/phui/phui-icon.css' => '4c6d624c', 161 + 'rsrc/css/phui/phui-icon.css' => '4c46b6ba', 162 162 'rsrc/css/phui/phui-image-mask.css' => 'a8498f9c', 163 163 'rsrc/css/phui/phui-info-panel.css' => '27ea50a1', 164 164 'rsrc/css/phui/phui-info-view.css' => '6e217679', ··· 575 575 'differential-revision-history-css' => '0e8eb855', 576 576 'differential-revision-list-css' => 'f3c47d33', 577 577 'differential-table-of-contents-css' => 'ae4b7a55', 578 - 'diffusion-history-css' => '0c596546', 578 + 'diffusion-history-css' => '4faf40cd', 579 579 'diffusion-icons-css' => 'a6a1e2ba', 580 580 'diffusion-readme-css' => '18bd3910', 581 581 'diffusion-source-css' => '750add59', ··· 862 862 'phui-hovercard' => '1bd28176', 863 863 'phui-hovercard-view-css' => 'f0592bcf', 864 864 'phui-icon-set-selector-css' => '87db8fee', 865 - 'phui-icon-view-css' => '4c6d624c', 865 + 'phui-icon-view-css' => '4c46b6ba', 866 866 'phui-image-mask-css' => 'a8498f9c', 867 867 'phui-info-panel-css' => '27ea50a1', 868 868 'phui-info-view-css' => '6e217679', ··· 875 875 'phui-oi-color-css' => 'cd2b9b77', 876 876 'phui-oi-drag-ui-css' => '08f4ccc3', 877 877 'phui-oi-flush-ui-css' => '9d9685d6', 878 - 'phui-oi-list-view-css' => 'ed19241b', 878 + 'phui-oi-list-view-css' => '43752968', 879 879 'phui-oi-simple-ui-css' => 'a8beebea', 880 880 'phui-pager-css' => '77d8a794', 881 881 'phui-pinboard-view-css' => '2495140e',
+5 -1
src/__phutil_library_map__.php
··· 728 728 'DiffusionGitSSHWorkflow' => 'applications/diffusion/ssh/DiffusionGitSSHWorkflow.php', 729 729 'DiffusionGitUploadPackSSHWorkflow' => 'applications/diffusion/ssh/DiffusionGitUploadPackSSHWorkflow.php', 730 730 'DiffusionHistoryController' => 'applications/diffusion/controller/DiffusionHistoryController.php', 731 + 'DiffusionHistoryListView' => 'applications/diffusion/view/DiffusionHistoryListView.php', 731 732 'DiffusionHistoryQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php', 732 733 'DiffusionHistoryTableView' => 'applications/diffusion/view/DiffusionHistoryTableView.php', 734 + 'DiffusionHistoryView' => 'applications/diffusion/view/DiffusionHistoryView.php', 733 735 'DiffusionHovercardEngineExtension' => 'applications/diffusion/engineextension/DiffusionHovercardEngineExtension.php', 734 736 'DiffusionInlineCommentController' => 'applications/diffusion/controller/DiffusionInlineCommentController.php', 735 737 'DiffusionInlineCommentPreviewController' => 'applications/diffusion/controller/DiffusionInlineCommentPreviewController.php', ··· 5705 5707 ), 5706 5708 'DiffusionGitUploadPackSSHWorkflow' => 'DiffusionGitSSHWorkflow', 5707 5709 'DiffusionHistoryController' => 'DiffusionController', 5710 + 'DiffusionHistoryListView' => 'DiffusionHistoryView', 5708 5711 'DiffusionHistoryQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod', 5709 - 'DiffusionHistoryTableView' => 'DiffusionView', 5712 + 'DiffusionHistoryTableView' => 'DiffusionHistoryView', 5713 + 'DiffusionHistoryView' => 'DiffusionView', 5710 5714 'DiffusionHovercardEngineExtension' => 'PhabricatorHovercardEngineExtension', 5711 5715 'DiffusionInlineCommentController' => 'PhabricatorInlineCommentController', 5712 5716 'DiffusionInlineCommentPreviewController' => 'PhabricatorInlineCommentPreviewController',
+24 -74
src/applications/diffusion/controller/DiffusionHistoryController.php
··· 26 26 'limit' => $pager->getPageSize() + 1, 27 27 ); 28 28 29 - if (!$request->getBool('copies')) { 30 - $params['needDirectChanges'] = true; 31 - $params['needChildChanges'] = true; 32 - } 33 - 34 29 $history_results = $this->callConduitWithDiffusionRequest( 35 30 'diffusion.historyquery', 36 31 $params); ··· 39 34 40 35 $history = $pager->sliceResults($history); 41 36 42 - $show_graph = !strlen($drequest->getPath()); 43 - $history_table = id(new DiffusionHistoryTableView()) 44 - ->setUser($request->getUser()) 37 + $history_list = id(new DiffusionHistoryListView()) 38 + ->setViewer($viewer) 45 39 ->setDiffusionRequest($drequest) 46 40 ->setHistory($history); 47 41 48 - $history_table->loadRevisions(); 49 - 50 - if ($show_graph) { 51 - $history_table->setParents($history_results['parents']); 52 - $history_table->setIsHead(!$pager->getOffset()); 53 - $history_table->setIsTail(!$pager->getHasMorePages()); 54 - } 55 - 56 - $history_header = $this->buildHistoryHeader($drequest); 57 - $history_panel = id(new PHUIObjectBoxView()) 58 - ->setHeader($history_header) 59 - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 60 - ->setTable($history_table) 61 - ->setPager($pager); 62 - 42 + $history_list->loadRevisions(); 63 43 $header = $this->buildHeader($drequest); 64 44 65 45 $crumbs = $this->buildCrumbs( ··· 70 50 )); 71 51 $crumbs->setBorder(true); 72 52 53 + $title = array( 54 + pht('History'), 55 + $repository->getDisplayName(), 56 + ); 57 + 58 + $pager = id(new PHUIBoxView()) 59 + ->addClass('mlb') 60 + ->appendChild($pager); 61 + 73 62 $view = id(new PHUITwoColumnView()) 74 63 ->setHeader($header) 75 64 ->setFooter(array( 76 - $history_panel, 65 + $history_list, 66 + $pager, 77 67 )); 78 68 79 69 return $this->newPage() 80 - ->setTitle( 81 - array( 82 - pht('History'), 83 - $repository->getDisplayName(), 84 - )) 70 + ->setTitle($title) 85 71 ->setCrumbs($crumbs) 86 - ->appendChild( 87 - array( 88 - $view, 89 - )); 72 + ->appendChild($view); 90 73 } 91 74 92 75 private function buildHeader(DiffusionRequest $drequest) { 93 76 $viewer = $this->getViewer(); 94 77 95 78 $tag = $this->renderCommitHashTag($drequest); 96 - 97 - $header = id(new PHUIHeaderView()) 98 - ->setUser($viewer) 99 - ->setPolicyObject($drequest->getRepository()) 100 - ->addTag($tag) 101 - ->setHeader($this->renderPathLinks($drequest, $mode = 'history')) 102 - ->setHeaderIcon('fa-clock-o'); 103 - 104 - return $header; 105 - 106 - } 107 - 108 - private function buildHistoryHeader(DiffusionRequest $drequest) { 109 - $viewer = $this->getViewer(); 110 - 111 79 $browse_uri = $drequest->generateURI( 112 80 array( 113 81 'action' => 'browse', ··· 117 85 ->setTag('a') 118 86 ->setText(pht('Browse')) 119 87 ->setHref($browse_uri) 120 - ->setIcon('fa-files-o'); 121 - 122 - // TODO: Sometimes we do have a change view, we need to look at the most 123 - // recent history entry to figure it out. 124 - 125 - $request = $this->getRequest(); 126 - if ($request->getBool('copies')) { 127 - $branch_name = pht('Hide Copies/Branches'); 128 - $branch_uri = $request->getRequestURI() 129 - ->alter('offset', null) 130 - ->alter('copies', null); 131 - } else { 132 - $branch_name = pht('Show Copies/Branches'); 133 - $branch_uri = $request->getRequestURI() 134 - ->alter('offset', null) 135 - ->alter('copies', true); 136 - } 137 - 138 - $branch_button = id(new PHUIButtonView()) 139 - ->setTag('a') 140 - ->setText($branch_name) 141 - ->setIcon('fa-code-fork') 142 - ->setHref($branch_uri); 88 + ->setIcon('fa-code'); 143 89 144 90 $header = id(new PHUIHeaderView()) 145 - ->setHeader(pht('History')) 146 - ->addActionLink($browse_button) 147 - ->addActionLink($branch_button); 91 + ->setUser($viewer) 92 + ->setPolicyObject($drequest->getRepository()) 93 + ->addTag($tag) 94 + ->setHeader($this->renderPathLinks($drequest, $mode = 'history')) 95 + ->setHeaderIcon('fa-clock-o') 96 + ->addActionLink($browse_button); 148 97 149 98 return $header; 99 + 150 100 } 151 101 152 102 }
+22 -3
src/applications/diffusion/view/DiffusionCommitListView.php
··· 25 25 return $this->commits; 26 26 } 27 27 28 + public function setHandles(array $handles) { 29 + assert_instances_of($handles, 'PhabricatorObjectHandle'); 30 + $this->handles = $handles; 31 + return $this; 32 + } 33 + 34 + private function getRequiredHandlePHIDs() { 35 + $phids = array(); 36 + foreach ($this->history as $item) { 37 + $data = $item->getCommitData(); 38 + if ($data) { 39 + if ($data->getCommitDetail('authorPHID')) { 40 + $phids[$data->getCommitDetail('authorPHID')] = true; 41 + } 42 + if ($data->getCommitDetail('committerPHID')) { 43 + $phids[$data->getCommitDetail('committerPHID')] = true; 44 + } 45 + } 46 + } 47 + return array_keys($phids); 48 + } 49 + 28 50 private function getCommitDescription($phid) { 29 51 if ($this->commits === null) { 30 52 return pht('(Unknown Commit)'); ··· 114 136 if ($author_phid) { 115 137 $author_name = $handles[$author_phid]->renderLink(); 116 138 $author_image_uri = $handles[$author_phid]->getImageURI(); 117 - $author_image_href = $handles[$author_phid]->getURI(); 118 139 } else { 119 140 $author_name = $commit->getCommitData()->getAuthorName(); 120 141 $author_image_uri = 121 142 celerity_get_resource_uri('/rsrc/image/people/user0.png'); 122 - $author_image_href = null; 123 143 } 124 144 125 145 $commit_tag = id(new PHUITagView()) ··· 134 154 ->setDisabled($commit->isUnreachable()) 135 155 ->setDescription($message) 136 156 ->setImageURI($author_image_uri) 137 - ->setImageHref($author_image_href) 138 157 ->addByline(pht('Author: %s', $author_name)) 139 158 ->addIcon('none', $committed) 140 159 ->addAttribute($commit_tag);
+225
src/applications/diffusion/view/DiffusionHistoryListView.php
··· 1 + <?php 2 + 3 + final class DiffusionHistoryListView extends DiffusionHistoryView { 4 + 5 + public function render() { 6 + $drequest = $this->getDiffusionRequest(); 7 + $viewer = $this->getUser(); 8 + $repository = $drequest->getRepository(); 9 + 10 + require_celerity_resource('diffusion-history-css'); 11 + Javelin::initBehavior('phabricator-tooltips'); 12 + 13 + $buildables = $this->loadBuildables( 14 + mpull($this->getHistory(), 'getCommit')); 15 + 16 + $show_revisions = PhabricatorApplication::isClassInstalledForViewer( 17 + 'PhabricatorDifferentialApplication', 18 + $viewer); 19 + 20 + $handles = $viewer->loadHandles($this->getRequiredHandlePHIDs()); 21 + 22 + $show_builds = PhabricatorApplication::isClassInstalledForViewer( 23 + 'PhabricatorHarbormasterApplication', 24 + $this->getUser()); 25 + 26 + $rows = array(); 27 + $ii = 0; 28 + $cur_date = 0; 29 + $list = null; 30 + $header = null; 31 + $view = array(); 32 + foreach ($this->getHistory() as $history) { 33 + $epoch = $history->getEpoch(); 34 + $new_date = date('Ymd', $history->getEpoch()); 35 + if ($cur_date != $new_date) { 36 + if ($list) { 37 + $view[] = id(new PHUIObjectBoxView()) 38 + ->setHeader($header) 39 + ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 40 + ->setObjectList($list); 41 + } 42 + $date = ucfirst( 43 + phabricator_relative_date($history->getEpoch(), $viewer)); 44 + $header = id(new PHUIHeaderView()) 45 + ->setHeader($date); 46 + $list = id(new PHUIObjectItemListView()) 47 + ->setFlush(true) 48 + ->addClass('diffusion-history-list'); 49 + } 50 + 51 + if ($epoch) { 52 + $committed = $viewer->formatShortDateTime($epoch); 53 + } else { 54 + $committed = null; 55 + } 56 + 57 + $data = $history->getCommitData(); 58 + $author_phid = $committer = $committer_phid = null; 59 + if ($data) { 60 + $author_phid = $data->getCommitDetail('authorPHID'); 61 + $committer_phid = $data->getCommitDetail('committerPHID'); 62 + $committer = $data->getCommitDetail('committer'); 63 + } 64 + 65 + if ($author_phid && isset($handles[$author_phid])) { 66 + $author_name = $handles[$author_phid]->renderLink(); 67 + $author_image = $handles[$author_phid]->getImageURI(); 68 + } else { 69 + $author_name = self::renderName($history->getAuthorName()); 70 + $author_image = 71 + celerity_get_resource_uri('/rsrc/image/people/user0.png'); 72 + } 73 + 74 + $different_committer = false; 75 + if ($committer_phid) { 76 + $different_committer = ($committer_phid != $author_phid); 77 + } else if ($committer != '') { 78 + $different_committer = ($committer != $history->getAuthorName()); 79 + } 80 + if ($different_committer) { 81 + if ($committer_phid && isset($handles[$committer_phid])) { 82 + $committer = $handles[$committer_phid]->renderLink(); 83 + } else { 84 + $committer = self::renderName($committer); 85 + } 86 + $author_name = hsprintf('%s / %s', $author_name, $committer); 87 + } 88 + 89 + // We can show details once the message and change have been imported. 90 + $partial_import = PhabricatorRepositoryCommit::IMPORTED_MESSAGE | 91 + PhabricatorRepositoryCommit::IMPORTED_CHANGE; 92 + 93 + $commit = $history->getCommit(); 94 + if ($commit && $commit->isPartiallyImported($partial_import) && $data) { 95 + $commit_desc = $history->getSummary(); 96 + } else { 97 + $commit_desc = phutil_tag('em', array(), pht("Importing\xE2\x80\xA6")); 98 + } 99 + 100 + $build_view = null; 101 + if ($show_builds) { 102 + $buildable = idx($buildables, $commit->getPHID()); 103 + if ($buildable !== null) { 104 + $build_view = $this->renderBuildable($buildable); 105 + } 106 + } 107 + 108 + $browse = $this->linkBrowse( 109 + $history->getPath(), 110 + array( 111 + 'commit' => $history->getCommitIdentifier(), 112 + 'branch' => $drequest->getBranch(), 113 + 'type' => $history->getFileType(), 114 + )); 115 + 116 + $differential_view = null; 117 + if ($show_revisions && $commit) { 118 + $d_id = idx($this->getRevisions(), $commit->getPHID()); 119 + if ($d_id) { 120 + $differential_view = id(new PHUIIconCircleView()) 121 + ->setIcon('fa-gear') 122 + ->setColor('green') 123 + ->setState(PHUIIconCircleView::STATE_SUCCESS) 124 + ->addSigil('has-tooltip') 125 + ->setSize(PHUIIconCircleView::SMALL) 126 + ->setHref('/D'.$d_id) 127 + ->addClass('mmr') 128 + ->setMetadata( 129 + array( 130 + 'tip' => 'Revision D'.$d_id, 131 + )); 132 + } 133 + } 134 + 135 + $status = $commit->getAuditStatus(); 136 + $icon = PhabricatorAuditCommitStatusConstants::getStatusIcon($status); 137 + $color = PhabricatorAuditCommitStatusConstants::getStatusColor($status); 138 + $name = PhabricatorAuditCommitStatusConstants::getStatusName($status); 139 + $audit_view = id(new PHUIIconCircleView()) 140 + ->setIcon('fa-code') 141 + ->setColor($color) 142 + ->setState($icon) 143 + ->addSigil('has-tooltip') 144 + ->setSize(PHUIIconCircleView::SMALL) 145 + ->addClass('mmr') 146 + ->setMetadata( 147 + array( 148 + 'tip' => $name, 149 + )); 150 + 151 + if ($show_builds) { 152 + $buildable = idx($buildables, $commit->getPHID()); 153 + if ($buildable !== null) { 154 + $status = $buildable->getBuildableStatus(); 155 + $icon = HarbormasterBuildable::getBuildableStatusIcon($status); 156 + $color = HarbormasterBuildable::getBuildableStatusColor($status); 157 + $name = HarbormasterBuildable::getBuildableStatusName($status); 158 + $build_view = id(new PHUIIconCircleView()) 159 + ->setIcon('fa-recycle') 160 + ->setColor($color) 161 + ->setState($icon) 162 + ->addSigil('has-tooltip') 163 + ->setSize(PHUIIconCircleView::SMALL) 164 + ->setHref('/'.$buildable->getMonogram()) 165 + ->addClass('mmr') 166 + ->setMetadata( 167 + array( 168 + 'tip' => $name, 169 + )); 170 + } 171 + } 172 + 173 + $message = null; 174 + $commit_link = $repository->getCommitURI( 175 + $history->getCommitIdentifier()); 176 + 177 + $commit_name = $repository->formatCommitName( 178 + $history->getCommitIdentifier(), $local = true); 179 + 180 + $committed = phabricator_datetime($commit->getEpoch(), $viewer); 181 + $author_name = phutil_tag( 182 + 'strong', 183 + array( 184 + 'class' => 'diffusion-history-author-name', 185 + ), 186 + $author_name); 187 + $authored = pht('%s on %s.', $author_name, $committed); 188 + 189 + $commit_tag = id(new PHUITagView()) 190 + ->setName($commit_name) 191 + ->setType(PHUITagView::TYPE_SHADE) 192 + ->setColor(PHUITagView::COLOR_INDIGO) 193 + ->setSlimShady(true); 194 + 195 + $browse_button = id(new PHUIButtonView()) 196 + ->setText(pht('Browse')) 197 + ->setIcon('fa-code') 198 + ->setTag('a') 199 + ->setColor(PHUIButtonView::SIMPLE) 200 + ->appendChild($audit_view); 201 + 202 + $item = id(new PHUIObjectItemView()) 203 + ->setHeader($commit_desc) 204 + ->setHref($commit_link) 205 + ->setDisabled($commit->isUnreachable()) 206 + ->setDescription($message) 207 + ->setImageURI($author_image) 208 + ->addAttribute($commit_tag) 209 + ->addAttribute($authored) 210 + ->setSideColumn(array( 211 + $differential_view, 212 + $audit_view, 213 + $build_view, 214 + $browse_button, 215 + )); 216 + 217 + $list->addItem($item); 218 + $cur_date = $new_date; 219 + } 220 + 221 + 222 + return $view; 223 + } 224 + 225 + }
+10 -83
src/applications/diffusion/view/DiffusionHistoryTableView.php
··· 1 1 <?php 2 2 3 - final class DiffusionHistoryTableView extends DiffusionView { 4 - 5 - private $history; 6 - private $revisions = array(); 7 - private $handles = array(); 8 - private $isHead; 9 - private $isTail; 10 - private $parents; 11 - private $filterParents; 12 - 13 - public function setHistory(array $history) { 14 - assert_instances_of($history, 'DiffusionPathChange'); 15 - $this->history = $history; 16 - return $this; 17 - } 18 - 19 - public function loadRevisions() { 20 - $commit_phids = array(); 21 - foreach ($this->history as $item) { 22 - if ($item->getCommit()) { 23 - $commit_phids[] = $item->getCommit()->getPHID(); 24 - } 25 - } 26 - 27 - // TODO: Get rid of this. 28 - $this->revisions = id(new DifferentialRevision()) 29 - ->loadIDsByCommitPHIDs($commit_phids); 30 - return $this; 31 - } 32 - 33 - public function setHandles(array $handles) { 34 - assert_instances_of($handles, 'PhabricatorObjectHandle'); 35 - $this->handles = $handles; 36 - return $this; 37 - } 38 - 39 - private function getRequiredHandlePHIDs() { 40 - $phids = array(); 41 - foreach ($this->history as $item) { 42 - $data = $item->getCommitData(); 43 - if ($data) { 44 - if ($data->getCommitDetail('authorPHID')) { 45 - $phids[$data->getCommitDetail('authorPHID')] = true; 46 - } 47 - if ($data->getCommitDetail('committerPHID')) { 48 - $phids[$data->getCommitDetail('committerPHID')] = true; 49 - } 50 - } 51 - } 52 - return array_keys($phids); 53 - } 54 - 55 - public function setParents(array $parents) { 56 - $this->parents = $parents; 57 - return $this; 58 - } 59 - 60 - public function setIsHead($is_head) { 61 - $this->isHead = $is_head; 62 - return $this; 63 - } 64 - 65 - public function setIsTail($is_tail) { 66 - $this->isTail = $is_tail; 67 - return $this; 68 - } 69 - 70 - public function setFilterParents($filter_parents) { 71 - $this->filterParents = $filter_parents; 72 - return $this; 73 - } 74 - 75 - public function getFilterParents() { 76 - return $this->filterParents; 77 - } 3 + final class DiffusionHistoryTableView extends DiffusionHistoryView { 78 4 79 5 public function render() { 80 6 $drequest = $this->getDiffusionRequest(); 81 7 82 8 $viewer = $this->getUser(); 83 9 84 - $buildables = $this->loadBuildables(mpull($this->history, 'getCommit')); 10 + $buildables = $this->loadBuildables( 11 + mpull($this->getHistory(), 'getCommit')); 85 12 $has_any_build = false; 86 13 87 14 $show_revisions = PhabricatorApplication::isClassInstalledForViewer( ··· 91 18 $handles = $viewer->loadHandles($this->getRequiredHandlePHIDs()); 92 19 93 20 $graph = null; 94 - if ($this->parents) { 95 - $parents = $this->parents; 21 + if ($this->getParents()) { 22 + $parents = $this->getParents(); 96 23 97 24 // If we're filtering parents, remove relationships which point to 98 25 // commits that are not part of the visible graph. Otherwise, we get 99 26 // a big tree of nonsense when viewing release branches like "stable" 100 27 // versus "master". 101 - if ($this->filterParents) { 28 + if ($this->getFilterParents()) { 102 29 foreach ($parents as $key => $nodes) { 103 30 foreach ($nodes as $nkey => $node) { 104 31 if (empty($parents[$node])) { ··· 109 36 } 110 37 111 38 $graph = id(new PHUIDiffGraphView()) 112 - ->setIsHead($this->isHead) 113 - ->setIsTail($this->isTail) 39 + ->setIsHead($this->getIsHead()) 40 + ->setIsTail($this->getIsTail()) 114 41 ->renderGraph($parents); 115 42 } 116 43 ··· 120 47 121 48 $rows = array(); 122 49 $ii = 0; 123 - foreach ($this->history as $history) { 50 + foreach ($this->getHistory() as $history) { 124 51 $epoch = $history->getEpoch(); 125 52 126 53 if ($epoch) { ··· 209 136 $build, 210 137 $audit_view, 211 138 ($commit ? 212 - self::linkRevision(idx($this->revisions, $commit->getPHID())) : 139 + self::linkRevision(idx($this->getRevisions(), $commit->getPHID())) : 213 140 null), 214 141 $author, 215 142 $summary,
+101
src/applications/diffusion/view/DiffusionHistoryView.php
··· 1 + <?php 2 + 3 + abstract class DiffusionHistoryView extends DiffusionView { 4 + 5 + private $history; 6 + private $revisions = array(); 7 + private $handles = array(); 8 + private $isHead; 9 + private $isTail; 10 + private $parents; 11 + private $filterParents; 12 + 13 + public function setHistory(array $history) { 14 + assert_instances_of($history, 'DiffusionPathChange'); 15 + $this->history = $history; 16 + return $this; 17 + } 18 + 19 + public function getHistory() { 20 + return $this->history; 21 + } 22 + 23 + public function loadRevisions() { 24 + $commit_phids = array(); 25 + foreach ($this->history as $item) { 26 + if ($item->getCommit()) { 27 + $commit_phids[] = $item->getCommit()->getPHID(); 28 + } 29 + } 30 + 31 + // TODO: Get rid of this. 32 + $this->revisions = id(new DifferentialRevision()) 33 + ->loadIDsByCommitPHIDs($commit_phids); 34 + return $this; 35 + } 36 + 37 + public function getRevisions() { 38 + return $this->revisions; 39 + } 40 + 41 + public function setHandles(array $handles) { 42 + assert_instances_of($handles, 'PhabricatorObjectHandle'); 43 + $this->handles = $handles; 44 + return $this; 45 + } 46 + 47 + public function getRequiredHandlePHIDs() { 48 + $phids = array(); 49 + foreach ($this->history as $item) { 50 + $data = $item->getCommitData(); 51 + if ($data) { 52 + if ($data->getCommitDetail('authorPHID')) { 53 + $phids[$data->getCommitDetail('authorPHID')] = true; 54 + } 55 + if ($data->getCommitDetail('committerPHID')) { 56 + $phids[$data->getCommitDetail('committerPHID')] = true; 57 + } 58 + } 59 + } 60 + return array_keys($phids); 61 + } 62 + 63 + public function setParents(array $parents) { 64 + $this->parents = $parents; 65 + return $this; 66 + } 67 + 68 + public function getParents() { 69 + return $this->parents; 70 + } 71 + 72 + public function setIsHead($is_head) { 73 + $this->isHead = $is_head; 74 + return $this; 75 + } 76 + 77 + public function getIsHead() { 78 + return $this->isHead; 79 + } 80 + 81 + public function setIsTail($is_tail) { 82 + $this->isTail = $is_tail; 83 + return $this; 84 + } 85 + 86 + public function getIsTail() { 87 + return $this->isTail; 88 + } 89 + 90 + public function setFilterParents($filter_parents) { 91 + $this->filterParents = $filter_parents; 92 + return $this; 93 + } 94 + 95 + public function getFilterParents() { 96 + return $this->filterParents; 97 + } 98 + 99 + public function render() {} 100 + 101 + }
+12 -18
src/applications/diffusion/view/DiffusionView.php
··· 168 168 'sigil' => 'has-tooltip', 169 169 'meta' => array( 170 170 'tip' => $email->getAddress(), 171 - 'align' => 'E', 171 + 'align' => 'S', 172 172 'size' => 'auto', 173 173 ), 174 174 ), ··· 177 177 return hsprintf('%s', $name); 178 178 } 179 179 180 - final protected function renderBuildable(HarbormasterBuildable $buildable) { 180 + final protected function renderBuildable( 181 + HarbormasterBuildable $buildable) { 181 182 $status = $buildable->getBuildableStatus(); 183 + Javelin::initBehavior('phabricator-tooltips'); 182 184 183 185 $icon = HarbormasterBuildable::getBuildableStatusIcon($status); 184 186 $color = HarbormasterBuildable::getBuildableStatusColor($status); 185 187 $name = HarbormasterBuildable::getBuildableStatusName($status); 186 188 187 - $icon_view = id(new PHUIIconView()) 188 - ->setIcon($icon.' '.$color); 189 - 190 - $tooltip_view = javelin_tag( 191 - 'span', 192 - array( 193 - 'sigil' => 'has-tooltip', 194 - 'meta' => array('tip' => $name), 195 - ), 196 - $icon_view); 189 + return id(new PHUIIconView()) 190 + ->setIcon($icon.' '.$color) 191 + ->addSigil('has-tooltip') 192 + ->setHref('/'.$buildable->getMonogram()) 193 + ->setMetadata( 194 + array( 195 + 'tip' => $name, 196 + )); 197 197 198 - Javelin::initBehavior('phabricator-tooltips'); 199 - 200 - return phutil_tag( 201 - 'a', 202 - array('href' => '/'.$buildable->getMonogram()), 203 - $tooltip_view); 204 198 } 205 199 206 200 final protected function loadBuildables(array $commits) {
+14 -1
webroot/rsrc/css/application/diffusion/diffusion-history.css
··· 3 3 */ 4 4 5 5 .diffusion-history-list .phui-oi-link { 6 - color: {$darkbluetext}; 6 + color: #000; 7 7 font-size: {$biggerfontsize}; 8 8 } 9 9 ··· 11 11 border-color: transparent; 12 12 } 13 13 14 + .diffusion-history-list .phui-oi-attribute .phui-tag-indigo a { 15 + color: {$indigo}; 16 + } 17 + 14 18 .diffusion-history-message { 15 19 background-color: {$bluebackground}; 16 20 padding: 16px; ··· 18 22 border-radius: 5px; 19 23 color: {$darkbluetext}; 20 24 } 25 + 26 + .diffusion-history-list .phui-oi-attribute { 27 + font-size: {$smallerfontsize}; 28 + letter-spacing: 0.01em; 29 + } 30 + 31 + .diffusion-history-author-name a { 32 + color: {$darkbluetext}; 33 + }
+4
webroot/rsrc/css/phui/object-item/phui-oi-list-view.css
··· 182 182 vertical-align: top; 183 183 } 184 184 185 + .phui-oi-col2.phui-oi-side-column { 186 + width: 200px; 187 + } 188 + 185 189 .device-phone .phui-oi-col1, 186 190 .device-phone .phui-oi-col2 { 187 191 display: block;
+1 -1
webroot/rsrc/css/phui/phui-icon.css
··· 144 144 color: {$red}; 145 145 } 146 146 147 - a.phui-icon-circle .phui-icon-view.phui-icon-circle-state-icon { 147 + .phui-icon-circle .phui-icon-view.phui-icon-circle-state-icon { 148 148 position: absolute; 149 149 width: 14px; 150 150 height: 14px;