@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.

Give "Burndown" charts a more straightforward definition and move all the event stuff into "Activity" charts

Summary:
Depends on D20818. Ref T13279. The behavior of the "burndown" chart has wandered fairly far afield; make it look more like a burndown.

Move the other thing into an "Activity" chart.

Test Plan: {F6865207}

Maniphest Tasks: T13279

Differential Revision: https://secure.phabricator.com/D20819

+202 -112
+2
src/__phutil_library_map__.php
··· 4224 4224 'PhabricatorProfileMenuItemView' => 'applications/search/engine/PhabricatorProfileMenuItemView.php', 4225 4225 'PhabricatorProfileMenuItemViewList' => 'applications/search/engine/PhabricatorProfileMenuItemViewList.php', 4226 4226 'PhabricatorProject' => 'applications/project/storage/PhabricatorProject.php', 4227 + 'PhabricatorProjectActivityChartEngine' => 'applications/project/chart/PhabricatorProjectActivityChartEngine.php', 4227 4228 'PhabricatorProjectAddHeraldAction' => 'applications/project/herald/PhabricatorProjectAddHeraldAction.php', 4228 4229 'PhabricatorProjectApplication' => 'applications/project/application/PhabricatorProjectApplication.php', 4229 4230 'PhabricatorProjectArchiveController' => 'applications/project/controller/PhabricatorProjectArchiveController.php', ··· 10733 10734 'PhabricatorSpacesInterface', 10734 10735 'PhabricatorEditEngineSubtypeInterface', 10735 10736 ), 10737 + 'PhabricatorProjectActivityChartEngine' => 'PhabricatorChartEngine', 10736 10738 'PhabricatorProjectAddHeraldAction' => 'PhabricatorProjectHeraldAction', 10737 10739 'PhabricatorProjectApplication' => 'PhabricatorApplication', 10738 10740 'PhabricatorProjectArchiveController' => 'PhabricatorProjectController',
+135
src/applications/project/chart/PhabricatorProjectActivityChartEngine.php
··· 1 + <?php 2 + 3 + final class PhabricatorProjectActivityChartEngine 4 + extends PhabricatorChartEngine { 5 + 6 + const CHARTENGINEKEY = 'project.activity'; 7 + 8 + public function setProjects(array $projects) { 9 + assert_instances_of($projects, 'PhabricatorProject'); 10 + $project_phids = mpull($projects, 'getPHID'); 11 + return $this->setEngineParameter('projectPHIDs', $project_phids); 12 + } 13 + 14 + protected function newChart(PhabricatorFactChart $chart, array $map) { 15 + $viewer = $this->getViewer(); 16 + 17 + $map = $map + array( 18 + 'projectPHIDs' => array(), 19 + ); 20 + 21 + if ($map['projectPHIDs']) { 22 + $projects = id(new PhabricatorProjectQuery()) 23 + ->setViewer($viewer) 24 + ->withPHIDs($map['projectPHIDs']) 25 + ->execute(); 26 + $project_phids = mpull($projects, 'getPHID'); 27 + } else { 28 + $project_phids = array(); 29 + } 30 + 31 + $project_phid = head($project_phids); 32 + 33 + $functions = array(); 34 + $stacks = array(); 35 + 36 + $function = $this->newFunction( 37 + array( 38 + 'accumulate', 39 + array( 40 + 'compose', 41 + array('fact', 'tasks.open-count.assign.project', $project_phid), 42 + array('min', 0), 43 + ), 44 + )); 45 + 46 + $function->getFunctionLabel() 47 + ->setKey('moved-in') 48 + ->setName(pht('Tasks Moved Into Project')) 49 + ->setColor('rgba(128, 128, 200, 1)') 50 + ->setFillColor('rgba(128, 128, 200, 0.15)'); 51 + 52 + $functions[] = $function; 53 + 54 + $function = $this->newFunction( 55 + array( 56 + 'accumulate', 57 + array( 58 + 'compose', 59 + array('fact', 'tasks.open-count.status.project', $project_phid), 60 + array('min', 0), 61 + ), 62 + )); 63 + 64 + $function->getFunctionLabel() 65 + ->setKey('reopened') 66 + ->setName(pht('Tasks Reopened')) 67 + ->setColor('rgba(128, 128, 200, 1)') 68 + ->setFillColor('rgba(128, 128, 200, 0.15)'); 69 + 70 + $functions[] = $function; 71 + 72 + $function = $this->newFunction( 73 + array( 74 + 'accumulate', 75 + array('fact', 'tasks.open-count.create.project', $project_phid), 76 + )); 77 + 78 + $function->getFunctionLabel() 79 + ->setKey('created') 80 + ->setName(pht('Tasks Created')) 81 + ->setColor('rgba(0, 0, 200, 1)') 82 + ->setFillColor('rgba(0, 0, 200, 0.15)'); 83 + 84 + $functions[] = $function; 85 + 86 + $function = $this->newFunction( 87 + array( 88 + 'accumulate', 89 + array( 90 + 'compose', 91 + array('fact', 'tasks.open-count.status.project', $project_phid), 92 + array('max', 0), 93 + ), 94 + )); 95 + 96 + $function->getFunctionLabel() 97 + ->setKey('closed') 98 + ->setName(pht('Tasks Closed')) 99 + ->setColor('rgba(0, 200, 0, 1)') 100 + ->setFillColor('rgba(0, 200, 0, 0.15)'); 101 + 102 + $functions[] = $function; 103 + 104 + $function = $this->newFunction( 105 + array( 106 + 'accumulate', 107 + array( 108 + 'compose', 109 + array('fact', 'tasks.open-count.assign.project', $project_phid), 110 + array('max', 0), 111 + ), 112 + )); 113 + 114 + $function->getFunctionLabel() 115 + ->setKey('moved-out') 116 + ->setName(pht('Tasks Moved Out of Project')) 117 + ->setColor('rgba(128, 200, 128, 1)') 118 + ->setFillColor('rgba(128, 200, 128, 0.15)'); 119 + 120 + $functions[] = $function; 121 + 122 + $stacks[] = array('created', 'reopened', 'moved-in'); 123 + $stacks[] = array('closed', 'moved-out'); 124 + 125 + $datasets = array(); 126 + 127 + $dataset = id(new PhabricatorChartStackedAreaDataset()) 128 + ->setFunctions($functions) 129 + ->setStacks($stacks); 130 + 131 + $datasets[] = $dataset; 132 + $chart->attachDatasets($datasets); 133 + } 134 + 135 + }
+51 -112
src/applications/project/chart/PhabricatorProjectBurndownChartEngine.php
··· 29 29 } 30 30 31 31 $functions = array(); 32 - $stacks = array(); 33 - 34 32 if ($project_phids) { 35 - foreach ($project_phids as $project_phid) { 36 - $function = $this->newFunction( 37 - array( 38 - 'accumulate', 39 - array( 40 - 'compose', 41 - array('fact', 'tasks.open-count.assign.project', $project_phid), 42 - array('min', 0), 43 - ), 44 - )); 45 - 46 - $function->getFunctionLabel() 47 - ->setKey('moved-in') 48 - ->setName(pht('Tasks Moved Into Project')) 49 - ->setColor('rgba(128, 128, 200, 1)') 50 - ->setFillColor('rgba(128, 128, 200, 0.15)'); 51 - 52 - $functions[] = $function; 53 - 54 - $function = $this->newFunction( 55 - array( 56 - 'accumulate', 57 - array( 58 - 'compose', 59 - array('fact', 'tasks.open-count.status.project', $project_phid), 60 - array('min', 0), 61 - ), 62 - )); 63 - 64 - $function->getFunctionLabel() 65 - ->setKey('reopened') 66 - ->setName(pht('Tasks Reopened')) 67 - ->setColor('rgba(128, 128, 200, 1)') 68 - ->setFillColor('rgba(128, 128, 200, 0.15)'); 69 - 70 - $functions[] = $function; 71 - 72 - $function = $this->newFunction( 73 - array( 74 - 'accumulate', 75 - array('fact', 'tasks.open-count.create.project', $project_phid), 76 - )); 77 - 78 - $function->getFunctionLabel() 79 - ->setKey('created') 80 - ->setName(pht('Tasks Created')) 81 - ->setColor('rgba(0, 0, 200, 1)') 82 - ->setFillColor('rgba(0, 0, 200, 0.15)'); 83 - 84 - $functions[] = $function; 85 - 86 - $function = $this->newFunction( 33 + $open_function = $this->newFunction( 34 + array( 35 + 'accumulate', 87 36 array( 88 - 'accumulate', 89 - array( 90 - 'compose', 91 - array('fact', 'tasks.open-count.status.project', $project_phid), 92 - array('max', 0), 93 - ), 94 - )); 37 + 'sum', 38 + $this->newFactSum( 39 + 'tasks.open-count.create.project', $project_phids), 40 + $this->newFactSum( 41 + 'tasks.open-count.status.project', $project_phids), 42 + $this->newFactSum( 43 + 'tasks.open-count.assign.project', $project_phids), 44 + ), 45 + )); 95 46 96 - $function->getFunctionLabel() 97 - ->setKey('closed') 98 - ->setName(pht('Tasks Closed')) 99 - ->setColor('rgba(0, 200, 0, 1)') 100 - ->setFillColor('rgba(0, 200, 0, 0.15)'); 101 - 102 - $functions[] = $function; 103 - 104 - $function = $this->newFunction( 105 - array( 106 - 'accumulate', 107 - array( 108 - 'compose', 109 - array('fact', 'tasks.open-count.assign.project', $project_phid), 110 - array('max', 0), 111 - ), 112 - )); 113 - 114 - $function->getFunctionLabel() 115 - ->setKey('moved-out') 116 - ->setName(pht('Tasks Moved Out of Project')) 117 - ->setColor('rgba(128, 200, 128, 1)') 118 - ->setFillColor('rgba(128, 200, 128, 0.15)'); 119 - 120 - $functions[] = $function; 121 - 122 - $stacks[] = array('created', 'reopened', 'moved-in'); 123 - $stacks[] = array('closed', 'moved-out'); 124 - } 47 + $closed_function = $this->newFunction( 48 + array( 49 + 'accumulate', 50 + $this->newFactSum('tasks.open-count.status.project', $project_phids), 51 + )); 125 52 } else { 126 - $function = $this->newFunction( 53 + $open_function = $this->newFunction( 127 54 array( 128 55 'accumulate', 129 56 array('fact', 'tasks.open-count.create'), 130 57 )); 131 58 132 - $function->getFunctionLabel() 133 - ->setKey('open') 134 - ->setName(pht('Open Tasks')) 135 - ->setColor('rgba(0, 0, 200, 1)') 136 - ->setFillColor('rgba(0, 0, 200, 0.15)'); 137 - 138 - $functions[] = $function; 139 - 140 - $function = $this->newFunction( 59 + $closed_function = $this->newFunction( 141 60 array( 142 61 'accumulate', 143 62 array('fact', 'tasks.open-count.status'), 144 63 )); 64 + } 145 65 146 - $function->getFunctionLabel() 147 - ->setKey('closed') 148 - ->setName(pht('Closed Tasks')) 149 - ->setColor('rgba(0, 200, 0, 1)') 150 - ->setFillColor('rgba(0, 200, 0, 0.15)'); 66 + $open_function->getFunctionLabel() 67 + ->setKey('open') 68 + ->setName(pht('Open Tasks')) 69 + ->setColor('rgba(0, 0, 200, 1)') 70 + ->setFillColor('rgba(0, 0, 200, 0.15)'); 151 71 152 - $functions[] = $function; 153 - } 72 + $closed_function->getFunctionLabel() 73 + ->setKey('closed') 74 + ->setName(pht('Closed Tasks')) 75 + ->setColor('rgba(0, 200, 0, 1)') 76 + ->setFillColor('rgba(0, 200, 0, 0.15)'); 154 77 155 78 $datasets = array(); 156 79 157 80 $dataset = id(new PhabricatorChartStackedAreaDataset()) 158 - ->setFunctions($functions); 159 - 160 - if ($stacks) { 161 - $dataset->setStacks($stacks); 162 - } 81 + ->setFunctions( 82 + array( 83 + $open_function, 84 + $closed_function, 85 + )) 86 + ->setStacks( 87 + array( 88 + array('open'), 89 + array('closed'), 90 + )); 163 91 164 92 $datasets[] = $dataset; 165 93 $chart->attachDatasets($datasets); 94 + } 95 + 96 + private function newFactSum($fact_key, array $phids) { 97 + $result = array(); 98 + $result[] = 'sum'; 99 + 100 + foreach ($phids as $phid) { 101 + $result[] = array('fact', $fact_key, $phid); 102 + } 103 + 104 + return $result; 166 105 } 167 106 168 107 }
+14
src/applications/project/controller/PhabricatorProjectReportsController.php
··· 44 44 ->setParentPanelPHIDs(array()) 45 45 ->renderPanel(); 46 46 47 + $activity_panel = id(new PhabricatorProjectActivityChartEngine()) 48 + ->setViewer($viewer) 49 + ->setProjects(array($project)) 50 + ->buildChartPanel(); 51 + 52 + $activity_panel->setName(pht('%s: Activity', $project->getName())); 53 + 54 + $activity_view = id(new PhabricatorDashboardPanelRenderingEngine()) 55 + ->setViewer($viewer) 56 + ->setPanel($activity_panel) 57 + ->setParentPanelPHIDs(array()) 58 + ->renderPanel(); 59 + 47 60 $view = id(new PHUITwoColumnView()) 48 61 ->setFooter( 49 62 array( 50 63 $chart_view, 64 + $activity_view, 51 65 )); 52 66 53 67 return $this->newPage()