Christopher Johnson (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/185395

Change subject: Fixes incorrect labels for Blocker and Blocked Tasks in 
TaskTableView
......................................................................

Fixes incorrect labels for Blocker and Blocked Tasks in TaskTableView

Adds icons
Adds tooltip for Blocker indicating what task it is blocking
Bug: T86775

Change-Id: I367fe2ba2790ae620a2b233c2cbd35654d281cbc
---
M src/view/burndown/TasksTableView.php
1 file changed, 69 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/phabricator/extensions/Sprint 
refs/changes/95/185395/1

diff --git a/src/view/burndown/TasksTableView.php 
b/src/view/burndown/TasksTableView.php
index a92df5d..3abb67b 100644
--- a/src/view/burndown/TasksTableView.php
+++ b/src/view/burndown/TasksTableView.php
@@ -128,17 +128,25 @@
     $output = array();
     $rows = array();
     foreach ($this->tasks as $task) {
-      if (isset($map[$task->getPHID()]['independent'])) {
-        $blocked = false;
-      } elseif (isset($map[$task->getPHID()]['parent']))  {
+      if (isset($map[$task->getPHID()]['child']))  {
+        $blocked = true;
+      } elseif (isset($map[$task->getPHID()]['independent'])) {
         $blocked = false;
       } else {
-        $blocked = true;
+        $blocked = false;
+      }
+
+      $parentphid = null;
+      if (isset($map[$task->getPHID()]['parent']))  {
+        $blocker = true;
+        $parentphid = $map[$task->getPHID()]['parent'];
+      } else {
+        $blocker = false;
       }
 
       $points = $sprintpoints->getTaskPoints($task->getPHID());
 
-      $row = $this->addTaskToTree($output, $blocked, $task, $handles, $points);
+      $row = $this->addTaskToTree($output, $blocked, $parentphid, $blocker, 
$task, $handles, $points);
       list ($task, $cdate,, $udate,, $owner_link, $numpriority,, $points, 
$status) = $row[0];
       $row['sort'] = $this->setSortOrder($row, $order, $task, $cdate, $udate, 
$owner_link, $numpriority, $points, $status);
       $rows[] = $row;
@@ -194,14 +202,12 @@
       if ($parents =
           $edges[$task->getPHID()][ 
ManiphestTaskDependedOnByTaskEdgeType::EDGECONST]) {
         foreach ($parents as $parent) {
-          // Make sure this task is in this sprint.
-          if (isset($tasks[$parent['dst']]))
+            if (isset($tasks[$parent['dst']]))
             $map[$task->getPHID()]['parent'][] = $parent['dst'];
         }
       } elseif ($children =
           
$edges[$task->getPHID()][ManiphestTaskDependsOnTaskEdgeType::EDGECONST]) {
           foreach ($children as $child) {
-          // Make sure this task is in this sprint.
             if (isset($tasks[$child['dst']])) {
               $map[$task->getPHID()]['child'][] = $child['dst'];
             }
@@ -244,7 +250,7 @@
     return $task->getPriority();
   }
 
-  private function addTaskToTree($output, $blocked, $task, $handles, $points) {
+  private function addTaskToTree($output, $blocked, $parentphid, $blocker, 
$task, $handles, $points) {
 
     $cdate = $this->getTaskCreatedDate($task);
     $date_created = phabricator_datetime($cdate, $this->viewer);
@@ -256,6 +262,13 @@
     $owner_link = $this->setOwnerLink($handles, $task);
     $priority = $this->getPriority($task);
     $priority_name = $this->getPriorityName($task);
+    if ($blocker === true) {
+      $modal = $this->getModalIconforBlocker($parentphid);
+    } elseif ($blocked === true) {
+      $modal = $this->getModalIconforBlocked();
+    } else {
+      $modal = '';
+    }
 
     $output[] = array(
         phutil_safe_html(phutil_tag(
@@ -266,8 +279,8 @@
                         ? 'phui-tag-core-closed'
                         : '',
                 ),
-                $task->getMonogram() . ': ' . $task->getTitle()
-            ) . ($blocked ? '&nbsp;&nbsp;<em title="This task is a parent of 
another task.">[BLOCKED]</em>' : '')),
+                array ($this->buildTaskLink($task), $modal))
+            ),
         $cdate,
         $date_created,
         $udate,
@@ -282,4 +295,49 @@
     return $output;
   }
 
+  private function getModalIconforBlocker($parentphid) {
+      $ptask = $this->getTaskforPHID(array_shift($parentphid));
+      $task = array_shift($ptask);
+      $linktask = $this->buildTaskLink($task);
+      $monogram = $this->buildTaskMonogram($task);
+      $sigil = 'has-tooltip';
+      $meta  = array(
+        'tip' => pht('Blocks: ' .$linktask),
+        'size' => 200,
+        'align' => 'E',);
+      $image = id(new PHUIIconView())
+          ->addSigil($sigil)
+          ->setMetadata($meta)
+          ->setSpriteSheet(PHUIIconView::SPRITE_PROJECTS)
+          ->setIconFont('fa-wrench', 'green')
+          ->setText('Blocker');
+      return $image;
+  }
+
+  private function getModalIconforBlocked() {
+      $image = id(new PHUIIconView())
+          ->setSpriteSheet(PHUIIconView::SPRITE_PROJECTS)
+          ->setIconFont('fa-lock', 'red')
+          ->setText('Blocked');
+     return $image;
+  }
+
+  private function buildTaskLink($task) {
+    $linktext = $task->getMonogram() . ': ' .  $task->getTitle() . '  ';
+    return $linktext;
+  }
+
+  private function buildTaskMonogram($task) {
+    $monogram = '/' .$task->getMonogram() . '/';
+    return $monogram;
+  }
+
+  private function getTaskforPHID($parentphid) {
+    $task = id(new ManiphestTaskQuery())
+        ->setViewer($this->viewer)
+        ->withPHIDs(array($parentphid))
+        ->needProjectPHIDs(true)
+        ->execute();
+    return $task;
+  }
 }
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I367fe2ba2790ae620a2b233c2cbd35654d281cbc
Gerrit-PatchSet: 1
Gerrit-Project: phabricator/extensions/Sprint
Gerrit-Branch: master
Gerrit-Owner: Christopher Johnson (WMDE) <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to