1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-01 09:28:22 +01:00
phorge-phorge/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php
epriestley a635da68d4 Provide bucketing for commits in Audit
Summary:
Fixes T9430. Fixes T9362. Fixes T9544. This changes the default view of Audit to work like Differential, where commits you need to audit or respond to are shown in buckets.

This is a bit messy and probably needs some followups. This stuff has changed from a compatibility viewpoint:

  - The query works differently now (but in a better, modern way), so existing saved queries will need to be updated.
  - I've removed the counters from the home page instead of updating them, since they're going to get wiped out by ProfileMenu soon anyway.
  - When bucketed queries return too many results (more than 1,000) we now show a warning about it. This isn't greaaaat but it seems good enough for now.

Test Plan: {F2351123}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9430, T9362, T9544

Differential Revision: https://secure.phabricator.com/D17192
2017-01-12 12:04:05 -08:00

75 lines
1.7 KiB
PHP

<?php
final class PhabricatorAuditCommitStatusConstants extends Phobject {
const NONE = 0;
const NEEDS_AUDIT = 1;
const CONCERN_RAISED = 2;
const PARTIALLY_AUDITED = 3;
const FULLY_AUDITED = 4;
public static function getStatusNameMap() {
$map = array(
self::NONE => pht('None'),
self::NEEDS_AUDIT => pht('Audit Required'),
self::CONCERN_RAISED => pht('Concern Raised'),
self::PARTIALLY_AUDITED => pht('Partially Audited'),
self::FULLY_AUDITED => pht('Audited'),
);
return $map;
}
public static function getStatusName($code) {
return idx(self::getStatusNameMap(), $code, pht('Unknown'));
}
public static function getOpenStatusConstants() {
return array(
self::CONCERN_RAISED,
self::NEEDS_AUDIT,
self::PARTIALLY_AUDITED,
);
}
public static function getStatusColor($code) {
switch ($code) {
case self::CONCERN_RAISED:
$color = 'red';
break;
case self::NEEDS_AUDIT:
$color = 'orange';
break;
case self::PARTIALLY_AUDITED:
$color = 'yellow';
break;
case self::FULLY_AUDITED:
$color = 'green';
break;
default:
$color = null;
break;
}
return $color;
}
public static function getStatusIcon($code) {
switch ($code) {
case self::CONCERN_RAISED:
$icon = 'fa-exclamation-circle';
break;
case self::NEEDS_AUDIT:
case self::PARTIALLY_AUDITED:
$icon = 'fa-exclamation-circle';
break;
case self::FULLY_AUDITED:
$icon = 'fa-check';
break;
default:
$icon = null;
break;
}
return $icon;
}
}