3 final class NuanceItemCommand
5 implements PhabricatorPolicyInterface
{
7 const STATUS_ISSUED
= 'issued';
8 const STATUS_EXECUTING
= 'executing';
9 const STATUS_DONE
= 'done';
10 const STATUS_FAILED
= 'failed';
13 protected $authorPHID;
17 protected $parameters = array();
19 public static function initializeNewCommand() {
21 ->setStatus(self
::STATUS_ISSUED
);
24 protected function getConfiguration() {
26 self
::CONFIG_SERIALIZATION
=> array(
27 'parameters' => self
::SERIALIZATION_JSON
,
29 self
::CONFIG_COLUMN_SCHEMA
=> array(
30 'command' => 'text64',
32 'queuePHID' => 'phid?',
34 self
::CONFIG_KEY_SCHEMA
=> array(
35 'key_pending' => array(
36 'columns' => array('itemPHID', 'status'),
39 ) + parent
::getConfiguration();
42 public static function getStatusMap() {
44 self
::STATUS_ISSUED
=> array(
45 'name' => pht('Issued'),
46 'icon' => 'fa-clock-o',
47 'color' => 'bluegrey',
49 self
::STATUS_EXECUTING
=> array(
50 'name' => pht('Executing'),
54 self
::STATUS_DONE
=> array(
55 'name' => pht('Done'),
59 self
::STATUS_FAILED
=> array(
60 'name' => pht('Failed'),
67 private function getStatusSpec() {
68 $map = self
::getStatusMap();
69 return idx($map, $this->getStatus(), array());
72 public function getStatusIcon() {
73 $spec = $this->getStatusSpec();
74 return idx($spec, 'icon', 'fa-question');
77 public function getStatusColor() {
78 $spec = $this->getStatusSpec();
79 return idx($spec, 'color', 'indigo');
82 public function getStatusName() {
83 $spec = $this->getStatusSpec();
84 return idx($spec, 'name', $this->getStatus());
88 /* -( PhabricatorPolicyInterface )----------------------------------------- */
91 public function getCapabilities() {
93 PhabricatorPolicyCapability
::CAN_VIEW
,
97 public function getPolicy($capability) {
98 return PhabricatorPolicies
::getMostOpenPolicy();
101 public function hasAutomaticCapability($capability, PhabricatorUser
$viewer) {