Christopher Johnson (WMDE) has submitted this change and it was merged.

Change subject: changes SprintReportBurndownView
......................................................................


changes SprintReportBurndownView

adds new d3 chart (removes raphael)
adds new css class (to remove pink)

Change-Id: I0d72db12090624226a0ce8f4639bf04df27135c3
---
A rsrc/behavior-burndown-report-chart.js
A rsrc/sprint-report.css
M src/__phutil_library_map__.php
M src/celerity/map.php
M src/controller/SprintController.php
M src/controller/SprintDataViewController.php
M src/controller/SprintListController.php
M src/controller/SprintReportController.php
M src/tests/SprintControllerTest.php
R src/view/reports/SprintReportBurnUpView.php
10 files changed, 131 insertions(+), 64 deletions(-)

Approvals:
  Christopher Johnson (WMDE): Verified; Looks good to me, approved



diff --git a/rsrc/behavior-burndown-report-chart.js 
b/rsrc/behavior-burndown-report-chart.js
new file mode 100644
index 0000000..c1d9f75
--- /dev/null
+++ b/rsrc/behavior-burndown-report-chart.js
@@ -0,0 +1,29 @@
+/**
+ * @provides javelin-behavior-burndown-report-chart
+ */
+
+JX.behavior('burndown-report-chart', function(config) {
+
+    var h = JX.$(config.hardpoint);
+    var l = c3.generate({
+        bindto: h,
+        data: {
+            x: 'Dates',
+            columns: [
+                config.x,
+                config.y
+            ],
+            type: 'area'
+        },
+
+        axis: {
+            x: {
+                type: 'timeseries',
+                tick: {
+                    count: 40,
+                    format: '%Y-%m-%d'
+                }
+            }
+        }
+    });
+});
diff --git a/rsrc/sprint-report.css b/rsrc/sprint-report.css
new file mode 100644
index 0000000..fc2a883
--- /dev/null
+++ b/rsrc/sprint-report.css
@@ -0,0 +1,32 @@
+/**
+ * @provides sprint-report-css
+ */
+
+table.aphront-table-view tr.aggregate,
+table.aphront-table-view tr.alt-aggregate {
+    background: #8181F7;
+}
+
+table.aphront-table-view tr.month,
+table.aphront-table-view tr.alt-month {
+    background: #A9A9F5;
+}
+
+table.aphront-table-view tr.week,
+table.aphront-table-view tr.alt-week {
+    background: #CECEF6;
+}
+
+span.red {
+    color: #aa0000;
+    font-weight: bold;
+}
+
+span.green {
+    color: #00aa00;
+    font-weight: bold;
+}
+
+.aphront-panel-view-caption p {
+    padding: 6px 0 0;
+}
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
index bf899b7..a307181 100644
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -52,14 +52,13 @@
     'SprintListController' => 'controller/SprintListController.php',
     'SprintListDataProvider' => 'storage/SprintListDataProvider.php',
     'SprintListTableView' => 'view/SprintListTableView.php',
-    'SprintListView' => 'view/SprintListView.php',
     'SprintPoints' => 'util/SprintPoints.php',
     'SprintProjectCustomField' => 'customfield/SprintProjectCustomField.php',
     'SprintProjectProfileController' => 
'controller/SprintProjectProfileController.php',
     'SprintProjectViewController' => 
'controller/SprintProjectViewController.php',
     'SprintQuery' => 'query/SprintQuery.php',
     'SprintQueryTest' => 'tests/SprintQueryTest.php',
-    'SprintReportBurndownView' => 'view/reports/SprintReportBurndownView.php',
+    'SprintReportBurnUpView' => 'view/reports/SprintReportBurnUpView.php',
     'SprintReportController' => 'controller/SprintReportController.php',
     'SprintReportOpenTasksView' => 
'view/reports/SprintReportOpenTasksView.php',
     'SprintStats' => 'storage/SprintStats.php',
