@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at upstream/main 105 lines 2.5 kB view raw
1<?php 2 3final class NuanceItemCommand 4 extends NuanceDAO 5 implements PhabricatorPolicyInterface { 6 7 const STATUS_ISSUED = 'issued'; 8 const STATUS_EXECUTING = 'executing'; 9 const STATUS_DONE = 'done'; 10 const STATUS_FAILED = 'failed'; 11 12 protected $itemPHID; 13 protected $authorPHID; 14 protected $queuePHID; 15 protected $command; 16 protected $status; 17 protected $parameters = array(); 18 19 public static function initializeNewCommand() { 20 return id(new self()) 21 ->setStatus(self::STATUS_ISSUED); 22 } 23 24 protected function getConfiguration() { 25 return array( 26 self::CONFIG_SERIALIZATION => array( 27 'parameters' => self::SERIALIZATION_JSON, 28 ), 29 self::CONFIG_COLUMN_SCHEMA => array( 30 'command' => 'text64', 31 'status' => 'text64', 32 'queuePHID' => 'phid?', 33 ), 34 self::CONFIG_KEY_SCHEMA => array( 35 'key_pending' => array( 36 'columns' => array('itemPHID', 'status'), 37 ), 38 ), 39 ) + parent::getConfiguration(); 40 } 41 42 public static function getStatusMap() { 43 return array( 44 self::STATUS_ISSUED => array( 45 'name' => pht('Issued'), 46 'icon' => 'fa-clock-o', 47 'color' => 'bluegrey', 48 ), 49 self::STATUS_EXECUTING => array( 50 'name' => pht('Executing'), 51 'icon' => 'fa-play', 52 'color' => 'green', 53 ), 54 self::STATUS_DONE => array( 55 'name' => pht('Done'), 56 'icon' => 'fa-check', 57 'color' => 'blue', 58 ), 59 self::STATUS_FAILED => array( 60 'name' => pht('Failed'), 61 'icon' => 'fa-times', 62 'color' => 'red', 63 ), 64 ); 65 } 66 67 private function getStatusSpec() { 68 $map = self::getStatusMap(); 69 return idx($map, $this->getStatus(), array()); 70 } 71 72 public function getStatusIcon() { 73 $spec = $this->getStatusSpec(); 74 return idx($spec, 'icon', 'fa-question'); 75 } 76 77 public function getStatusColor() { 78 $spec = $this->getStatusSpec(); 79 return idx($spec, 'color', 'indigo'); 80 } 81 82 public function getStatusName() { 83 $spec = $this->getStatusSpec(); 84 return idx($spec, 'name', $this->getStatus()); 85 } 86 87 88/* -( PhabricatorPolicyInterface )----------------------------------------- */ 89 90 91 public function getCapabilities() { 92 return array( 93 PhabricatorPolicyCapability::CAN_VIEW, 94 ); 95 } 96 97 public function getPolicy($capability) { 98 return PhabricatorPolicies::getMostOpenPolicy(); 99 } 100 101 public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { 102 return false; 103 } 104 105}