Add a secret board view to Projects
Summary:
Ref T1344. This is //very// rough. Some UI issues:
- Empty states for the board and columns are junky.
- Column widths are crazy. I think we need to set them to fixed-width, since we may have an arbitrarily large number of columns?
- I don't think we have the header UI elements in M10 yet and that mock is pretty old, so I sort of very roughly approximated it.
- What should we do when you click a task title? Popping the whole task in a dialog is possible but needs a bunch of work to actually work. Might need to build "sheets" or something.
- Icons are slightly clipped for some reason.
- All the backend stuff is totally faked.
Generally, my plan is just to use these to implement all of T390. Specifically:
- "Kanban" projects will have "Backlog" on the left. You'll drag them toward the right as you make progress.
- "Milestone" projects will have "No Milestone" on the left, then "Milestone 9", "Milestone 8", etc.
- "Sprint" projects will have "Backlog" on the left, then "Sprint 31", "Sprint 30", etc.
So all of these things end up being pretty much exactly the same, with some minor text changes and new columns showing up on the left vs the right or whatever.
Test Plan: See screenshot.
Reviewers: chad, btrahan
Reviewed By: btrahan
CC: chad, aran, sascha-egerer
Maniphest Tasks: T1344
Differential Revision: https://secure.phabricator.com/D7374
2013-10-22 06:11:36 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorProjectBoardController
|
|
|
|
extends PhabricatorProjectController {
|
|
|
|
|
|
|
|
private $id;
|
|
|
|
|
|
|
|
public function shouldAllowPublic() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function willProcessRequest(array $data) {
|
|
|
|
$this->id = $data['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$viewer = $request->getUser();
|
|
|
|
|
|
|
|
$project = id(new PhabricatorProjectQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withIDs(array($this->id))
|
|
|
|
->executeOne();
|
|
|
|
if (!$project) {
|
|
|
|
return new Aphront404Response();
|
|
|
|
}
|
|
|
|
|
|
|
|
$columns = id(new PhabricatorProjectColumnQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withProjectPHIDs(array($project->getPHID()))
|
|
|
|
->execute();
|
|
|
|
|
|
|
|
// TODO: Completely making this part up.
|
|
|
|
$columns[] = id(new PhabricatorProjectColumn())
|
|
|
|
->setName('Backlog')
|
|
|
|
->setPHID(0)
|
|
|
|
->setSequence(0);
|
|
|
|
|
|
|
|
$columns[] = id(new PhabricatorProjectColumn())
|
|
|
|
->setName('Assigned')
|
|
|
|
->setPHID(1)
|
|
|
|
->setSequence(1);
|
|
|
|
|
|
|
|
$columns[] = id(new PhabricatorProjectColumn())
|
|
|
|
->setName('In Progress')
|
|
|
|
->setPHID(2)
|
|
|
|
->setSequence(2);
|
|
|
|
|
|
|
|
$columns[] = id(new PhabricatorProjectColumn())
|
|
|
|
->setName('Completed')
|
|
|
|
->setPHID(3)
|
|
|
|
->setSequence(3);
|
|
|
|
|
|
|
|
msort($columns, 'getSequence');
|
|
|
|
|
|
|
|
$tasks = id(new ManiphestTaskQuery())
|
|
|
|
->setViewer($viewer)
|
|
|
|
->withAllProjects(array($project->getPHID()))
|
|
|
|
->withStatus(ManiphestTaskQuery::STATUS_OPEN)
|
|
|
|
->setOrderBy(ManiphestTaskQuery::ORDER_PRIORITY)
|
|
|
|
->execute();
|
|
|
|
$tasks = mpull($tasks, null, 'getPHID');
|
|
|
|
|
|
|
|
// TODO: This is also made up.
|
|
|
|
$task_map = array();
|
|
|
|
foreach ($tasks as $task) {
|
|
|
|
$task_map[mt_rand(0, 3)][] = $task->getPHID();
|
|
|
|
}
|
|
|
|
|
|
|
|
$board = id(new PHUIWorkboardView())
|
2013-11-06 03:55:42 +01:00
|
|
|
->setUser($viewer)
|
|
|
|
->setFluidishLayout(true);
|
Add a secret board view to Projects
Summary:
Ref T1344. This is //very// rough. Some UI issues:
- Empty states for the board and columns are junky.
- Column widths are crazy. I think we need to set them to fixed-width, since we may have an arbitrarily large number of columns?
- I don't think we have the header UI elements in M10 yet and that mock is pretty old, so I sort of very roughly approximated it.
- What should we do when you click a task title? Popping the whole task in a dialog is possible but needs a bunch of work to actually work. Might need to build "sheets" or something.
- Icons are slightly clipped for some reason.
- All the backend stuff is totally faked.
Generally, my plan is just to use these to implement all of T390. Specifically:
- "Kanban" projects will have "Backlog" on the left. You'll drag them toward the right as you make progress.
- "Milestone" projects will have "No Milestone" on the left, then "Milestone 9", "Milestone 8", etc.
- "Sprint" projects will have "Backlog" on the left, then "Sprint 31", "Sprint 30", etc.
So all of these things end up being pretty much exactly the same, with some minor text changes and new columns showing up on the left vs the right or whatever.
Test Plan: See screenshot.
Reviewers: chad, btrahan
Reviewed By: btrahan
CC: chad, aran, sascha-egerer
Maniphest Tasks: T1344
Differential Revision: https://secure.phabricator.com/D7374
2013-10-22 06:11:36 +02:00
|
|
|
|
|
|
|
foreach ($columns as $column) {
|
|
|
|
$panel = id(new PHUIWorkpanelView())
|
|
|
|
->setHeader($column->getName());
|
|
|
|
|
|
|
|
$cards = id(new PHUIObjectItemListView())
|
|
|
|
->setUser($viewer)
|
|
|
|
->setCards(true)
|
|
|
|
->setFlush(true);
|
|
|
|
$task_phids = idx($task_map, $column->getPHID(), array());
|
|
|
|
foreach (array_select_keys($tasks, $task_phids) as $task) {
|
|
|
|
$cards->addItem($this->renderTaskCard($task));
|
|
|
|
}
|
|
|
|
$panel->setCards($cards);
|
|
|
|
|
|
|
|
$board->addPanel($panel);
|
|
|
|
}
|
|
|
|
|
|
|
|
$crumbs = $this->buildApplicationCrumbs();
|
|
|
|
|
|
|
|
$actions = id(new PhabricatorActionListView())
|
|
|
|
->setUser($viewer)
|
|
|
|
->addAction(
|
|
|
|
id(new PhabricatorActionView())
|
|
|
|
->setName(pht('Add Column/Milestone/Sprint'))
|
|
|
|
->setHref($this->getApplicationURI('board/'.$this->id.'/edit/'))
|
|
|
|
->setIcon('create'));
|
|
|
|
|
|
|
|
$plist = id(new PHUIPropertyListView());
|
|
|
|
// TODO: Need this to get actions to render.
|
|
|
|
$plist->addProperty(pht('Ignore'), pht('This Property'));
|
|
|
|
$plist->setActionList($actions);
|
|
|
|
|
|
|
|
$header = id(new PHUIObjectBoxView())
|
|
|
|
->setHeaderText($project->getName())
|
|
|
|
->addPropertyList($plist);
|
|
|
|
|
|
|
|
$board_box = id(new PHUIBoxView())
|
|
|
|
->appendChild($board)
|
|
|
|
->addMargin(PHUI::MARGIN_LARGE);
|
|
|
|
|
|
|
|
return $this->buildApplicationPage(
|
|
|
|
array(
|
|
|
|
$crumbs,
|
|
|
|
$header,
|
|
|
|
$board_box,
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
'title' => pht('Board'),
|
|
|
|
'device' => true,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
private function renderTaskCard(ManiphestTask $task) {
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$viewer = $request->getUser();
|
|
|
|
|
|
|
|
$color_map = ManiphestTaskPriority::getColorMap();
|
|
|
|
$bar_color = idx($color_map, $task->getPriority(), 'grey');
|
|
|
|
|
|
|
|
// TODO: Batch this earlier on.
|
|
|
|
$can_edit = PhabricatorPolicyFilter::hasCapability(
|
|
|
|
$viewer,
|
|
|
|
$task,
|
|
|
|
PhabricatorPolicyCapability::CAN_EDIT);
|
|
|
|
|
|
|
|
return id(new PHUIObjectItemView())
|
|
|
|
->setObjectName('T'.$task->getID())
|
|
|
|
->setHeader($task->getTitle())
|
|
|
|
->setGrippable($can_edit)
|
|
|
|
->setHref('/T'.$task->getID())
|
|
|
|
->addAction(
|
|
|
|
id(new PHUIListItemView())
|
|
|
|
->setName(pht('Edit'))
|
|
|
|
->setIcon('edit')
|
|
|
|
->setHref('/maniphest/task/edit/'.$task->getID().'/')
|
|
|
|
->setWorkflow(true))
|
|
|
|
->setBarColor($bar_color);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|