@@ -112,7 +111,7 @@
     'SprintProjectViewController' => 'SprintController',
     'SprintQuery' => 'SprintDAO',
     'SprintQueryTest' => 'SprintTestCase',
-    'SprintReportBurndownView' => 'SprintView',
+    'SprintReportBurnUpView' => 'SprintView',
     'SprintReportController' => 'SprintController',
     'SprintReportOpenTasksView' => 'SprintView',
     'SprintStatsTest' => 'SprintTestCase',
diff --git a/src/celerity/map.php b/src/celerity/map.php
index 0c6ecb4..2b7e27e 100644
--- a/src/celerity/map.php
+++ b/src/celerity/map.php
@@ -8,23 +8,28 @@
 return array(
   'names' => array(
     'behavior-board-data-pie.js' => 'a1302bf1',
+    'behavior-burndown-report-chart.js' => '5349bfe4',
     'behavior-c3-chart.js' => '4bd6b4ca',
     'behavior-c3-pie.js' => 'ae804fb1',
     'behavior-sprint-boards.js' => 'b2754b95',
     'c3.css' => '93642428',
     'c3.js' => '4b517cca',
     'd3.min.js' => '1595fbde',
+    'images/Screenshot-1.png' => '5e39aaad',
     'phui-workboard-view.css' => '24307748',
+    'sprint-report.css' => '69b7d592',
   ),
   'symbols' => array(
     'c3' => '4b517cca',
     'c3-css' => '93642428',
     'd3' => '1595fbde',
+    'javelin-behavior-burndown-report-chart' => '5349bfe4',
     'javelin-behavior-c3-board-data-pie' => 'a1302bf1',
     'javelin-behavior-c3-chart' => '4bd6b4ca',
     'javelin-behavior-c3-pie' => 'ae804fb1',
     'javelin-behavior-sprint-boards' => 'b2754b95',
     'phui-workboard-view-css' => '24307748',
+    'sprint-report-css' => '69b7d592',
   ),
   'requires' => array(
     '4b517cca' => array(
diff --git a/src/controller/SprintController.php 
b/src/controller/SprintController.php
index 9cc1592..f7d5af0 100644
--- a/src/controller/SprintController.php
+++ b/src/controller/SprintController.php
@@ -35,8 +35,8 @@
         ->addLabel(pht('Open Tasks'))
         ->addFilter('project', pht('By Project'))
         ->addFilter('user', pht('By User'))
-        ->addLabel(pht('Burndown'))
-        ->addFilter('burn', pht('Burndown Rate'));
+        ->addLabel(pht('Burn Up'))
+        ->addFilter('burn', pht('Burn Up Rate'));
     return $nav;
   }
 
@@ -78,15 +78,14 @@
 
     return $crumbs;
   }
+
   protected function buildCrumbs($sprite, $uri) {
     $crumbs = array();
-
 
       $crumbs[] = id(new PHUICrumbView())
           ->setHref($uri)
           ->setAural($sprite)
           ->setIcon($sprite);
-
 
     $view = new PHUICrumbsView();
     foreach ($crumbs as $crumb) {
diff --git a/src/controller/SprintDataViewController.php 
b/src/controller/SprintDataViewController.php
index 2f38757..a27db1c 100644
--- a/src/controller/SprintDataViewController.php
+++ b/src/controller/SprintDataViewController.php
@@ -7,12 +7,8 @@
   private $viewer;
   private $project;
 
-  public function willProcessRequest(array $data) {
-    $this->projectID = $data['id'];
-  }
-
-  public function processRequest() {
-
+  public function handleRequest(AphrontRequest $request) {
+    $this->projectID = $request->getURIData('id');
     $this->request = $this->getRequest();
     $this->viewer = $this->request->getUser();
     $this->project = $this->loadProject();
diff --git a/src/controller/SprintListController.php 
b/src/controller/SprintListController.php
index ac3d23b..98f0698 100644
--- a/src/controller/SprintListController.php
+++ b/src/controller/SprintListController.php
@@ -3,18 +3,15 @@
 final class SprintListController extends SprintController {
 
   private $view;
-  private $request;
   private $viewer;
 
-  public function processRequest() {
-    $this->request = $this->getRequest();
-    $this->viewer = $this->request->getUser();
+  public function handleRequest(AphrontRequest $request) {
+    $this->viewer = $request->getUser();
 
     $error_box = null;
-    $sprintlist_model = null;
     $sprintlist_model = id(new SprintListDataProvider())
         ->setViewer($this->viewer)
-        ->setRequest($this->request)
+        ->setRequest($request)
         ->execute();
 
     try {
diff --git a/src/controller/SprintReportController.php 
b/src/controller/SprintReportController.php
index 73b666f..ce29eae 100644
--- a/src/controller/SprintReportController.php
+++ b/src/controller/SprintReportController.php
@@ -8,8 +8,7 @@
     $this->view = idx($data, 'view');
   }
 
-  public function processRequest() {
-    $request = $this->getRequest();
+  public function handleRequest(AphrontRequest $request) {
     $user = $request->getUser();
 
     if ($request->isFormPost()) {
@@ -27,7 +26,7 @@
 
     $nav = $this->buildNavMenu();
     $this->view = $nav->selectFilter($this->view, 'List');
-    require_celerity_resource('maniphest-report-css');
+    require_celerity_resource('sprint-report-css', 'sprint');
 
     switch ($this->view) {
       case 'list':
@@ -39,7 +38,7 @@
           ->setView($this->view);
         break;
       case 'burn':
-        $core = id(new SprintReportBurndownView())
+        $core = id(new SprintReportBurnUpView())
             ->setUser($user)
             ->setRequest($request);
         break;
@@ -62,4 +61,3 @@
         ));
   }
 }
-
diff --git a/src/tests/SprintControllerTest.php 
b/src/tests/SprintControllerTest.php
index dcc918c..8d8fbb8 100644
--- a/src/tests/SprintControllerTest.php
+++ b/src/tests/SprintControllerTest.php
@@ -1,7 +1,7 @@
 <?php
 final class SprintControllerTest extends SprintTestCase {
 
-  public function testshouldAllowPublic()  {
+  public function testshouldAllowPublic() {
     $stub = $this->getMockForAbstractClass('SprintController');
 
     $this->assertTrue($stub->shouldAllowPublic());
@@ -24,6 +24,20 @@
     $this->assertInstanceOf('SprintDataView', $burndownview);
   }
 
+  public function testgetSprintDataViewRender() {
+    $projectobj = new PhabricatorProject();
+    $viewer = $this->generateNewTestUser();
+    $request = new AphrontRequest('phab.wmde.de', '/project/sprint/view/18');
+    $objectboxes = id(new SprintDataViewController())
+        ->setRequest($request)
+        ->setProject($projectobj)
+        ->setViewer($viewer)
+        ->render();
+    foreach ($objectboxes as $objectbox) {
+      $this->assertInstanceOf('PHUIObjectBox', $objectbox);
+    };
+  }
+
   public function testgetErrorBox() {
     $e = new Exception();
     $dv = new SprintDataViewController();
diff --git a/src/view/reports/SprintReportBurndownView.php 
b/src/view/reports/SprintReportBurnUpView.php
similarity index 86%
rename from src/view/reports/SprintReportBurndownView.php
rename to src/view/reports/SprintReportBurnUpView.php
index 24e929b..7892f2d 100644
--- a/src/view/reports/SprintReportBurndownView.php
+++ b/src/view/reports/SprintReportBurnUpView.php
@@ -1,6 +1,6 @@
 <?php
 
-final class SprintReportBurndownView extends SprintView {
+final class SprintReportBurnUpView extends SprintView {
 
   private $request;
 
@@ -260,9 +260,9 @@
 
   if ($handle) {
     list ($caption, $header) = $this->renderCaption ($handle);
-    $caption = id(new AphrontErrorView())
+    $caption = id(new PHUIErrorView())
         ->appendChild($caption)
-        ->setSeverity(AphrontErrorView::SEVERITY_NOTICE);
+        ->setSeverity(PHUIErrorView::SEVERITY_NOTICE);
   } else {
     $header = pht('Task Burn Rate for All Tasks');
     $caption = null;
@@ -305,55 +305,53 @@
   private function buildBurnDownChart() {
     $project_phid = $this->request->getStr('project');
     $data = $this->getXactionData($project_phid);
-      $id = celerity_generate_unique_node_id();
-      $chart = phutil_tag(
-          'div',
-          array(
-              'id' => $id,
-              'style' => 'border: 1px solid #BFCFDA; '.
-                  'background-color: #fff; '.
-                  'margin: 8px 16px; '.
-                  'height: 400px; ',
-          ),
-          '');
+      $id = 'burnup chart';
+      $data = $this->buildSeries($data);
+      $stats = new SprintStats();
+      $data = $stats->transposeArray($data);
+    require_celerity_resource('d3', 'sprint');
+    require_celerity_resource('c3-css', 'sprint');
+    require_celerity_resource('c3', 'sprint');
 
-      list($burn_x, $burn_y) = $this->buildSeries($data);
-
-      require_celerity_resource('raphael-core');
-      require_celerity_resource('raphael-g');
-      require_celerity_resource('raphael-g-line');
-
-      Javelin::initBehavior('line-chart', array(
+      Javelin::initBehavior('burndown-report-chart', array(
           'hardpoint' => $id,
-          'x' => array(
-              $burn_x,
-          ),
-          'y' => array(
-              $burn_y,
-          ),
-          'xformat' => 'epoch',
-          'yformat' => 'int',
-      ));
+          'x' => $data[0],
+          'y' => $data[1],
+      ), 'sprint');
+
+    $chart = id(new PHUIObjectBoxView())
+        ->setHeaderText(pht('Burn Up Report'))
+        ->appendChild(phutil_tag('div',
+            array(
+                'id' => $id,
+                'style' => 'border: 1px solid #BFCFDA; '.
+                    'background-color: #fff; '.
+                    'margin: 8px 16px; '.
+                    'height: 400px; ',
+            ), ''));
 
       return $chart;
     }
 
-   private function buildSeries(array $data) {
-      $out = array();
-      $data = $this->addTaskStatustoData ($data);
+  private function buildSeries(array $data) {
+    $output = array(array(
+        pht('Dates'),
+        pht('Tasks'),
+    ),);
+      $tdata = $this->addTaskStatustoData ($data);
       $counter = 0;
-      foreach ($data as $key => $row) {
-        $t = (int)$row['dateCreated'];
+      foreach ($tdata as $key => $row) {
+        $t = (int)$row['dateCreated'] * 1000;
         if ($row['_is_close']) {
           --$counter;
-          $out[$t] = $counter;
         } else if ($row['_is_open']) {
           ++$counter;
-          $out[$t] = $counter;
         }
-      }
+        $output[] = array(
+        $t, $counter,);
 
-      return array(array_keys($out), array_values($out));
+      }
+      return $output;
     }
 
     /**

-- 
To view, visit https://gerrit.wikimedia.org/r/189931
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0d72db12090624226a0ce8f4639bf04df27135c3
Gerrit-PatchSet: 1
Gerrit-Project: phabricator/extensions/Sprint
Gerrit-Branch: master
Gerrit-Owner: Christopher Johnson (WMDE) <christopher.john...@wikimedia.de>
Gerrit-Reviewer: Christopher Johnson (WMDE) <christopher.john...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to