Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/view/DiffusionPushLogListView.php
| Show All 22 Lines | foreach ($logs as $log) { | ||||
| } | } | ||||
| } | } | ||||
| $handles = $viewer->loadHandles($handle_phids); | $handles = $viewer->loadHandles($handle_phids); | ||||
| // Only administrators can view remote addresses. | // Only administrators can view remote addresses. | ||||
| $remotes_visible = $viewer->getIsAdmin(); | $remotes_visible = $viewer->getIsAdmin(); | ||||
| $flag_map = PhabricatorRepositoryPushLog::getFlagDisplayNames(); | |||||
| $reject_map = PhabricatorRepositoryPushLog::getRejectCodeDisplayNames(); | |||||
| $rows = array(); | $rows = array(); | ||||
| $any_host = false; | $any_host = false; | ||||
| foreach ($logs as $log) { | foreach ($logs as $log) { | ||||
| $repository = $log->getRepository(); | $repository = $log->getRepository(); | ||||
| if ($remotes_visible) { | if ($remotes_visible) { | ||||
| $remote_address = $log->getPushEvent()->getRemoteAddress(); | $remote_address = $log->getPushEvent()->getRemoteAddress(); | ||||
| } else { | } else { | ||||
| Show All 15 Lines | foreach ($logs as $log) { | ||||
| $device_phid = $log->getDevicePHID(); | $device_phid = $log->getDevicePHID(); | ||||
| if ($device_phid) { | if ($device_phid) { | ||||
| $device = $viewer->renderHandle($device_phid); | $device = $viewer->renderHandle($device_phid); | ||||
| $any_host = true; | $any_host = true; | ||||
| } else { | } else { | ||||
| $device = null; | $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( | $rows[] = array( | ||||
| phutil_tag( | phutil_tag( | ||||
| 'a', | 'a', | ||||
| array( | array( | ||||
| 'href' => '/diffusion/pushlog/view/'.$event_id.'/', | 'href' => '/diffusion/pushlog/view/'.$event_id.'/', | ||||
| ), | ), | ||||
| $event_id), | $event_id), | ||||
| phutil_tag( | phutil_tag( | ||||
| Show All 10 Lines | foreach ($logs as $log) { | ||||
| $log->getRefName(), | $log->getRefName(), | ||||
| $old_ref_link, | $old_ref_link, | ||||
| phutil_tag( | phutil_tag( | ||||
| 'a', | 'a', | ||||
| array( | array( | ||||
| 'href' => $repository->getCommitURI($log->getRefNew()), | 'href' => $repository->getCommitURI($log->getRefNew()), | ||||
| ), | ), | ||||
| $log->getRefNewShort()), | $log->getRefNewShort()), | ||||
| $flag_names, | |||||
| // TODO: Make these human-readable. | $reject_label, | ||||
| $log->getChangeFlags(), | |||||
| $log->getPushEvent()->getRejectCode(), | |||||
| $viewer->formatShortDateTime($log->getEpoch()), | $viewer->formatShortDateTime($log->getEpoch()), | ||||
| ); | ); | ||||
| } | } | ||||
| $table = id(new AphrontTableView($rows)) | $table = id(new AphrontTableView($rows)) | ||||
| ->setHeaders( | ->setHeaders( | ||||
| array( | array( | ||||
| pht('Push'), | pht('Push'), | ||||
| pht('Repository'), | pht('Repository'), | ||||
| pht('Pusher'), | pht('Pusher'), | ||||
| pht('From'), | pht('From'), | ||||
| pht('Via'), | pht('Via'), | ||||
| pht('Host'), | pht('Host'), | ||||
| pht('Type'), | pht('Type'), | ||||
| pht('Name'), | pht('Name'), | ||||
| pht('Old'), | pht('Old'), | ||||
| pht('New'), | pht('New'), | ||||
| pht('Flags'), | pht('Flags'), | ||||
| pht('Code'), | pht('Result'), | ||||
| pht('Date'), | pht('Date'), | ||||
| )) | )) | ||||
| ->setColumnClasses( | ->setColumnClasses( | ||||
| array( | array( | ||||
| '', | '', | ||||
| '', | '', | ||||
| '', | '', | ||||
| '', | '', | ||||
| '', | '', | ||||
| '', | '', | ||||
| '', | '', | ||||
| 'wide', | 'wide', | ||||
| 'n', | 'n', | ||||
| 'n', | 'n', | ||||
| '', | |||||
| '', | |||||
| 'right', | 'right', | ||||
| )) | )) | ||||
| ->setColumnVisibility( | ->setColumnVisibility( | ||||
| array( | array( | ||||
| true, | true, | ||||
| true, | true, | ||||
| true, | true, | ||||
| $remotes_visible, | $remotes_visible, | ||||
| true, | true, | ||||
| $any_host, | $any_host, | ||||
| )); | )); | ||||
| return $table; | return $table; | ||||
| } | } | ||||
| } | } | ||||