mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 08:42:41 +01:00
Allow the workboard backlog column to be reordered
Summary: Fixes T5677. - Instead of using `sequence == 0` to mean "this is the backlog column", flag the column explicitly. - Migrate existing sequence 0 columns to have the flag. - Add the flag when initializing or copying a board. - Remove special backlog logic when reordering columns. Test Plan: - Migrated columns, viewed some boards, they looked identical. - Reordered the backlog column a bunch of times (first, last, middle, dragged other stuff around). - Added tasks to a project, saw them show up in the reordered backlog. - Initialized a new board and saw a backlog column show up. - Copied an existing board and saw the backlog column come over. - Tried to hide a backlog column. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5677 Differential Revision: https://secure.phabricator.com/D10189
This commit is contained in:
parent
237b1d769b
commit
24a6eeb8d8
8 changed files with 56 additions and 27 deletions
2
resources/sql/autopatches/20140808.boardprop.1.sql
Normal file
2
resources/sql/autopatches/20140808.boardprop.1.sql
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE {$NAMESPACE}_project.project_column
|
||||||
|
ADD properties LONGTEXT NOT NULL COLLATE utf8_bin;
|
2
resources/sql/autopatches/20140808.boardprop.2.sql
Normal file
2
resources/sql/autopatches/20140808.boardprop.2.sql
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
UPDATE {$NAMESPACE}_project.project_column
|
||||||
|
SET properties = '{}' WHERE properties = '';
|
24
resources/sql/autopatches/20140808.boardprop.3.php
Normal file
24
resources/sql/autopatches/20140808.boardprop.3.php
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$table = new PhabricatorProjectColumn();
|
||||||
|
$conn_w = $table->establishConnection('w');
|
||||||
|
|
||||||
|
foreach (new LiskMigrationIterator($table) as $column) {
|
||||||
|
$id = $column->getID();
|
||||||
|
|
||||||
|
echo "Adjusting column {$id}...\n";
|
||||||
|
if ($column->getSequence() == 0) {
|
||||||
|
|
||||||
|
$properties = $column->getProperties();
|
||||||
|
$properties['isDefault'] = true;
|
||||||
|
|
||||||
|
queryfx(
|
||||||
|
$conn_w,
|
||||||
|
'UPDATE %T SET properties = %s WHERE id = %d',
|
||||||
|
$table->getTableName(),
|
||||||
|
json_encode($properties),
|
||||||
|
$id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Done.\n";
|
|
@ -60,6 +60,7 @@ final class PhabricatorProjectBoardImportController
|
||||||
->setSequence($import_column->getSequence())
|
->setSequence($import_column->getSequence())
|
||||||
->setProjectPHID($project->getPHID())
|
->setProjectPHID($project->getPHID())
|
||||||
->setName($import_column->getName())
|
->setName($import_column->getName())
|
||||||
|
->setProperties($import_column->getProperties())
|
||||||
->save();
|
->save();
|
||||||
}
|
}
|
||||||
$table->saveTransaction();
|
$table->saveTransaction();
|
||||||
|
|
|
@ -54,11 +54,9 @@ final class PhabricatorProjectBoardReorderController
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: We could let you move the backlog column around if you really
|
|
||||||
// want, but for now we use sequence position 0 as magic.
|
|
||||||
$target_column = $columns[$column_phid];
|
$target_column = $columns[$column_phid];
|
||||||
$new_sequence = $request->getInt('sequence');
|
$new_sequence = $request->getInt('sequence');
|
||||||
if ($target_column->isDefaultColumn() || $new_sequence < 1) {
|
if ($new_sequence < 0) {
|
||||||
return new Aphront404Response();
|
return new Aphront404Response();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,11 +99,6 @@ final class PhabricatorProjectBoardReorderController
|
||||||
|
|
||||||
$list_id = celerity_generate_unique_node_id();
|
$list_id = celerity_generate_unique_node_id();
|
||||||
|
|
||||||
$static_list = id(new PHUIObjectItemListView())
|
|
||||||
->setUser($viewer)
|
|
||||||
->setFlush(true)
|
|
||||||
->setStackable(true);
|
|
||||||
|
|
||||||
$list = id(new PHUIObjectItemListView())
|
$list = id(new PHUIObjectItemListView())
|
||||||
->setUser($viewer)
|
->setUser($viewer)
|
||||||
->setID($list_id)
|
->setID($list_id)
|
||||||
|
@ -120,21 +113,15 @@ final class PhabricatorProjectBoardReorderController
|
||||||
$item->setDisabled(true);
|
$item->setDisabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($column->isDefaultColumn()) {
|
$item->setGrippable(true);
|
||||||
$item->setDisabled(true);
|
$item->addSigil('board-column');
|
||||||
$static_list->addItem($item);
|
$item->setMetadata(
|
||||||
} else {
|
array(
|
||||||
$item->setGrippable(true);
|
'columnPHID' => $column->getPHID(),
|
||||||
$item->addSigil('board-column');
|
'columnSequence' => $column->getSequence(),
|
||||||
$item->setMetadata(
|
));
|
||||||
array(
|
|
||||||
'columnPHID' => $column->getPHID(),
|
|
||||||
'columnSequence' => $column->getSequence(),
|
|
||||||
));
|
|
||||||
|
|
||||||
$list->addItem($item);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$list->addItem($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
Javelin::initBehavior(
|
Javelin::initBehavior(
|
||||||
|
@ -147,9 +134,7 @@ final class PhabricatorProjectBoardReorderController
|
||||||
return $this->newDialog()
|
return $this->newDialog()
|
||||||
->setTitle(pht('Reorder Columns'))
|
->setTitle(pht('Reorder Columns'))
|
||||||
->setWidth(AphrontDialogView::WIDTH_FORM)
|
->setWidth(AphrontDialogView::WIDTH_FORM)
|
||||||
->appendParagraph(pht('This column can not be moved:'))
|
->appendParagraph(pht('Drag and drop columns to reorder them.'))
|
||||||
->appendChild($static_list)
|
|
||||||
->appendParagraph(pht('Drag and drop these columns to reorder them:'))
|
|
||||||
->appendChild($list)
|
->appendChild($list)
|
||||||
->addSubmitButton(pht('Done'));
|
->addSubmitButton(pht('Done'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ final class PhabricatorProjectBoardViewController
|
||||||
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
|
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
|
||||||
$column = PhabricatorProjectColumn::initializeNewColumn($viewer)
|
$column = PhabricatorProjectColumn::initializeNewColumn($viewer)
|
||||||
->setSequence(0)
|
->setSequence(0)
|
||||||
|
->setProperty('isDefault', true)
|
||||||
->setProjectPHID($project->getPHID())
|
->setProjectPHID($project->getPHID())
|
||||||
->save();
|
->save();
|
||||||
$column->attachProject($project);
|
$column->attachProject($project);
|
||||||
|
|
|
@ -17,6 +17,7 @@ final class PhabricatorProjectColumn
|
||||||
protected $status;
|
protected $status;
|
||||||
protected $projectPHID;
|
protected $projectPHID;
|
||||||
protected $sequence;
|
protected $sequence;
|
||||||
|
protected $properties = array();
|
||||||
|
|
||||||
private $project = self::ATTACHABLE;
|
private $project = self::ATTACHABLE;
|
||||||
|
|
||||||
|
@ -29,6 +30,9 @@ final class PhabricatorProjectColumn
|
||||||
public function getConfiguration() {
|
public function getConfiguration() {
|
||||||
return array(
|
return array(
|
||||||
self::CONFIG_AUX_PHID => true,
|
self::CONFIG_AUX_PHID => true,
|
||||||
|
self::CONFIG_SERIALIZATION => array(
|
||||||
|
'properties' => self::SERIALIZATION_JSON,
|
||||||
|
),
|
||||||
) + parent::getConfiguration();
|
) + parent::getConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +51,7 @@ final class PhabricatorProjectColumn
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isDefaultColumn() {
|
public function isDefaultColumn() {
|
||||||
return ($this->getSequence() == 0);
|
return (bool)$this->getProperty('isDefault');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isHidden() {
|
public function isHidden() {
|
||||||
|
@ -75,9 +79,19 @@ final class PhabricatorProjectColumn
|
||||||
if ($this->isDefaultColumn()) {
|
if ($this->isDefaultColumn()) {
|
||||||
return PHUIActionHeaderView::HEADER_DARK_GREY;
|
return PHUIActionHeaderView::HEADER_DARK_GREY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PHUIActionHeaderView::HEADER_GREY;
|
return PHUIActionHeaderView::HEADER_GREY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getProperty($key, $default = null) {
|
||||||
|
return idx($this->properties, $key, $default);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setProperty($key, $value) {
|
||||||
|
$this->properties[$key] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ JX.behavior('reorder-columns', function(config) {
|
||||||
|
|
||||||
var parameters = {
|
var parameters = {
|
||||||
columnPHID: node_data.columnPHID,
|
columnPHID: node_data.columnPHID,
|
||||||
sequence: (sequence === null) ? 1 : (parseInt(sequence, 10) + 1)
|
sequence: (sequence === null) ? 0 : (parseInt(sequence, 10) + 1)
|
||||||
};
|
};
|
||||||
|
|
||||||
new JX.Workflow(config.reorderURI, parameters)
|
new JX.Workflow(config.reorderURI, parameters)
|
||||||
|
|
Loading…
Reference in a new issue