Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15444793
D18113.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
9 KB
Referenced Files
None
Subscribers
None
D18113.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -71,7 +71,7 @@
'rsrc/css/application/differential/revision-history.css' => '0e8eb855',
'rsrc/css/application/differential/revision-list.css' => 'f3c47d33',
'rsrc/css/application/differential/table-of-contents.css' => 'ae4b7a55',
- 'rsrc/css/application/diffusion/diffusion-history.css' => '6870e8c1',
+ 'rsrc/css/application/diffusion/diffusion-history.css' => '4540f568',
'rsrc/css/application/diffusion/diffusion-icons.css' => 'a6a1e2ba',
'rsrc/css/application/diffusion/diffusion-readme.css' => '419dd5b6',
'rsrc/css/application/diffusion/diffusion-source.css' => '750add59',
@@ -569,7 +569,7 @@
'differential-revision-history-css' => '0e8eb855',
'differential-revision-list-css' => 'f3c47d33',
'differential-table-of-contents-css' => 'ae4b7a55',
- 'diffusion-history-css' => '6870e8c1',
+ 'diffusion-history-css' => '4540f568',
'diffusion-icons-css' => 'a6a1e2ba',
'diffusion-readme-css' => '419dd5b6',
'diffusion-source-css' => '750add59',
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -613,6 +613,7 @@
'DiffusionBlameConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionBlameConduitAPIMethod.php',
'DiffusionBlameQuery' => 'applications/diffusion/query/blame/DiffusionBlameQuery.php',
'DiffusionBlockHeraldAction' => 'applications/diffusion/herald/DiffusionBlockHeraldAction.php',
+ 'DiffusionBranchListView' => 'applications/diffusion/view/DiffusionBranchListView.php',
'DiffusionBranchQueryConduitAPIMethod' => 'applications/diffusion/conduit/DiffusionBranchQueryConduitAPIMethod.php',
'DiffusionBranchTableController' => 'applications/diffusion/controller/DiffusionBranchTableController.php',
'DiffusionBranchTableView' => 'applications/diffusion/view/DiffusionBranchTableView.php',
@@ -5584,6 +5585,7 @@
'DiffusionBlameConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
'DiffusionBlameQuery' => 'DiffusionQuery',
'DiffusionBlockHeraldAction' => 'HeraldAction',
+ 'DiffusionBranchListView' => 'DiffusionView',
'DiffusionBranchQueryConduitAPIMethod' => 'DiffusionQueryConduitAPIMethod',
'DiffusionBranchTableController' => 'DiffusionController',
'DiffusionBranchTableView' => 'DiffusionView',
diff --git a/src/applications/diffusion/controller/DiffusionBranchTableController.php b/src/applications/diffusion/controller/DiffusionBranchTableController.php
--- a/src/applications/diffusion/controller/DiffusionBranchTableController.php
+++ b/src/applications/diffusion/controller/DiffusionBranchTableController.php
@@ -48,7 +48,7 @@
->withRepository($repository)
->execute();
- $table = id(new DiffusionBranchTableView())
+ $list = id(new DiffusionBranchListView())
->setUser($viewer)
->setBranches($branches)
->setCommits($commits)
@@ -57,7 +57,7 @@
$content = id(new PHUIObjectBoxView())
->setHeaderText($repository->getName())
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)
- ->setTable($table)
+ ->setTable($list)
->setPager($pager);
}
@@ -84,10 +84,7 @@
$repository->getDisplayName(),
))
->setCrumbs($crumbs)
- ->appendChild(
- array(
- $view,
- ));
+ ->appendChild($view);
}
}
diff --git a/src/applications/diffusion/view/DiffusionBranchListView.php b/src/applications/diffusion/view/DiffusionBranchListView.php
new file mode 100644
--- /dev/null
+++ b/src/applications/diffusion/view/DiffusionBranchListView.php
@@ -0,0 +1,149 @@
+<?php
+
+final class DiffusionBranchListView extends DiffusionView {
+
+ private $branches;
+ private $commits = array();
+
+ public function setBranches(array $branches) {
+ assert_instances_of($branches, 'DiffusionRepositoryRef');
+ $this->branches = $branches;
+ return $this;
+ }
+
+ public function setCommits(array $commits) {
+ assert_instances_of($commits, 'PhabricatorRepositoryCommit');
+ $this->commits = mpull($commits, null, 'getCommitIdentifier');
+ return $this;
+ }
+
+ public function render() {
+ $drequest = $this->getDiffusionRequest();
+ $current_branch = $drequest->getBranch();
+ $repository = $drequest->getRepository();
+ $commits = $this->commits;
+ $viewer = $this->getUser();
+ require_celerity_resource('diffusion-history-css');
+
+ $buildables = $this->loadBuildables($commits);
+ $have_builds = false;
+
+ $can_close_branches = ($repository->isHg());
+
+ Javelin::initBehavior('phabricator-tooltips');
+
+ $doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: Autoclose');
+ $list = id(new PHUIObjectItemListView())
+ ->setFlush(true)
+ ->addClass('diffusion-history-list')
+ ->addClass('diffusion-branch-list');
+
+ foreach ($this->branches as $branch) {
+ $build_view = null;
+ $button_bar = new PHUIButtonBarView();
+ $commit = idx($commits, $branch->getCommitIdentifier());
+ if ($commit) {
+ $details = $commit->getSummary();
+ $datetime = phabricator_datetime($commit->getEpoch(), $viewer);
+
+ $buildable = idx($buildables, $commit->getPHID());
+ if ($buildable) {
+ $status = $buildable->getBuildableStatus();
+ $icon = HarbormasterBuildable::getBuildableStatusIcon($status);
+ $color = HarbormasterBuildable::getBuildableStatusColor($status);
+ $name = HarbormasterBuildable::getBuildableStatusName($status);
+ $build_view = id(new PHUIButtonView())
+ ->setTag('a')
+ ->setText($name)
+ ->setIcon($icon)
+ ->setColor($color)
+ ->setHref('/'.$buildable->getMonogram())
+ ->addClass('mmr')
+ ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE);
+ }
+ } else {
+ $datetime = null;
+ $details = null;
+ }
+
+ if ($repository->supportsBranchComparison()) {
+ $compare_uri = $drequest->generateURI(
+ array(
+ 'action' => 'compare',
+ 'head' => $branch->getShortName(),
+ ));
+ $can_compare = ($branch->getShortName() != $current_branch);
+ if ($can_compare) {
+ $button_bar->addButton(
+ id(new PHUIButtonView())
+ ->setTag('a')
+ ->setIcon('fa-balance-scale')
+ ->setToolTip(pht('Compare'))
+ ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE)
+ ->setWorkflow(true)
+ ->setHref($compare_uri));
+ }
+ }
+
+ $fields = $branch->getRawFields();
+ $closed = idx($fields, 'closed');
+ if ($closed) {
+ $status = pht('Closed');
+ } else {
+ $status = pht('Open');
+ }
+
+ $browse_href = $drequest->generateURI(
+ array(
+ 'action' => 'browse',
+ 'branch' => $branch->getShortName(),
+ ));
+
+ $button_bar->addButton(
+ id(new PHUIButtonView())
+ ->setIcon('fa-code')
+ ->setHref($browse_href)
+ ->setTag('a')
+ ->setTooltip(pht('Browse'))
+ ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE));
+
+ $commit_link = $repository->getCommitURI(
+ $branch->getCommitIdentifier());
+
+ $commit_name = $repository->formatCommitName(
+ $branch->getCommitIdentifier(), $local = true);
+
+ $commit_tag = id(new PHUITagView())
+ ->setName($commit_name)
+ ->setHref($commit_link)
+ ->setType(PHUITagView::TYPE_SHADE)
+ ->setColor(PHUITagView::COLOR_INDIGO)
+ ->setBorder(PHUITagView::BORDER_NONE)
+ ->setSlimShady(true);
+ $subhead = array($commit_tag, ' ', $details);
+
+ $item = id(new PHUIObjectItemView())
+ ->setHeader($branch->getShortName())
+ ->setHref($drequest->generateURI(
+ array(
+ 'action' => 'history',
+ 'branch' => $branch->getShortName(),
+ )))
+ ->setSubhead($subhead)
+ ->setSideColumn(array(
+ $build_view,
+ $button_bar,
+ ));
+
+ if ($branch->getShortName() == $repository->getDefaultBranch()) {
+ $item->setStatusIcon('fa-code-fork', pht('Default Branch'));
+ }
+ $item->addAttribute(array($datetime));
+
+ $list->addItem($item);
+
+ }
+ return $list;
+
+ }
+}
diff --git a/src/applications/diffusion/view/DiffusionView.php b/src/applications/diffusion/view/DiffusionView.php
--- a/src/applications/diffusion/view/DiffusionView.php
+++ b/src/applications/diffusion/view/DiffusionView.php
@@ -116,10 +116,10 @@
if ($button) {
return id(new PHUIButtonView())
- ->setText(pht('Browse'))
+ ->setTag('a')
->setIcon('fa-code')
->setHref($href)
- ->setTag('a')
+ ->setToolTip(pht('Browse'))
->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE);
}
diff --git a/webroot/rsrc/css/application/diffusion/diffusion-history.css b/webroot/rsrc/css/application/diffusion/diffusion-history.css
--- a/webroot/rsrc/css/application/diffusion/diffusion-history.css
+++ b/webroot/rsrc/css/application/diffusion/diffusion-history.css
@@ -30,6 +30,23 @@
margin-left: 4px;
}
+/* - Branch Styles ----------------------------------------------------------*/
+
+.diffusion-branch-list .phui-oi-attribute a {
+ color: {$darkbluetext};
+}
+
+.diffusion-branch-list .phui-oi-attribute-spacer {
+ visibility: hidden;
+}
+
+.diffusion-branch-list .phui-oi-subhead {
+ color: {$bluetext};
+}
+
+.diffusion-branch-list .phui-oi-subhead .phui-tag-view {
+ margin-right: 4px;
+}
/* - Phone Style ------------------------------------------------------------*/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 28, 11:21 AM (6 d, 9 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7718299
Default Alt Text
D18113.diff (9 KB)
Attached To
Mode
D18113: Add DiffusionBranchListView for browsing branches
Attached
Detach File
Event Timeline
Log In to Comment