1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-19 16:58:48 +02:00

Make push log "flags", "reject code" human readable; add crumbs to pull/push logs

Summary:
Depends on D18972. Ref T13049.

Currently, the "flags" columns renders an inscrutible bitmask which you have to go hunt down in the code. Show a list of flags in human-readable text instead.

The "code" column renders a meaningless integer code. Show a text description instead.

The pull logs and push logs pages don't have a crumb to go back up out of the current query. Add one.

Test Plan: Viewed push logs, no more arcane numbers. Saw and clicked crumbs on each log page.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13049

Differential Revision: https://secure.phabricator.com/D18973
This commit is contained in:
epriestley 2018-01-30 13:01:09 -08:00
parent ff98f6f522
commit 1e3d1271ad
3 changed files with 35 additions and 5 deletions

View file

@ -9,4 +9,9 @@ final class DiffusionPullLogListController
->buildResponse();
}
protected function buildApplicationCrumbs() {
return parent::buildApplicationCrumbs()
->addTextCrumb(pht('Pull Logs'), $this->getApplicationURI('pulllog/'));
}
}

View file

@ -9,4 +9,9 @@ final class DiffusionPushLogListController
->buildResponse();
}
protected function buildApplicationCrumbs() {
return parent::buildApplicationCrumbs()
->addTextCrumb(pht('Push Logs'), $this->getApplicationURI('pushlog/'));
}
}

View file

@ -28,6 +28,9 @@ final class DiffusionPushLogListView extends AphrontView {
// Only administrators can view remote addresses.
$remotes_visible = $viewer->getIsAdmin();
$flag_map = PhabricatorRepositoryPushLog::getFlagDisplayNames();
$reject_map = PhabricatorRepositoryPushLog::getRejectCodeDisplayNames();
$rows = array();
$any_host = false;
foreach ($logs as $log) {
@ -59,6 +62,23 @@ final class DiffusionPushLogListView extends AphrontView {
$device = null;
}
$flags = $log->getChangeFlags();
$flag_names = array();
foreach ($flag_map as $flag_key => $flag_name) {
if (($flags & $flag_key) === $flag_key) {
$flag_names[] = $flag_name;
}
}
$flag_names = phutil_implode_html(
phutil_tag('br'),
$flag_names);
$reject_code = $log->getPushEvent()->getRejectCode();
$reject_label = idx(
$reject_map,
$reject_code,
pht('Unknown ("%s")', $reject_code));
$rows[] = array(
phutil_tag(
'a',
@ -85,10 +105,8 @@ final class DiffusionPushLogListView extends AphrontView {
'href' => $repository->getCommitURI($log->getRefNew()),
),
$log->getRefNewShort()),
// TODO: Make these human-readable.
$log->getChangeFlags(),
$log->getPushEvent()->getRejectCode(),
$flag_names,
$reject_label,
$viewer->formatShortDateTime($log->getEpoch()),
);
}
@ -107,7 +125,7 @@ final class DiffusionPushLogListView extends AphrontView {
pht('Old'),
pht('New'),
pht('Flags'),
pht('Code'),
pht('Result'),
pht('Date'),
))
->setColumnClasses(
@ -122,6 +140,8 @@ final class DiffusionPushLogListView extends AphrontView {
'wide',
'n',
'n',
'',
'',
'right',
))
->setColumnVisibility(