mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-23 05:01:13 +01:00
Add "Group by Status" to Workboards
Summary: Depends on D20276. Ref T10333. This one is a little bit rough/experimental, and I'm sort of curious what feedback we get about it. Weird stuff: - All statuses are always shown, even if the filter prevents tasks in that status from appearing (which is the default, since views are "Open Tasks" by default). - Pro: you can close tasks by dragging them to a closed status. - Con: lots of empty groups. - The "Duplicate" status is shown. - Pro: Shows closed duplicate tasks. - Con: Dragging tasks to "Duplicate" works, but is silly. - Since boards show "open tasks" by default, dragging stuff to a closed status and then reloading the board causes it to vanish. This is kind of how everything works, but more obvious/defaulted on "Status". These issues might overwhelm its usefulness, but there isn't much cost to nuking it in the future if feedback is mostly negative/confused. Test Plan: Grouped a workboard by status, dragged stuff around. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T10333 Differential Revision: https://secure.phabricator.com/D20277
This commit is contained in:
parent
03b7aca019
commit
a400d82932
2 changed files with 108 additions and 0 deletions
|
@ -4065,6 +4065,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorProjectColumnPriorityOrder' => 'applications/project/order/PhabricatorProjectColumnPriorityOrder.php',
|
'PhabricatorProjectColumnPriorityOrder' => 'applications/project/order/PhabricatorProjectColumnPriorityOrder.php',
|
||||||
'PhabricatorProjectColumnQuery' => 'applications/project/query/PhabricatorProjectColumnQuery.php',
|
'PhabricatorProjectColumnQuery' => 'applications/project/query/PhabricatorProjectColumnQuery.php',
|
||||||
'PhabricatorProjectColumnSearchEngine' => 'applications/project/query/PhabricatorProjectColumnSearchEngine.php',
|
'PhabricatorProjectColumnSearchEngine' => 'applications/project/query/PhabricatorProjectColumnSearchEngine.php',
|
||||||
|
'PhabricatorProjectColumnStatusOrder' => 'applications/project/order/PhabricatorProjectColumnStatusOrder.php',
|
||||||
'PhabricatorProjectColumnTransaction' => 'applications/project/storage/PhabricatorProjectColumnTransaction.php',
|
'PhabricatorProjectColumnTransaction' => 'applications/project/storage/PhabricatorProjectColumnTransaction.php',
|
||||||
'PhabricatorProjectColumnTransactionEditor' => 'applications/project/editor/PhabricatorProjectColumnTransactionEditor.php',
|
'PhabricatorProjectColumnTransactionEditor' => 'applications/project/editor/PhabricatorProjectColumnTransactionEditor.php',
|
||||||
'PhabricatorProjectColumnTransactionQuery' => 'applications/project/query/PhabricatorProjectColumnTransactionQuery.php',
|
'PhabricatorProjectColumnTransactionQuery' => 'applications/project/query/PhabricatorProjectColumnTransactionQuery.php',
|
||||||
|
@ -10155,6 +10156,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorProjectColumnPriorityOrder' => 'PhabricatorProjectColumnOrder',
|
'PhabricatorProjectColumnPriorityOrder' => 'PhabricatorProjectColumnOrder',
|
||||||
'PhabricatorProjectColumnQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PhabricatorProjectColumnQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'PhabricatorProjectColumnSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'PhabricatorProjectColumnSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
|
'PhabricatorProjectColumnStatusOrder' => 'PhabricatorProjectColumnOrder',
|
||||||
'PhabricatorProjectColumnTransaction' => 'PhabricatorApplicationTransaction',
|
'PhabricatorProjectColumnTransaction' => 'PhabricatorApplicationTransaction',
|
||||||
'PhabricatorProjectColumnTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
|
'PhabricatorProjectColumnTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||||
'PhabricatorProjectColumnTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
'PhabricatorProjectColumnTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
|
||||||
|
|
|
@ -0,0 +1,106 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
final class PhabricatorProjectColumnStatusOrder
|
||||||
|
extends PhabricatorProjectColumnOrder {
|
||||||
|
|
||||||
|
const ORDERKEY = 'status';
|
||||||
|
|
||||||
|
public function getDisplayName() {
|
||||||
|
return pht('Group by Status');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function newMenuIconIcon() {
|
||||||
|
return 'fa-check';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getHasHeaders() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCanReorder() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMenuOrder() {
|
||||||
|
return 3000;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function newHeaderKeyForObject($object) {
|
||||||
|
return $this->newHeaderKeyForStatus($object->getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
private function newHeaderKeyForStatus($status) {
|
||||||
|
return sprintf('status(%s)', $status);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function newSortVectorsForObjects(array $objects) {
|
||||||
|
$status_sequence = $this->newStatusSequence();
|
||||||
|
|
||||||
|
$vectors = array();
|
||||||
|
foreach ($objects as $object_key => $object) {
|
||||||
|
$vectors[$object_key] = array(
|
||||||
|
(int)idx($status_sequence, $object->getStatus(), 0),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $vectors;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function newStatusSequence() {
|
||||||
|
$statuses = ManiphestTaskStatus::getTaskStatusMap();
|
||||||
|
return array_combine(
|
||||||
|
array_keys($statuses),
|
||||||
|
range(1, count($statuses)));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function newHeadersForObjects(array $objects) {
|
||||||
|
$headers = array();
|
||||||
|
|
||||||
|
$statuses = ManiphestTaskStatus::getTaskStatusMap();
|
||||||
|
$sequence = $this->newStatusSequence();
|
||||||
|
|
||||||
|
foreach ($statuses as $status_key => $status_name) {
|
||||||
|
$header_key = $this->newHeaderKeyForStatus($status_key);
|
||||||
|
|
||||||
|
$sort_vector = array(
|
||||||
|
(int)idx($sequence, $status_key, 0),
|
||||||
|
);
|
||||||
|
|
||||||
|
$status_icon = ManiphestTaskStatus::getStatusIcon($status_key);
|
||||||
|
$status_color = ManiphestTaskStatus::getStatusColor($status_key);
|
||||||
|
|
||||||
|
$icon_view = id(new PHUIIconView())
|
||||||
|
->setIcon($status_icon, $status_color);
|
||||||
|
|
||||||
|
$header = $this->newHeader()
|
||||||
|
->setHeaderKey($header_key)
|
||||||
|
->setSortVector($sort_vector)
|
||||||
|
->setName($status_name)
|
||||||
|
->setIcon($icon_view)
|
||||||
|
->setEditProperties(
|
||||||
|
array(
|
||||||
|
'value' => $status_key,
|
||||||
|
));
|
||||||
|
|
||||||
|
$headers[] = $header;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function newColumnTransactions($object, array $header) {
|
||||||
|
$new_status = idx($header, 'value');
|
||||||
|
|
||||||
|
if ($object->getStatus() === $new_status) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$xactions = array();
|
||||||
|
$xactions[] = $this->newTransaction($object)
|
||||||
|
->setTransactionType(ManiphestTaskStatusTransaction::TRANSACTIONTYPE)
|
||||||
|
->setNewValue($new_status);
|
||||||
|
|
||||||
|
return $xactions;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue