Differential D17192 Diff 41342 src/applications/owners/controller/PhabricatorOwnersDetailController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/owners/controller/PhabricatorOwnersDetailController.php
Show First 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | public function handleRequest(AphrontRequest $request) { | ||||
$commit_views = array(); | $commit_views = array(); | ||||
$commit_uri = id(new PhutilURI('/diffusion/commit/')) | $commit_uri = id(new PhutilURI('/diffusion/commit/')) | ||||
->setQueryParams( | ->setQueryParams( | ||||
array( | array( | ||||
'auditorPHIDs' => $package->getPHID(), | 'auditorPHIDs' => $package->getPHID(), | ||||
)); | )); | ||||
$status_concern = DiffusionCommitQuery::AUDIT_STATUS_CONCERN; | $status_concern = PhabricatorAuditCommitStatusConstants::CONCERN_RAISED; | ||||
$attention_commits = id(new DiffusionCommitQuery()) | $attention_commits = id(new DiffusionCommitQuery()) | ||||
->setViewer($request->getUser()) | ->setViewer($request->getUser()) | ||||
->withAuditorPHIDs(array($package->getPHID())) | ->withAuditorPHIDs(array($package->getPHID())) | ||||
->withAuditStatus($status_concern) | ->withStatuses( | ||||
array( | |||||
$status_concern, | |||||
)) | |||||
->needCommitData(true) | ->needCommitData(true) | ||||
->needAuditRequests(true) | |||||
->setLimit(10) | ->setLimit(10) | ||||
->execute(); | ->execute(); | ||||
$view = id(new PhabricatorAuditListView()) | $view = id(new PhabricatorAuditListView()) | ||||
->setUser($viewer) | ->setUser($viewer) | ||||
->setNoDataString(pht('This package has no open problem commits.')) | ->setNoDataString(pht('This package has no open problem commits.')) | ||||
->setCommits($attention_commits); | ->setCommits($attention_commits); | ||||
$commit_views[] = array( | $commit_views[] = array( | ||||
'view' => $view, | 'view' => $view, | ||||
'header' => pht('Needs Attention'), | 'header' => pht('Needs Attention'), | ||||
'icon' => 'fa-warning', | 'icon' => 'fa-warning', | ||||
'button' => id(new PHUIButtonView()) | 'button' => id(new PHUIButtonView()) | ||||
->setTag('a') | ->setTag('a') | ||||
->setHref($commit_uri->alter('status', $status_concern)) | ->setHref($commit_uri->alter('status', $status_concern)) | ||||
->setIcon('fa-list-ul') | ->setIcon('fa-list-ul') | ||||
->setText(pht('View All')), | ->setText(pht('View All')), | ||||
); | ); | ||||
$all_commits = id(new DiffusionCommitQuery()) | $all_commits = id(new DiffusionCommitQuery()) | ||||
->setViewer($request->getUser()) | ->setViewer($request->getUser()) | ||||
->withAuditorPHIDs(array($package->getPHID())) | ->withAuditorPHIDs(array($package->getPHID())) | ||||
->needCommitData(true) | ->needCommitData(true) | ||||
->setLimit(100) | ->needAuditRequests(true) | ||||
->setLimit(25) | |||||
->execute(); | ->execute(); | ||||
$view = id(new PhabricatorAuditListView()) | $view = id(new PhabricatorAuditListView()) | ||||
->setUser($viewer) | ->setUser($viewer) | ||||
->setCommits($all_commits) | ->setCommits($all_commits) | ||||
->setNoDataString(pht('No commits in this package.')); | ->setNoDataString(pht('No commits in this package.')); | ||||
$commit_views[] = array( | $commit_views[] = array( | ||||
'view' => $view, | 'view' => $view, | ||||
'header' => pht('Recent Commits'), | 'header' => pht('Recent Commits'), | ||||
'icon' => 'fa-code', | 'icon' => 'fa-code', | ||||
'button' => id(new PHUIButtonView()) | 'button' => id(new PHUIButtonView()) | ||||
->setTag('a') | ->setTag('a') | ||||
->setHref($commit_uri) | ->setHref($commit_uri) | ||||
->setIcon('fa-list-ul') | ->setIcon('fa-list-ul') | ||||
->setText(pht('View All')), | ->setText(pht('View All')), | ||||
); | ); | ||||
$phids = array(); | |||||
foreach ($commit_views as $commit_view) { | |||||
$phids[] = $commit_view['view']->getRequiredHandlePHIDs(); | |||||
} | |||||
$phids = array_mergev($phids); | |||||
$handles = $this->loadViewerHandles($phids); | |||||
$commit_panels = array(); | $commit_panels = array(); | ||||
foreach ($commit_views as $commit_view) { | foreach ($commit_views as $commit_view) { | ||||
$commit_panel = id(new PHUIObjectBoxView()) | $commit_panel = id(new PHUIObjectBoxView()) | ||||
->setBackground(PHUIObjectBoxView::BLUE_PROPERTY); | ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY); | ||||
$commit_header = id(new PHUIHeaderView()) | $commit_header = id(new PHUIHeaderView()) | ||||
->setHeader($commit_view['header']) | ->setHeader($commit_view['header']) | ||||
->setHeaderIcon($commit_view['icon']); | ->setHeaderIcon($commit_view['icon']); | ||||
if (isset($commit_view['button'])) { | if (isset($commit_view['button'])) { | ||||
$commit_header->addActionLink($commit_view['button']); | $commit_header->addActionLink($commit_view['button']); | ||||
} | } | ||||
$commit_view['view']->setHandles($handles); | |||||
$commit_panel->setHeader($commit_header); | $commit_panel->setHeader($commit_header); | ||||
$commit_panel->appendChild($commit_view['view']); | $commit_panel->appendChild($commit_view['view']); | ||||
$commit_panels[] = $commit_panel; | $commit_panels[] = $commit_panel; | ||||
} | } | ||||
$crumbs = $this->buildApplicationCrumbs(); | $crumbs = $this->buildApplicationCrumbs(); | ||||
$crumbs->addTextCrumb($package->getMonogram()); | $crumbs->addTextCrumb($package->getMonogram()); | ||||
▲ Show 20 Lines • Show All 198 Lines • Show Last 20 Lines |