Display number of lint messages in Diffusion dir

Test Plan:
Went to https://secure.phabricator.com/diffusion/ARC/browse/.
Saw number of lint messages per dir, not terribly slow.
Went to https://secure.phabricator.com/diffusion/ARC/browse/master/src/difference/.
Saw number of lint messages per file.
Disabled lint, didn't see it.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3921
This commit is contained in:
vrana
2012-11-07 18:11:52 -08:00
parent 47a184e2a5
commit 846a359d9a
4 changed files with 76 additions and 6 deletions

View File

@@ -70,7 +70,19 @@ final class DiffusionHomeController extends DiffusionController {
}
}
$branch = new PhabricatorRepositoryBranch();
$lint_messages = queryfx_all(
$branch->establishConnection('r'),
'SELECT b.repositoryID, b.name, COUNT(lm.id) AS n
FROM %T b
LEFT JOIN %T lm ON b.id = lm.branchID
GROUP BY b.id',
$branch->getTableName(),
PhabricatorRepository::TABLE_LINTMESSAGE);
$lint_messages = igroup($lint_messages, 'repositoryID');
$rows = array();
$show_lint = false;
foreach ($repositories as $repository) {
$id = $repository->getID();
$commit = idx($commits, $id);
@@ -86,6 +98,13 @@ final class DiffusionHomeController extends DiffusionController {
number_format($size));
}
$lint_branches = ipull(idx($lint_messages, $id, array()), 'n', 'name');
$branch = $repository->getDefaultArcanistBranch();
if (isset($lint_branches[$branch])) {
$show_lint = true;
}
$date = '-';
$time = '-';
if ($commit) {
@@ -104,6 +123,9 @@ final class DiffusionHomeController extends DiffusionController {
PhabricatorRepositoryType::getNameForRepositoryType(
$repository->getVersionControlSystem()),
$size,
(isset($lint_branches[$branch])
? $lint_branches[$branch]
: ''),
$commit
? DiffusionView::linkCommit(
$repository,
@@ -138,6 +160,7 @@ final class DiffusionHomeController extends DiffusionController {
'Description',
'VCS',
'Commits',
'Lint',
'Last',
'Date',
'Time',
@@ -149,9 +172,21 @@ final class DiffusionHomeController extends DiffusionController {
'',
'n',
'n',
'n',
'',
'right',
));
$table->setColumnVisibility(
array(
true,
true,
true,
true,
$show_lint,
true,
true,
true,
));
$panel = new AphrontPanelView();
$panel->setHeader('Browse Repositories');

View File

@@ -24,7 +24,7 @@ final class DiffusionLastModifiedController extends DiffusionController {
$handles = $this->loadViewerHandles($phids);
$output = DiffusionBrowseTableView::renderLastModifiedColumns(
$drequest->getRepository(),
$drequest,
$handles,
$commit,
$commit_data);