mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 03:50:54 +01:00
Implement showing buildable status in Diffusion
Summary: This implements showing the buildable status in Diffusion and unifies some of the logic used to calculate and render build and buildable statuses. Test Plan: Looked at diffs and commits with statuses, they rendered fine. Looked at Diffusion and saw buildable status appear (with a manual buildable and manual buildables included in the query). Reviewers: #blessed_reviewers, epriestley, chad Reviewed By: #blessed_reviewers, epriestley Subscribers: epriestley, Korvin Differential Revision: https://secure.phabricator.com/D9496
This commit is contained in:
parent
8426d1d2ab
commit
ed76c2be1d
7 changed files with 155 additions and 62 deletions
|
@ -7,7 +7,7 @@
|
||||||
return array(
|
return array(
|
||||||
'names' =>
|
'names' =>
|
||||||
array(
|
array(
|
||||||
'core.pkg.css' => 'db38c2c9',
|
'core.pkg.css' => '595348ad',
|
||||||
'core.pkg.js' => '8335fe3f',
|
'core.pkg.js' => '8335fe3f',
|
||||||
'darkconsole.pkg.js' => 'ca8671ce',
|
'darkconsole.pkg.js' => 'ca8671ce',
|
||||||
'differential.pkg.css' => '4a93db37',
|
'differential.pkg.css' => '4a93db37',
|
||||||
|
@ -29,7 +29,7 @@ return array(
|
||||||
'rsrc/css/aphront/panel-view.css' => '5846dfa2',
|
'rsrc/css/aphront/panel-view.css' => '5846dfa2',
|
||||||
'rsrc/css/aphront/phabricator-nav-view.css' => '9283c2df',
|
'rsrc/css/aphront/phabricator-nav-view.css' => '9283c2df',
|
||||||
'rsrc/css/aphront/request-failure-view.css' => 'da14df31',
|
'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/tokenizer.css' => '82ce2142',
|
||||||
'rsrc/css/aphront/tooltip.css' => '9c90229d',
|
'rsrc/css/aphront/tooltip.css' => '9c90229d',
|
||||||
'rsrc/css/aphront/transaction.css' => 'ce491938',
|
'rsrc/css/aphront/transaction.css' => 'ce491938',
|
||||||
|
@ -135,7 +135,7 @@ return array(
|
||||||
'rsrc/css/phui/phui-list.css' => '43ed2d93',
|
'rsrc/css/phui/phui-list.css' => '43ed2d93',
|
||||||
'rsrc/css/phui/phui-object-box.css' => 'ce92d8ec',
|
'rsrc/css/phui/phui-object-box.css' => 'ce92d8ec',
|
||||||
'rsrc/css/phui/phui-object-item-list-view.css' => '46e12abc',
|
'rsrc/css/phui/phui-object-item-list-view.css' => '46e12abc',
|
||||||
'rsrc/css/phui/phui-pinboard-view.css' => '32e8e1a9',
|
'rsrc/css/phui/phui-pinboard-view.css' => '874c22f9',
|
||||||
'rsrc/css/phui/phui-property-list-view.css' => '2f7199e8',
|
'rsrc/css/phui/phui-property-list-view.css' => '2f7199e8',
|
||||||
'rsrc/css/phui/phui-remarkup-preview.css' => '19ad512b',
|
'rsrc/css/phui/phui-remarkup-preview.css' => '19ad512b',
|
||||||
'rsrc/css/phui/phui-spacing.css' => '042804d6',
|
'rsrc/css/phui/phui-spacing.css' => '042804d6',
|
||||||
|
@ -491,7 +491,7 @@ return array(
|
||||||
'aphront-pager-view-css' => '2e3539af',
|
'aphront-pager-view-css' => '2e3539af',
|
||||||
'aphront-panel-view-css' => '5846dfa2',
|
'aphront-panel-view-css' => '5846dfa2',
|
||||||
'aphront-request-failure-view-css' => 'da14df31',
|
'aphront-request-failure-view-css' => 'da14df31',
|
||||||
'aphront-table-view-css' => '88e80148',
|
'aphront-table-view-css' => 'c117956d',
|
||||||
'aphront-tokenizer-control-css' => '82ce2142',
|
'aphront-tokenizer-control-css' => '82ce2142',
|
||||||
'aphront-tooltip-css' => '9c90229d',
|
'aphront-tooltip-css' => '9c90229d',
|
||||||
'aphront-two-column-view-css' => '16ab3ad2',
|
'aphront-two-column-view-css' => '16ab3ad2',
|
||||||
|
@ -764,7 +764,7 @@ return array(
|
||||||
'phui-list-view-css' => '43ed2d93',
|
'phui-list-view-css' => '43ed2d93',
|
||||||
'phui-object-box-css' => 'ce92d8ec',
|
'phui-object-box-css' => 'ce92d8ec',
|
||||||
'phui-object-item-list-view-css' => '46e12abc',
|
'phui-object-item-list-view-css' => '46e12abc',
|
||||||
'phui-pinboard-view-css' => '32e8e1a9',
|
'phui-pinboard-view-css' => '874c22f9',
|
||||||
'phui-property-list-view-css' => '2f7199e8',
|
'phui-property-list-view-css' => '2f7199e8',
|
||||||
'phui-remarkup-preview-css' => '19ad512b',
|
'phui-remarkup-preview-css' => '19ad512b',
|
||||||
'phui-spacing-css' => '042804d6',
|
'phui-spacing-css' => '042804d6',
|
||||||
|
@ -1254,11 +1254,6 @@ return array(
|
||||||
2 => 'javelin-util',
|
2 => 'javelin-util',
|
||||||
3 => 'phabricator-shaped-request',
|
3 => 'phabricator-shaped-request',
|
||||||
),
|
),
|
||||||
'7319e029' =>
|
|
||||||
array(
|
|
||||||
0 => 'javelin-behavior',
|
|
||||||
1 => 'javelin-dom',
|
|
||||||
),
|
|
||||||
'62e18640' =>
|
'62e18640' =>
|
||||||
array(
|
array(
|
||||||
0 => 'javelin-install',
|
0 => 'javelin-install',
|
||||||
|
@ -1331,6 +1326,11 @@ return array(
|
||||||
1 => 'javelin-stratcom',
|
1 => 'javelin-stratcom',
|
||||||
2 => 'javelin-dom',
|
2 => 'javelin-dom',
|
||||||
),
|
),
|
||||||
|
'7319e029' =>
|
||||||
|
array(
|
||||||
|
0 => 'javelin-behavior',
|
||||||
|
1 => 'javelin-dom',
|
||||||
|
),
|
||||||
'76f4ebed' =>
|
'76f4ebed' =>
|
||||||
array(
|
array(
|
||||||
0 => 'javelin-install',
|
0 => 'javelin-install',
|
||||||
|
|
|
@ -7,10 +7,12 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
||||||
private $handles = array();
|
private $handles = array();
|
||||||
private $isHead;
|
private $isHead;
|
||||||
private $parents;
|
private $parents;
|
||||||
|
private $buildCache;
|
||||||
|
|
||||||
public function setHistory(array $history) {
|
public function setHistory(array $history) {
|
||||||
assert_instances_of($history, 'DiffusionPathChange');
|
assert_instances_of($history, 'DiffusionPathChange');
|
||||||
$this->history = $history;
|
$this->history = $history;
|
||||||
|
$this->buildCache = null;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +62,28 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
||||||
return $this;
|
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() {
|
public function render() {
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
|
|
||||||
|
@ -70,6 +94,10 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
||||||
$graph = $this->renderGraph();
|
$graph = $this->renderGraph();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$show_builds = PhabricatorApplication::isClassInstalledForViewer(
|
||||||
|
'PhabricatorApplicationHarbormaster',
|
||||||
|
$this->getUser());
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$ii = 0;
|
$ii = 0;
|
||||||
foreach ($this->history as $history) {
|
foreach ($this->history as $history) {
|
||||||
|
@ -124,11 +152,47 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
||||||
$summary = phutil_tag('em', array(), "Importing\xE2\x80\xA6");
|
$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(
|
$rows[] = array(
|
||||||
$graph ? $graph[$ii++] : null,
|
$graph ? $graph[$ii++] : null,
|
||||||
self::linkCommit(
|
self::linkCommit(
|
||||||
$drequest->getRepository(),
|
$drequest->getRepository(),
|
||||||
$history->getCommitIdentifier()),
|
$history->getCommitIdentifier()),
|
||||||
|
$build,
|
||||||
($commit ?
|
($commit ?
|
||||||
self::linkRevision(idx($this->revisions, $commit->getPHID())) :
|
self::linkRevision(idx($this->revisions, $commit->getPHID())) :
|
||||||
null),
|
null),
|
||||||
|
@ -144,6 +208,7 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
||||||
array(
|
array(
|
||||||
'',
|
'',
|
||||||
pht('Commit'),
|
pht('Commit'),
|
||||||
|
'',
|
||||||
pht('Revision'),
|
pht('Revision'),
|
||||||
pht('Author/Committer'),
|
pht('Author/Committer'),
|
||||||
pht('Details'),
|
pht('Details'),
|
||||||
|
@ -154,6 +219,7 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
||||||
array(
|
array(
|
||||||
'threads',
|
'threads',
|
||||||
'n',
|
'n',
|
||||||
|
'icon',
|
||||||
'n',
|
'n',
|
||||||
'',
|
'',
|
||||||
'wide',
|
'wide',
|
||||||
|
@ -169,6 +235,7 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
||||||
$graph ? true : false,
|
$graph ? true : false,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
|
true,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
|
|
|
@ -74,41 +74,8 @@ final class HarbormasterUIEventListener
|
||||||
|
|
||||||
$status = $build->getBuildStatus();
|
$status = $build->getBuildStatus();
|
||||||
$status_name = HarbormasterBuild::getBuildStatusName($status);
|
$status_name = HarbormasterBuild::getBuildStatusName($status);
|
||||||
|
$icon = HarbormasterBuild::getBuildStatusIcon($status);
|
||||||
switch ($status) {
|
$color = HarbormasterBuild::getBuildStatusColor($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;
|
|
||||||
}
|
|
||||||
|
|
||||||
$item->setIcon($icon, $color, $status_name);
|
$item->setIcon($icon, $color, $status_name);
|
||||||
|
|
||||||
|
|
|
@ -209,21 +209,10 @@ final class HarbormasterBuildableSearchEngine
|
||||||
$item->addIcon('fa-wrench grey', pht('Manual'));
|
$item->addIcon('fa-wrench grey', pht('Manual'));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($buildable->getBuildableStatus()) {
|
$item->setBarColor(HarbormasterBuildable::getBuildableStatusColor(
|
||||||
case HarbormasterBuildable::STATUS_PASSED:
|
$buildable->getBuildableStatus()));
|
||||||
$item->setBarColor('green');
|
$item->addByline(HarbormasterBuildable::getBuildableStatusName(
|
||||||
$item->addByline(pht('Build Passed'));
|
$buildable->getBuildableStatus()));
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
$list->addItem($item);
|
$list->addItem($item);
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,32 @@ final class HarbormasterBuildable extends HarbormasterDAO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
public static function initializeNewBuildable(PhabricatorUser $actor) {
|
||||||
return id(new HarbormasterBuildable())
|
return id(new HarbormasterBuildable())
|
||||||
->setIsManualBuildable(0)
|
->setIsManualBuildable(0)
|
||||||
|
|
|
@ -75,6 +75,45 @@ final class HarbormasterBuild extends HarbormasterDAO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
public static function initializeNewBuild(PhabricatorUser $actor) {
|
||||||
return id(new HarbormasterBuild())
|
return id(new HarbormasterBuild())
|
||||||
->setBuildStatus(self::STATUS_INACTIVE);
|
->setBuildStatus(self::STATUS_INACTIVE);
|
||||||
|
|
|
@ -181,6 +181,11 @@ th.aphront-table-view-sortable-selected {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.aphront-table-view td.icon, .aphront-table-view th.icon {
|
||||||
|
width: 1px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
div.single-display-line-bounds {
|
div.single-display-line-bounds {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
Loading…
Reference in a new issue