mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 13:22:42 +01:00
Improve consistency and Harbormaster integration of Diffusion
Summary: Ref T9123. Two major Harbormaster-related UI changes in Diffusion: - Tags table now shows tag build status. - Branches table now shows branch build status. Then some minor consistency / qualtiy of life changes: - Picked a nicer looking "history" icon? - Branches table now uses the same "history" icon as other tables. - Tags table now has a "history" link. - Browse table now has a "history" link. - Dates now use more consistent formatting. - Column order is now more consistent. - Use of style is now more consistent. Test Plan: {F865056} {F865057} {F865058} Reviewers: chad Reviewed By: chad Maniphest Tasks: T9123 Differential Revision: https://secure.phabricator.com/D14242
This commit is contained in:
parent
03fea70497
commit
2bfa0e087e
6 changed files with 174 additions and 115 deletions
|
@ -98,12 +98,10 @@ final class DiffusionLastModifiedController extends DiffusionController {
|
||||||
$modified = DiffusionView::linkCommit(
|
$modified = DiffusionView::linkCommit(
|
||||||
$drequest->getRepository(),
|
$drequest->getRepository(),
|
||||||
$commit->getCommitIdentifier());
|
$commit->getCommitIdentifier());
|
||||||
$date = phabricator_date($epoch, $viewer);
|
$date = phabricator_datetime($epoch, $viewer);
|
||||||
$time = phabricator_time($epoch, $viewer);
|
|
||||||
} else {
|
} else {
|
||||||
$modified = '';
|
$modified = '';
|
||||||
$date = '';
|
$date = '';
|
||||||
$time = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $commit->getCommitData();
|
$data = $commit->getCommitData();
|
||||||
|
@ -137,7 +135,6 @@ final class DiffusionLastModifiedController extends DiffusionController {
|
||||||
$return = array(
|
$return = array(
|
||||||
'commit' => $modified,
|
'commit' => $modified,
|
||||||
'date' => $date,
|
'date' => $date,
|
||||||
'time' => $time,
|
|
||||||
'author' => $author,
|
'author' => $author,
|
||||||
'details' => $details,
|
'details' => $details,
|
||||||
);
|
);
|
||||||
|
|
|
@ -21,6 +21,11 @@ final class DiffusionBranchTableView extends DiffusionView {
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
$current_branch = $drequest->getBranch();
|
$current_branch = $drequest->getBranch();
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
$commits = $this->commits;
|
||||||
|
$viewer = $this->getUser();
|
||||||
|
|
||||||
|
$buildables = $this->loadBuildables($commits);
|
||||||
|
$have_builds = false;
|
||||||
|
|
||||||
$can_close_branches = ($repository->isHg());
|
$can_close_branches = ($repository->isHg());
|
||||||
|
|
||||||
|
@ -31,13 +36,21 @@ final class DiffusionBranchTableView extends DiffusionView {
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$rowc = array();
|
$rowc = array();
|
||||||
foreach ($this->branches as $branch) {
|
foreach ($this->branches as $branch) {
|
||||||
$commit = idx($this->commits, $branch->getCommitIdentifier());
|
$commit = idx($commits, $branch->getCommitIdentifier());
|
||||||
if ($commit) {
|
if ($commit) {
|
||||||
$details = $commit->getSummary();
|
$details = $commit->getSummary();
|
||||||
$datetime = phabricator_datetime($commit->getEpoch(), $this->user);
|
$datetime = phabricator_datetime($commit->getEpoch(), $viewer);
|
||||||
|
$buildable = idx($buildables, $commit->getPHID());
|
||||||
|
if ($buildable) {
|
||||||
|
$build_status = $this->renderBuildable($buildable);
|
||||||
|
$have_builds = true;
|
||||||
|
} else {
|
||||||
|
$build_status = null;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$datetime = null;
|
$datetime = null;
|
||||||
$details = null;
|
$details = null;
|
||||||
|
$build_status = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($repository->shouldSkipAutocloseBranch($branch->getShortName())) {
|
switch ($repository->shouldSkipAutocloseBranch($branch->getShortName())) {
|
||||||
|
@ -86,16 +99,7 @@ final class DiffusionBranchTableView extends DiffusionView {
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows[] = array(
|
$rows[] = array(
|
||||||
phutil_tag(
|
$this->linkBranchHistory($branch->getShortName()),
|
||||||
'a',
|
|
||||||
array(
|
|
||||||
'href' => $drequest->generateURI(
|
|
||||||
array(
|
|
||||||
'action' => 'history',
|
|
||||||
'branch' => $branch->getShortName(),
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
pht('History')),
|
|
||||||
phutil_tag(
|
phutil_tag(
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
|
@ -109,10 +113,11 @@ final class DiffusionBranchTableView extends DiffusionView {
|
||||||
self::linkCommit(
|
self::linkCommit(
|
||||||
$drequest->getRepository(),
|
$drequest->getRepository(),
|
||||||
$branch->getCommitIdentifier()),
|
$branch->getCommitIdentifier()),
|
||||||
|
$build_status,
|
||||||
$status,
|
$status,
|
||||||
|
AphrontTableView::renderSingleDisplayLine($details),
|
||||||
$status_icon,
|
$status_icon,
|
||||||
$datetime,
|
$datetime,
|
||||||
AphrontTableView::renderSingleDisplayLine($details),
|
|
||||||
);
|
);
|
||||||
if ($branch->getShortName() == $current_branch) {
|
if ($branch->getShortName() == $current_branch) {
|
||||||
$rowc[] = 'highlighted';
|
$rowc[] = 'highlighted';
|
||||||
|
@ -124,33 +129,37 @@ final class DiffusionBranchTableView extends DiffusionView {
|
||||||
$view = new AphrontTableView($rows);
|
$view = new AphrontTableView($rows);
|
||||||
$view->setHeaders(
|
$view->setHeaders(
|
||||||
array(
|
array(
|
||||||
pht('History'),
|
null,
|
||||||
pht('Branch'),
|
pht('Branch'),
|
||||||
pht('Head'),
|
pht('Head'),
|
||||||
|
null,
|
||||||
pht('State'),
|
pht('State'),
|
||||||
pht(''),
|
|
||||||
pht('Modified'),
|
|
||||||
pht('Details'),
|
pht('Details'),
|
||||||
|
null,
|
||||||
|
pht('Committed'),
|
||||||
));
|
));
|
||||||
$view->setColumnClasses(
|
$view->setColumnClasses(
|
||||||
array(
|
array(
|
||||||
'',
|
'',
|
||||||
'pri',
|
'pri',
|
||||||
'',
|
'',
|
||||||
'',
|
'icon',
|
||||||
'',
|
|
||||||
'',
|
'',
|
||||||
'wide',
|
'wide',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
));
|
));
|
||||||
$view->setColumnVisibility(
|
$view->setColumnVisibility(
|
||||||
array(
|
array(
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
|
$have_builds,
|
||||||
$can_close_branches,
|
$can_close_branches,
|
||||||
));
|
));
|
||||||
$view->setRowClasses($rowc);
|
$view->setRowClasses($rowc);
|
||||||
return $view->render();
|
return $view->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,8 @@ final class DiffusionBrowseTableView extends DiffusionView {
|
||||||
$show_edit = false;
|
$show_edit = false;
|
||||||
foreach ($this->paths as $path) {
|
foreach ($this->paths as $path) {
|
||||||
|
|
||||||
|
$history_link = $this->linkHistory($path->getPath());
|
||||||
|
|
||||||
$dir_slash = null;
|
$dir_slash = null;
|
||||||
$file_type = $path->getFileType();
|
$file_type = $path->getFileType();
|
||||||
if ($file_type == DifferentialChangeType::FILE_DIRECTORY) {
|
if ($file_type == DifferentialChangeType::FILE_DIRECTORY) {
|
||||||
|
@ -67,7 +69,6 @@ final class DiffusionBrowseTableView extends DiffusionView {
|
||||||
'lint' => celerity_generate_unique_node_id(),
|
'lint' => celerity_generate_unique_node_id(),
|
||||||
'commit' => celerity_generate_unique_node_id(),
|
'commit' => celerity_generate_unique_node_id(),
|
||||||
'date' => celerity_generate_unique_node_id(),
|
'date' => celerity_generate_unique_node_id(),
|
||||||
'time' => celerity_generate_unique_node_id(),
|
|
||||||
'author' => celerity_generate_unique_node_id(),
|
'author' => celerity_generate_unique_node_id(),
|
||||||
'details' => celerity_generate_unique_node_id(),
|
'details' => celerity_generate_unique_node_id(),
|
||||||
);
|
);
|
||||||
|
@ -78,13 +79,13 @@ final class DiffusionBrowseTableView extends DiffusionView {
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows[] = array(
|
$rows[] = array(
|
||||||
|
$history_link,
|
||||||
$browse_link,
|
$browse_link,
|
||||||
idx($dict, 'lint'),
|
idx($dict, 'lint'),
|
||||||
$dict['commit'],
|
$dict['commit'],
|
||||||
$dict['author'],
|
$dict['author'],
|
||||||
$dict['details'],
|
$dict['details'],
|
||||||
$dict['date'],
|
$dict['date'],
|
||||||
$dict['time'],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,29 +109,29 @@ final class DiffusionBrowseTableView extends DiffusionView {
|
||||||
$view = new AphrontTableView($rows);
|
$view = new AphrontTableView($rows);
|
||||||
$view->setHeaders(
|
$view->setHeaders(
|
||||||
array(
|
array(
|
||||||
|
null,
|
||||||
pht('Path'),
|
pht('Path'),
|
||||||
($lint ? $lint : pht('Lint')),
|
($lint ? $lint : pht('Lint')),
|
||||||
pht('Modified'),
|
pht('Modified'),
|
||||||
pht('Author/Committer'),
|
pht('Author/Committer'),
|
||||||
pht('Details'),
|
pht('Details'),
|
||||||
pht('Date'),
|
pht('Committed'),
|
||||||
pht('Time'),
|
|
||||||
));
|
));
|
||||||
$view->setColumnClasses(
|
$view->setColumnClasses(
|
||||||
array(
|
array(
|
||||||
|
'nudgeright',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
'',
|
'',
|
||||||
'n',
|
|
||||||
'n',
|
|
||||||
'',
|
'',
|
||||||
'wide',
|
'wide',
|
||||||
'',
|
'',
|
||||||
'right',
|
|
||||||
));
|
));
|
||||||
$view->setColumnVisibility(
|
$view->setColumnVisibility(
|
||||||
array(
|
array(
|
||||||
true,
|
true,
|
||||||
$show_lint,
|
|
||||||
true,
|
true,
|
||||||
|
$show_lint,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
|
@ -140,11 +141,11 @@ final class DiffusionBrowseTableView extends DiffusionView {
|
||||||
$view->setDeviceVisibility(
|
$view->setDeviceVisibility(
|
||||||
array(
|
array(
|
||||||
true,
|
true,
|
||||||
false,
|
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
|
true,
|
||||||
false,
|
false,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,10 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,33 +60,14 @@ 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();
|
||||||
|
|
||||||
$viewer = $this->getUser();
|
$viewer = $this->getUser();
|
||||||
|
|
||||||
|
$buildables = $this->loadBuildables(mpull($this->history, 'getCommit'));
|
||||||
|
$has_any_build = false;
|
||||||
|
|
||||||
$show_revisions = PhabricatorApplication::isClassInstalledForViewer(
|
$show_revisions = PhabricatorApplication::isClassInstalledForViewer(
|
||||||
'PhabricatorDifferentialApplication',
|
'PhabricatorDifferentialApplication',
|
||||||
$viewer);
|
$viewer);
|
||||||
|
@ -110,11 +89,9 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
||||||
$epoch = $history->getEpoch();
|
$epoch = $history->getEpoch();
|
||||||
|
|
||||||
if ($epoch) {
|
if ($epoch) {
|
||||||
$date = phabricator_date($epoch, $this->user);
|
$committed = phabricator_datetime($epoch, $viewer);
|
||||||
$time = phabricator_time($epoch, $this->user);
|
|
||||||
} else {
|
} else {
|
||||||
$date = null;
|
$committed = null;
|
||||||
$time = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $history->getCommitData();
|
$data = $history->getCommitData();
|
||||||
|
@ -160,36 +137,9 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
||||||
|
|
||||||
$build = null;
|
$build = null;
|
||||||
if ($show_builds) {
|
if ($show_builds) {
|
||||||
$buildable_lookup = $this->loadBuildablesOnDemand();
|
$buildable = idx($buildables, $commit->getPHID());
|
||||||
$buildable = idx($buildable_lookup, $commit->getPHID());
|
|
||||||
if ($buildable !== null) {
|
if ($buildable !== null) {
|
||||||
$icon = HarbormasterBuildable::getBuildableStatusIcon(
|
$build = $this->renderBuildable($buildable);
|
||||||
$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;
|
$has_any_build = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,8 +164,7 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
||||||
null),
|
null),
|
||||||
$author,
|
$author,
|
||||||
$summary,
|
$summary,
|
||||||
$date,
|
$committed,
|
||||||
$time,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,30 +175,28 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
||||||
null,
|
null,
|
||||||
pht('Commit'),
|
pht('Commit'),
|
||||||
null,
|
null,
|
||||||
pht('Revision'),
|
null,
|
||||||
pht('Author/Committer'),
|
pht('Author/Committer'),
|
||||||
pht('Details'),
|
pht('Details'),
|
||||||
pht('Date'),
|
pht('Committed'),
|
||||||
pht('Time'),
|
|
||||||
));
|
));
|
||||||
$view->setColumnClasses(
|
$view->setColumnClasses(
|
||||||
array(
|
array(
|
||||||
'threads',
|
'threads',
|
||||||
'nudgeright',
|
'nudgeright',
|
||||||
'n',
|
'',
|
||||||
'icon',
|
'icon',
|
||||||
'n',
|
'',
|
||||||
'',
|
'',
|
||||||
'wide',
|
'wide',
|
||||||
'',
|
'',
|
||||||
'right',
|
|
||||||
));
|
));
|
||||||
$view->setColumnVisibility(
|
$view->setColumnVisibility(
|
||||||
array(
|
array(
|
||||||
$graph ? true : false,
|
$graph ? true : false,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
true,
|
$has_any_build,
|
||||||
$show_revisions,
|
$show_revisions,
|
||||||
));
|
));
|
||||||
$view->setDeviceVisibility(
|
$view->setDeviceVisibility(
|
||||||
|
@ -262,7 +209,6 @@ final class DiffusionHistoryTableView extends DiffusionView {
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
false,
|
|
||||||
));
|
));
|
||||||
return $view->render();
|
return $view->render();
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,8 @@ final class DiffusionTagListView extends DiffusionView {
|
||||||
$drequest = $this->getDiffusionRequest();
|
$drequest = $this->getDiffusionRequest();
|
||||||
$repository = $drequest->getRepository();
|
$repository = $drequest->getRepository();
|
||||||
|
|
||||||
|
$buildables = $this->loadBuildables($this->commits);
|
||||||
|
$has_builds = false;
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach ($this->tags as $tag) {
|
foreach ($this->tags as $tag) {
|
||||||
|
@ -80,30 +82,56 @@ final class DiffusionTagListView extends DiffusionView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$build = null;
|
||||||
|
if ($commit) {
|
||||||
|
$buildable = idx($buildables, $commit->getPHID());
|
||||||
|
if ($buildable) {
|
||||||
|
$build = $this->renderBuildable($buildable);
|
||||||
|
$has_builds = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$history = $this->linkTagHistory($tag->getName());
|
||||||
|
|
||||||
$rows[] = array(
|
$rows[] = array(
|
||||||
|
$history,
|
||||||
$tag_link,
|
$tag_link,
|
||||||
$commit_link,
|
$commit_link,
|
||||||
$description,
|
$build,
|
||||||
$author,
|
$author,
|
||||||
|
$description,
|
||||||
phabricator_datetime($tag->getEpoch(), $this->user),
|
phabricator_datetime($tag->getEpoch(), $this->user),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$table = new AphrontTableView($rows);
|
$table = id(new AphrontTableView($rows))
|
||||||
$table->setHeaders(
|
->setHeaders(
|
||||||
array(
|
array(
|
||||||
pht('Tag'),
|
null,
|
||||||
pht('Commit'),
|
pht('Tag'),
|
||||||
pht('Description'),
|
pht('Commit'),
|
||||||
pht('Author'),
|
null,
|
||||||
pht('Created'),
|
pht('Author'),
|
||||||
));
|
pht('Description'),
|
||||||
$table->setColumnClasses(
|
pht('Created'),
|
||||||
array(
|
))
|
||||||
'pri',
|
->setColumnClasses(
|
||||||
'',
|
array(
|
||||||
'wide',
|
'nudgeright',
|
||||||
));
|
'pri',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
'wide',
|
||||||
|
))
|
||||||
|
->setColumnVisibility(
|
||||||
|
array(
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
$has_builds,
|
||||||
|
));
|
||||||
|
|
||||||
return $table->render();
|
return $table->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,30 @@ abstract class DiffusionView extends AphrontView {
|
||||||
'path' => $path,
|
'path' => $path,
|
||||||
));
|
));
|
||||||
|
|
||||||
|
return $this->renderHistoryLink($href);
|
||||||
|
}
|
||||||
|
|
||||||
|
final public function linkBranchHistory($branch) {
|
||||||
|
$href = $this->getDiffusionRequest()->generateURI(
|
||||||
|
array(
|
||||||
|
'action' => 'history',
|
||||||
|
'branch' => $branch,
|
||||||
|
));
|
||||||
|
|
||||||
|
return $this->renderHistoryLink($href);
|
||||||
|
}
|
||||||
|
|
||||||
|
final public function linkTagHistory($tag) {
|
||||||
|
$href = $this->getDiffusionRequest()->generateURI(
|
||||||
|
array(
|
||||||
|
'action' => 'history',
|
||||||
|
'commit' => $tag,
|
||||||
|
));
|
||||||
|
|
||||||
|
return $this->renderHistoryLink($href);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function renderHistoryLink($href) {
|
||||||
return javelin_tag(
|
return javelin_tag(
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
|
@ -31,7 +55,7 @@ abstract class DiffusionView extends AphrontView {
|
||||||
'align' => 'E',
|
'align' => 'E',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
id(new PHUIIconView())->setIconFont('fa-list-ul blue'));
|
id(new PHUIIconView())->setIconFont('fa-history bluegrey'));
|
||||||
}
|
}
|
||||||
|
|
||||||
final public function linkBrowse($path, array $details = array()) {
|
final public function linkBrowse($path, array $details = array()) {
|
||||||
|
@ -170,4 +194,58 @@ abstract class DiffusionView extends AphrontView {
|
||||||
return hsprintf('%s', $name);
|
return hsprintf('%s', $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final protected function renderBuildable(HarbormasterBuildable $buildable) {
|
||||||
|
$status = $buildable->getBuildableStatus();
|
||||||
|
|
||||||
|
$icon = HarbormasterBuildable::getBuildableStatusIcon($status);
|
||||||
|
$color = HarbormasterBuildable::getBuildableStatusColor($status);
|
||||||
|
$name = HarbormasterBuildable::getBuildableStatusName($status);
|
||||||
|
|
||||||
|
$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');
|
||||||
|
|
||||||
|
return phutil_tag(
|
||||||
|
'a',
|
||||||
|
array('href' => '/'.$buildable->getMonogram()),
|
||||||
|
$tooltip_view);
|
||||||
|
}
|
||||||
|
|
||||||
|
final protected function loadBuildables(array $commits) {
|
||||||
|
assert_instances_of($commits, 'PhabricatorRepositoryCommit');
|
||||||
|
|
||||||
|
if (!$commits) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$viewer = $this->getUser();
|
||||||
|
|
||||||
|
$harbormaster_app = 'PhabricatorHarbormasterApplication';
|
||||||
|
$have_harbormaster = PhabricatorApplication::isClassInstalledForViewer(
|
||||||
|
$harbormaster_app,
|
||||||
|
$viewer);
|
||||||
|
|
||||||
|
if ($have_harbormaster) {
|
||||||
|
$buildables = id(new HarbormasterBuildableQuery())
|
||||||
|
->setViewer($viewer)
|
||||||
|
->withBuildablePHIDs(mpull($commits, 'getPHID'))
|
||||||
|
->withManualBuildables(false)
|
||||||
|
->execute();
|
||||||
|
$buildables = mpull($buildables, null, 'getBuildablePHID');
|
||||||
|
} else {
|
||||||
|
$buildables = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $buildables;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue