mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-15 01:01:09 +01:00
Show audit status with PHUIStatusListView instead of enormous xbox-sized table
Summary: Replace giant table with PHUIStatusListView. Also remove "MetaMTA Transcripts" (which doesn't work any more) and "Herald Transcripts" (which no one uses). Test Plan: {F51437} {F51438} Reviewers: chad, btrahan Reviewed By: chad CC: aran Differential Revision: https://secure.phabricator.com/D6562
This commit is contained in:
parent
dd132b632a
commit
3eae2592d8
3 changed files with 99 additions and 60 deletions
|
@ -3875,7 +3875,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'phui-status-list-view-css' =>
|
'phui-status-list-view-css' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/a91b3fbe/rsrc/css/phui/phui-status.css',
|
'uri' => '/res/edd24959/rsrc/css/phui/phui-status.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -52,6 +52,13 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
->setAnchorName('top')
|
->setAnchorName('top')
|
||||||
->setNavigationMarker(true);
|
->setNavigationMarker(true);
|
||||||
|
|
||||||
|
$audit_requests = id(new PhabricatorAuditQuery())
|
||||||
|
->withCommitPHIDs(array($commit->getPHID()))
|
||||||
|
->execute();
|
||||||
|
$this->auditAuthorityPHIDs =
|
||||||
|
PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($user);
|
||||||
|
|
||||||
|
|
||||||
$is_foreign = $commit_data->getCommitDetail('foreign-svn-stub');
|
$is_foreign = $commit_data->getCommitDetail('foreign-svn-stub');
|
||||||
$changesets = null;
|
$changesets = null;
|
||||||
if ($is_foreign) {
|
if ($is_foreign) {
|
||||||
|
@ -86,7 +93,8 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
$commit_properties = $this->loadCommitProperties(
|
$commit_properties = $this->loadCommitProperties(
|
||||||
$commit,
|
$commit,
|
||||||
$commit_data,
|
$commit_data,
|
||||||
$parents);
|
$parents,
|
||||||
|
$audit_requests);
|
||||||
$property_list = id(new PhabricatorPropertyListView())
|
$property_list = id(new PhabricatorPropertyListView())
|
||||||
->setHasKeyboardShortcuts(true)
|
->setHasKeyboardShortcuts(true)
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
|
@ -116,14 +124,6 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
$content[] = $property_list;
|
$content[] = $property_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = new PhabricatorAuditQuery();
|
|
||||||
$query->withCommitPHIDs(array($commit->getPHID()));
|
|
||||||
$audit_requests = $query->execute();
|
|
||||||
|
|
||||||
$this->auditAuthorityPHIDs =
|
|
||||||
PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($user);
|
|
||||||
|
|
||||||
$content[] = $this->buildAuditTable($commit, $audit_requests);
|
|
||||||
$content[] = $this->buildComments($commit);
|
$content[] = $this->buildComments($commit);
|
||||||
|
|
||||||
$hard_limit = 1000;
|
$hard_limit = 1000;
|
||||||
|
@ -368,7 +368,8 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
private function loadCommitProperties(
|
private function loadCommitProperties(
|
||||||
PhabricatorRepositoryCommit $commit,
|
PhabricatorRepositoryCommit $commit,
|
||||||
PhabricatorRepositoryCommitData $data,
|
PhabricatorRepositoryCommitData $data,
|
||||||
array $parents) {
|
array $parents,
|
||||||
|
array $audit_requests) {
|
||||||
|
|
||||||
assert_instances_of($parents, 'PhabricatorRepositoryCommit');
|
assert_instances_of($parents, 'PhabricatorRepositoryCommit');
|
||||||
$user = $this->getRequest()->getUser();
|
$user = $this->getRequest()->getUser();
|
||||||
|
@ -418,10 +419,30 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
if ($commit->getAuditStatus()) {
|
if ($commit->getAuditStatus()) {
|
||||||
$status = PhabricatorAuditCommitStatusConstants::getStatusName(
|
$status = PhabricatorAuditCommitStatusConstants::getStatusName(
|
||||||
$commit->getAuditStatus());
|
$commit->getAuditStatus());
|
||||||
$props['Status'] = phutil_tag(
|
$tag = id(new PhabricatorTagView())
|
||||||
'strong',
|
->setType(PhabricatorTagView::TYPE_STATE)
|
||||||
array(),
|
->setName($status);
|
||||||
$status);
|
|
||||||
|
switch ($commit->getAuditStatus()) {
|
||||||
|
case PhabricatorAuditCommitStatusConstants::NEEDS_AUDIT:
|
||||||
|
$tag->setBackgroundColor(PhabricatorTagView::COLOR_ORANGE);
|
||||||
|
break;
|
||||||
|
case PhabricatorAuditCommitStatusConstants::CONCERN_RAISED:
|
||||||
|
$tag->setBackgroundColor(PhabricatorTagView::COLOR_RED);
|
||||||
|
break;
|
||||||
|
case PhabricatorAuditCommitStatusConstants::PARTIALLY_AUDITED:
|
||||||
|
$tag->setBackgroundColor(PhabricatorTagView::COLOR_BLUE);
|
||||||
|
break;
|
||||||
|
case PhabricatorAuditCommitStatusConstants::FULLY_AUDITED:
|
||||||
|
$tag->setBackgroundColor(PhabricatorTagView::COLOR_GREEN);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$props['Status'] = $tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($audit_requests) {
|
||||||
|
$props['Auditors'] = $this->renderAuditStatusView($audit_requests);
|
||||||
}
|
}
|
||||||
|
|
||||||
$props['Committed'] = phabricator_datetime($commit->getEpoch(), $user);
|
$props['Committed'] = phabricator_datetime($commit->getEpoch(), $user);
|
||||||
|
@ -510,33 +531,6 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
return $props;
|
return $props;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildAuditTable(
|
|
||||||
PhabricatorRepositoryCommit $commit,
|
|
||||||
array $audits) {
|
|
||||||
assert_instances_of($audits, 'PhabricatorRepositoryAuditRequest');
|
|
||||||
$user = $this->getRequest()->getUser();
|
|
||||||
|
|
||||||
$view = new PhabricatorAuditListView();
|
|
||||||
$view->setAudits($audits);
|
|
||||||
$view->setCommits(array($commit));
|
|
||||||
$view->setUser($user);
|
|
||||||
$view->setShowCommits(false);
|
|
||||||
|
|
||||||
$phids = $view->getRequiredHandlePHIDs();
|
|
||||||
$handles = $this->loadViewerHandles($phids);
|
|
||||||
$view->setHandles($handles);
|
|
||||||
$view->setAuthorityPHIDs($this->auditAuthorityPHIDs);
|
|
||||||
$this->highlightedAudits = $view->getHighlightedAudits();
|
|
||||||
|
|
||||||
$panel = new AphrontPanelView();
|
|
||||||
$panel->setHeader(pht('Audits'));
|
|
||||||
$panel->setCaption(pht('Audits you are responsible for are highlighted.'));
|
|
||||||
$panel->appendChild($view);
|
|
||||||
$panel->setNoBackground();
|
|
||||||
|
|
||||||
return $panel;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function buildComments(PhabricatorRepositoryCommit $commit) {
|
private function buildComments(PhabricatorRepositoryCommit $commit) {
|
||||||
$user = $this->getRequest()->getUser();
|
$user = $this->getRequest()->getUser();
|
||||||
$comments = id(new PhabricatorAuditComment())->loadAllWhere(
|
$comments = id(new PhabricatorAuditComment())->loadAllWhere(
|
||||||
|
@ -886,21 +880,6 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
$actions->addAction($action);
|
$actions->addAction($action);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user->getIsAdmin()) {
|
|
||||||
$action = id(new PhabricatorActionView())
|
|
||||||
->setName(pht('MetaMTA Transcripts'))
|
|
||||||
->setIcon('file')
|
|
||||||
->setHref('/mail/?phid='.$commit->getPHID());
|
|
||||||
$actions->addAction($action);
|
|
||||||
}
|
|
||||||
|
|
||||||
$action = id(new PhabricatorActionView())
|
|
||||||
->setName(pht('Herald Transcripts'))
|
|
||||||
->setIcon('file')
|
|
||||||
->setHref('/herald/transcript/?phid='.$commit->getPHID())
|
|
||||||
->setWorkflow(true);
|
|
||||||
$actions->addAction($action);
|
|
||||||
|
|
||||||
$action = id(new PhabricatorActionView())
|
$action = id(new PhabricatorActionView())
|
||||||
->setName(pht('Download Raw Diff'))
|
->setName(pht('Download Raw Diff'))
|
||||||
->setHref($request->getRequestURI()->alter('diff', true))
|
->setHref($request->getRequestURI()->alter('diff', true))
|
||||||
|
@ -947,4 +926,63 @@ final class DiffusionCommitController extends DiffusionController {
|
||||||
return id(new AphrontRedirectResponse())->setURI($file->getBestURI());
|
return id(new AphrontRedirectResponse())->setURI($file->getBestURI());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function renderAuditStatusView(array $audit_requests) {
|
||||||
|
assert_instances_of($audit_requests, 'PhabricatorRepositoryAuditRequest');
|
||||||
|
|
||||||
|
$phids = mpull($audit_requests, 'getAuditorPHID');
|
||||||
|
$this->loadHandles($phids);
|
||||||
|
|
||||||
|
$authority_map = array_fill_keys($this->auditAuthorityPHIDs, true);
|
||||||
|
|
||||||
|
$view = new PHUIStatusListView();
|
||||||
|
foreach ($audit_requests as $request) {
|
||||||
|
$item = new PHUIStatusItemView();
|
||||||
|
|
||||||
|
switch ($request->getAuditStatus()) {
|
||||||
|
case PhabricatorAuditStatusConstants::AUDIT_NOT_REQUIRED:
|
||||||
|
$item->setIcon('open-blue', pht('Commented'));
|
||||||
|
break;
|
||||||
|
case PhabricatorAuditStatusConstants::AUDIT_REQUIRED:
|
||||||
|
$item->setIcon('warning-blue', pht('Audit Required'));
|
||||||
|
break;
|
||||||
|
case PhabricatorAuditStatusConstants::CONCERNED:
|
||||||
|
$item->setIcon('reject-red', pht('Concern Raised'));
|
||||||
|
break;
|
||||||
|
case PhabricatorAuditStatusConstants::ACCEPTED:
|
||||||
|
$item->setIcon('accept-green', pht('Accepted'));
|
||||||
|
break;
|
||||||
|
case PhabricatorAuditStatusConstants::AUDIT_REQUESTED:
|
||||||
|
$item->setIcon('warning-dark', pht('Audit Requested'));
|
||||||
|
break;
|
||||||
|
case PhabricatorAuditStatusConstants::RESIGNED:
|
||||||
|
$item->setIcon('open-dark', pht('Accepted'));
|
||||||
|
break;
|
||||||
|
case PhabricatorAuditStatusConstants::CLOSED:
|
||||||
|
$item->setIcon('accept-blue', pht('Accepted'));
|
||||||
|
break;
|
||||||
|
case PhabricatorAuditStatusConstants::CC:
|
||||||
|
$item->setIcon('info-dark', pht('Subscribed'));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$note = array();
|
||||||
|
foreach ($request->getAuditReasons() as $reason) {
|
||||||
|
$note[] = phutil_tag('div', array(), $reason);
|
||||||
|
}
|
||||||
|
$item->setNote($note);
|
||||||
|
|
||||||
|
$auditor_phid = $request->getAuditorPHID();
|
||||||
|
$target = $this->getHandle($auditor_phid)->renderLink();
|
||||||
|
$item->setTarget($target);
|
||||||
|
|
||||||
|
if (isset($authority_map[$auditor_phid])) {
|
||||||
|
$item->setHighlighted(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$view->addItem($item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $view;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,19 +10,20 @@
|
||||||
display: block;
|
display: block;
|
||||||
width: 14px;
|
width: 14px;
|
||||||
height: 14px;
|
height: 14px;
|
||||||
margin: 4px 4px;
|
margin: 3px 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.phui-status-item-target {
|
.phui-status-item-target {
|
||||||
padding: 0 12px 0 4px;
|
padding: 0 12px 0 4px;
|
||||||
line-height: 22px;
|
line-height: 20px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.phui-status-item-note {
|
.phui-status-item-note {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
color: #666666;
|
color: #666666;
|
||||||
line-height: 22px;
|
line-height: 14px;
|
||||||
|
padding: 3px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.phui-status-item-highlighted {
|
.phui-status-item-highlighted {
|
||||||
|
|
Loading…
Reference in a new issue