Page MenuHomePhabricator

D9496.id22806.diff
No OneTemporary

D9496.id22806.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -7,7 +7,7 @@
return array(
'names' =>
array(
- 'core.pkg.css' => 'db38c2c9',
+ 'core.pkg.css' => '595348ad',
'core.pkg.js' => '8335fe3f',
'darkconsole.pkg.js' => 'ca8671ce',
'differential.pkg.css' => '4a93db37',
@@ -29,7 +29,7 @@
'rsrc/css/aphront/panel-view.css' => '5846dfa2',
'rsrc/css/aphront/phabricator-nav-view.css' => '9283c2df',
'rsrc/css/aphront/request-failure-view.css' => 'da14df31',
- 'rsrc/css/aphront/table-view.css' => '88e80148',
+ 'rsrc/css/aphront/table-view.css' => 'c117956d',
'rsrc/css/aphront/tokenizer.css' => '82ce2142',
'rsrc/css/aphront/tooltip.css' => '9c90229d',
'rsrc/css/aphront/transaction.css' => 'ce491938',
@@ -491,7 +491,7 @@
'aphront-pager-view-css' => '2e3539af',
'aphront-panel-view-css' => '5846dfa2',
'aphront-request-failure-view-css' => 'da14df31',
- 'aphront-table-view-css' => '88e80148',
+ 'aphront-table-view-css' => 'c117956d',
'aphront-tokenizer-control-css' => '82ce2142',
'aphront-tooltip-css' => '9c90229d',
'aphront-two-column-view-css' => '16ab3ad2',
@@ -1254,11 +1254,6 @@
2 => 'javelin-util',
3 => 'phabricator-shaped-request',
),
- '7319e029' =>
- array(
- 0 => 'javelin-behavior',
- 1 => 'javelin-dom',
- ),
'62e18640' =>
array(
0 => 'javelin-install',
@@ -1331,6 +1326,11 @@
1 => 'javelin-stratcom',
2 => 'javelin-dom',
),
+ '7319e029' =>
+ array(
+ 0 => 'javelin-behavior',
+ 1 => 'javelin-dom',
+ ),
'76f4ebed' =>
array(
0 => 'javelin-install',
diff --git a/src/applications/diffusion/view/DiffusionHistoryTableView.php b/src/applications/diffusion/view/DiffusionHistoryTableView.php
--- a/src/applications/diffusion/view/DiffusionHistoryTableView.php
+++ b/src/applications/diffusion/view/DiffusionHistoryTableView.php
@@ -7,10 +7,12 @@
private $handles = array();
private $isHead;
private $parents;
+ private $buildCache;
public function setHistory(array $history) {
assert_instances_of($history, 'DiffusionPathChange');
$this->history = $history;
+ $this->buildCache = null;
return $this;
}
@@ -60,6 +62,28 @@
return $this;
}
+ public function loadBuildablesOnDemand() {
+ if ($this->buildCache !== null) {
+ return $this->buildCache;
+ }
+
+ $commits_to_builds = array();
+
+ $commits = mpull($this->history, 'getCommit');
+
+ $commit_phids = mpull($commits, 'getPHID');
+
+ $buildables = id(new HarbormasterBuildableQuery())
+ ->setViewer($this->getUser())
+ ->withBuildablePHIDs($commit_phids)
+ ->withManualBuildables(false)
+ ->execute();
+
+ $this->buildCache = mpull($buildables, null, 'getBuildablePHID');
+
+ return $this->buildCache;
+ }
+
public function render() {
$drequest = $this->getDiffusionRequest();
@@ -70,6 +94,10 @@
$graph = $this->renderGraph();
}
+ $show_builds = PhabricatorApplication::isClassInstalledForViewer(
+ 'PhabricatorApplicationHarbormaster',
+ $this->getUser());
+
$rows = array();
$ii = 0;
foreach ($this->history as $history) {
@@ -124,11 +152,47 @@
$summary = phutil_tag('em', array(), "Importing\xE2\x80\xA6");
}
+ $build = null;
+ if ($show_builds) {
+ $buildable_lookup = $this->loadBuildablesOnDemand();
+ $buildable = idx($buildable_lookup, $commit->getPHID());
+ if ($buildable !== null) {
+ $icon = HarbormasterBuildable::getBuildableStatusIcon(
+ $buildable->getBuildableStatus());
+ $color = HarbormasterBuildable::getBuildableStatusColor(
+ $buildable->getBuildableStatus());
+ $name = HarbormasterBuildable::getBuildableStatusName(
+ $buildable->getBuildableStatus());
+
+ $icon_view = id(new PHUIIconView())
+ ->setIconFont($icon.' '.$color);
+
+ $tooltip_view = javelin_tag(
+ 'span',
+ array(
+ 'sigil' => 'has-tooltip',
+ 'meta' => array('tip' => $name)),
+ $icon_view);
+
+ Javelin::initBehavior('phabricator-tooltips');
+
+ $href_view = phutil_tag(
+ 'a',
+ array('href' => '/'.$buildable->getMonogram()),
+ $tooltip_view);
+
+ $build = $href_view;
+
+ $has_any_build = true;
+ }
+ }
+
$rows[] = array(
$graph ? $graph[$ii++] : null,
self::linkCommit(
$drequest->getRepository(),
$history->getCommitIdentifier()),
+ $build,
($commit ?
self::linkRevision(idx($this->revisions, $commit->getPHID())) :
null),
@@ -138,12 +202,13 @@
$time,
);
}
-
+
$view = new AphrontTableView($rows);
$view->setHeaders(
array(
'',
pht('Commit'),
+ '',
pht('Revision'),
pht('Author/Committer'),
pht('Details'),
@@ -154,6 +219,7 @@
array(
'threads',
'n',
+ 'icon',
'n',
'',
'wide',
@@ -169,6 +235,7 @@
$graph ? true : false,
true,
true,
+ true,
false,
true,
false,
diff --git a/src/applications/harbormaster/event/HarbormasterUIEventListener.php b/src/applications/harbormaster/event/HarbormasterUIEventListener.php
--- a/src/applications/harbormaster/event/HarbormasterUIEventListener.php
+++ b/src/applications/harbormaster/event/HarbormasterUIEventListener.php
@@ -74,41 +74,8 @@
$status = $build->getBuildStatus();
$status_name = HarbormasterBuild::getBuildStatusName($status);
-
- switch ($status) {
- case HarbormasterBuild::STATUS_INACTIVE:
- $icon = PHUIStatusItemView::ICON_OPEN;
- $color = 'dark';
- break;
- case HarbormasterBuild::STATUS_PENDING:
- $icon = PHUIStatusItemView::ICON_OPEN;
- $color = 'blue';
- break;
- case HarbormasterBuild::STATUS_BUILDING:
- $icon = PHUIStatusItemView::ICON_RIGHT;
- $color = 'blue';
- break;
- case HarbormasterBuild::STATUS_PASSED:
- $icon = PHUIStatusItemView::ICON_ACCEPT;
- $color = 'green';
- break;
- case HarbormasterBuild::STATUS_FAILED:
- $icon = PHUIStatusItemView::ICON_REJECT;
- $color = 'red';
- break;
- case HarbormasterBuild::STATUS_ERROR:
- $icon = PHUIStatusItemView::ICON_MINUS;
- $color = 'red';
- break;
- case HarbormasterBuild::STATUS_STOPPED:
- $icon = PHUIStatusItemView::ICON_MINUS;
- $color = 'dark';
- break;
- default:
- $icon = PHUIStatusItemView::ICON_QUESTION;
- $color = 'bluegrey';
- break;
- }
+ $icon = HarbormasterBuild::getBuildStatusIcon($status);
+ $color = HarbormasterBuild::getBuildStatusColor($status);
$item->setIcon($icon, $color, $status_name);
diff --git a/src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php b/src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php
--- a/src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php
+++ b/src/applications/harbormaster/query/HarbormasterBuildableSearchEngine.php
@@ -208,22 +208,11 @@
if ($buildable->getIsManualBuildable()) {
$item->addIcon('fa-wrench grey', pht('Manual'));
}
-
- switch ($buildable->getBuildableStatus()) {
- case HarbormasterBuildable::STATUS_PASSED:
- $item->setBarColor('green');
- $item->addByline(pht('Build Passed'));
- break;
- case HarbormasterBuildable::STATUS_FAILED:
- $item->setBarColor('red');
- $item->addByline(pht('Build Failed'));
- break;
- case HarbormasterBuildable::STATUS_BUILDING:
- $item->setBarColor('red');
- $item->addByline(pht('Building'));
- break;
-
- }
+
+ $item->setBarColor(HarbormasterBuildable::getBuildableStatusColor(
+ $buildable->getBuildableStatus()));
+ $item->addByline(HarbormasterBuildable::getBuildableStatusName(
+ $buildable->getBuildableStatus()));
$list->addItem($item);
diff --git a/src/applications/harbormaster/storage/HarbormasterBuildable.php b/src/applications/harbormaster/storage/HarbormasterBuildable.php
--- a/src/applications/harbormaster/storage/HarbormasterBuildable.php
+++ b/src/applications/harbormaster/storage/HarbormasterBuildable.php
@@ -33,6 +33,32 @@
}
}
+ public static function getBuildableStatusIcon($status) {
+ switch ($status) {
+ case self::STATUS_BUILDING:
+ return PHUIStatusItemView::ICON_RIGHT;
+ case self::STATUS_PASSED:
+ return PHUIStatusItemView::ICON_ACCEPT;
+ case self::STATUS_FAILED:
+ return PHUIStatusItemView::ICON_REJECT;
+ default:
+ return PHUIStatusItemView::ICON_QUESTION;
+ }
+ }
+
+ public static function getBuildableStatusColor($status) {
+ switch ($status) {
+ case self::STATUS_BUILDING:
+ return 'blue';
+ case self::STATUS_PASSED:
+ return 'green';
+ case self::STATUS_FAILED:
+ return 'red';
+ default:
+ return 'bluegrey';
+ }
+ }
+
public static function initializeNewBuildable(PhabricatorUser $actor) {
return id(new HarbormasterBuildable())
->setIsManualBuildable(0)
diff --git a/src/applications/harbormaster/storage/build/HarbormasterBuild.php b/src/applications/harbormaster/storage/build/HarbormasterBuild.php
--- a/src/applications/harbormaster/storage/build/HarbormasterBuild.php
+++ b/src/applications/harbormaster/storage/build/HarbormasterBuild.php
@@ -75,6 +75,45 @@
}
}
+ public static function getBuildStatusIcon($status) {
+ switch ($status) {
+ case self::STATUS_INACTIVE:
+ case self::STATUS_PENDING:
+ return PHUIStatusItemView::ICON_OPEN;
+ case self::STATUS_BUILDING:
+ return PHUIStatusItemView::ICON_RIGHT;
+ case self::STATUS_PASSED:
+ return PHUIStatusItemView::ICON_ACCEPT;
+ case self::STATUS_FAILED:
+ return PHUIStatusItemView::ICON_REJECT;
+ case self::STATUS_ERROR:
+ return PHUIStatusItemView::ICON_MINUS;
+ case self::STATUS_STOPPED:
+ return PHUIStatusItemView::ICON_MINUS;
+ default:
+ return PHUIStatusItemView::ICON_QUESTION;
+ }
+ }
+
+ public static function getBuildStatusColor($status) {
+ switch ($status) {
+ case self::STATUS_INACTIVE:
+ return 'dark';
+ case self::STATUS_PENDING:
+ case self::STATUS_BUILDING:
+ return 'blue';
+ case self::STATUS_PASSED:
+ return 'green';
+ case self::STATUS_FAILED:
+ case self::STATUS_ERROR:
+ return 'red';
+ case self::STATUS_STOPPED:
+ return 'dark';
+ default:
+ return 'bluegrey';
+ }
+ }
+
public static function initializeNewBuild(PhabricatorUser $actor) {
return id(new HarbormasterBuild())
->setBuildStatus(self::STATUS_INACTIVE);
diff --git a/webroot/rsrc/css/aphront/table-view.css b/webroot/rsrc/css/aphront/table-view.css
--- a/webroot/rsrc/css/aphront/table-view.css
+++ b/webroot/rsrc/css/aphront/table-view.css
@@ -181,6 +181,11 @@
width: 1px;
}
+.aphront-table-view td.icon, .aphront-table-view th.icon {
+ width: 1px;
+ padding: 0px;
+}
+
div.single-display-line-bounds {
width: 100%;
position: relative;

File Metadata

Mime Type
text/plain
Expires
Mon, Oct 28, 6:09 AM (3 w, 11 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6725347
Default Alt Text
D9496.id22806.diff (11 KB)

Event Timeline