mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +01:00
Send appropriate requests to the server when dragging cards on project boards
Summary: Ref T1344. Makes requests to the server, which are received and ignored. Performs appropriate locking/unlocking/enabling/disabling on the client. Test Plan: Dragged stuff around, saw it enable/disable/send correctly. Reviewers: chad, btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T1344 Differential Revision: https://secure.phabricator.com/D7943
This commit is contained in:
parent
a101b4ba2e
commit
35d37df4fb
7 changed files with 104 additions and 16 deletions
|
@ -392,7 +392,7 @@ return array(
|
|||
'rsrc/js/application/policy/behavior-policy-control.js' => 'c01153ea',
|
||||
'rsrc/js/application/policy/behavior-policy-rule-editor.js' => '263aeb8c',
|
||||
'rsrc/js/application/ponder/behavior-votebox.js' => '327dbe61',
|
||||
'rsrc/js/application/projects/behavior-project-boards.js' => '9c9f91ec',
|
||||
'rsrc/js/application/projects/behavior-project-boards.js' => '1b9facd8',
|
||||
'rsrc/js/application/projects/behavior-project-create.js' => '065227cc',
|
||||
'rsrc/js/application/releeph/releeph-preview-branch.js' => '9eb2cedb',
|
||||
'rsrc/js/application/releeph/releeph-request-state-change.js' => 'fe7fc914',
|
||||
|
@ -417,7 +417,7 @@ return array(
|
|||
'rsrc/js/application/uiexample/notification-example.js' => 'c51a6616',
|
||||
'rsrc/js/core/Busy.js' => '6453c869',
|
||||
'rsrc/js/core/DragAndDropFileUpload.js' => 'ae6abfba',
|
||||
'rsrc/js/core/DraggableList.js' => '14824eb5',
|
||||
'rsrc/js/core/DraggableList.js' => '1681c4d4',
|
||||
'rsrc/js/core/DropdownMenu.js' => '2f6f80f4',
|
||||
'rsrc/js/core/DropdownMenuItem.js' => '0f386ef4',
|
||||
'rsrc/js/core/FileUpload.js' => '96713558',
|
||||
|
@ -603,7 +603,7 @@ return array(
|
|||
'javelin-behavior-policy-control' => 'c01153ea',
|
||||
'javelin-behavior-policy-rule-editor' => '263aeb8c',
|
||||
'javelin-behavior-ponder-votebox' => '327dbe61',
|
||||
'javelin-behavior-project-boards' => '9c9f91ec',
|
||||
'javelin-behavior-project-boards' => '1b9facd8',
|
||||
'javelin-behavior-project-create' => '065227cc',
|
||||
'javelin-behavior-refresh-csrf' => 'c4b31646',
|
||||
'javelin-behavior-releeph-preview-branch' => '9eb2cedb',
|
||||
|
@ -675,7 +675,7 @@ return array(
|
|||
'phabricator-countdown-css' => '86b7b0a0',
|
||||
'phabricator-crumbs-view-css' => '2d9db584',
|
||||
'phabricator-drag-and-drop-file-upload' => 'ae6abfba',
|
||||
'phabricator-draggable-list' => '14824eb5',
|
||||
'phabricator-draggable-list' => '1681c4d4',
|
||||
'phabricator-dropdown-menu' => '2f6f80f4',
|
||||
'phabricator-fatal-config-template-css' => '25d446d6',
|
||||
'phabricator-feed-css' => '4716c86f',
|
||||
|
@ -871,7 +871,7 @@ return array(
|
|||
4 => 'javelin-util',
|
||||
5 => 'phabricator-shaped-request',
|
||||
),
|
||||
'14824eb5' =>
|
||||
'1681c4d4' =>
|
||||
array(
|
||||
0 => 'javelin-install',
|
||||
1 => 'javelin-dom',
|
||||
|
@ -898,6 +898,15 @@ return array(
|
|||
1 => 'javelin-util',
|
||||
2 => 'phabricator-keyboard-shortcut-manager',
|
||||
),
|
||||
'1b9facd8' =>
|
||||
array(
|
||||
0 => 'javelin-behavior',
|
||||
1 => 'javelin-dom',
|
||||
2 => 'javelin-util',
|
||||
3 => 'javelin-stratcom',
|
||||
4 => 'javelin-workflow',
|
||||
5 => 'phabricator-draggable-list',
|
||||
),
|
||||
'1e1c8a59' =>
|
||||
array(
|
||||
0 => 'javelin-behavior',
|
||||
|
@ -1400,13 +1409,6 @@ return array(
|
|||
3 => 'javelin-vector',
|
||||
4 => 'phabricator-hovercard',
|
||||
),
|
||||
'9c9f91ec' =>
|
||||
array(
|
||||
0 => 'javelin-behavior',
|
||||
1 => 'javelin-dom',
|
||||
2 => 'javelin-util',
|
||||
3 => 'phabricator-draggable-list',
|
||||
),
|
||||
'9db3d160' =>
|
||||
array(
|
||||
0 => 'javelin-behavior',
|
||||
|
|
|
@ -1769,6 +1769,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorProjectHistoryController' => 'applications/project/controller/PhabricatorProjectHistoryController.php',
|
||||
'PhabricatorProjectListController' => 'applications/project/controller/PhabricatorProjectListController.php',
|
||||
'PhabricatorProjectMembersEditController' => 'applications/project/controller/PhabricatorProjectMembersEditController.php',
|
||||
'PhabricatorProjectMoveController' => 'applications/project/controller/PhabricatorProjectMoveController.php',
|
||||
'PhabricatorProjectNameCollisionException' => 'applications/project/exception/PhabricatorProjectNameCollisionException.php',
|
||||
'PhabricatorProjectPHIDTypeColumn' => 'applications/project/phid/PhabricatorProjectPHIDTypeColumn.php',
|
||||
'PhabricatorProjectPHIDTypeProject' => 'applications/project/phid/PhabricatorProjectPHIDTypeProject.php',
|
||||
|
@ -3537,8 +3538,8 @@ phutil_register_library_map(array(
|
|||
'PHUITextExample' => 'PhabricatorUIExample',
|
||||
'PHUITextView' => 'AphrontTagView',
|
||||
'PHUIWorkboardExample' => 'PhabricatorUIExample',
|
||||
'PHUIWorkboardView' => 'AphrontView',
|
||||
'PHUIWorkpanelView' => 'AphrontView',
|
||||
'PHUIWorkboardView' => 'AphrontTagView',
|
||||
'PHUIWorkpanelView' => 'AphrontTagView',
|
||||
'PackageCreateMail' => 'PackageMail',
|
||||
'PackageDeleteMail' => 'PackageMail',
|
||||
'PackageMail' => 'PhabricatorMail',
|
||||
|
@ -4387,6 +4388,7 @@ phutil_register_library_map(array(
|
|||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
||||
),
|
||||
'PhabricatorProjectMembersEditController' => 'PhabricatorProjectController',
|
||||
'PhabricatorProjectMoveController' => 'PhabricatorProjectController',
|
||||
'PhabricatorProjectNameCollisionException' => 'Exception',
|
||||
'PhabricatorProjectPHIDTypeColumn' => 'PhabricatorPHIDType',
|
||||
'PhabricatorProjectPHIDTypeProject' => 'PhabricatorPHIDType',
|
||||
|
|
|
@ -46,6 +46,7 @@ final class PhabricatorApplicationProject extends PhabricatorApplication {
|
|||
'PhabricatorProjectProfilePictureController',
|
||||
'create/' => 'PhabricatorProjectCreateController',
|
||||
'board/(?P<id>[1-9]\d*)/' => 'PhabricatorProjectBoardController',
|
||||
'move/(?P<id>[1-9]\d*)/' => 'PhabricatorProjectMoveController',
|
||||
'board/(?P<projectID>[1-9]\d*)/edit/(?:(?P<id>\d+)/)?'
|
||||
=> 'PhabricatorProjectBoardEditController',
|
||||
'update/(?P<id>[1-9]\d*)/(?P<action>[^/]+)/'
|
||||
|
|
|
@ -72,6 +72,7 @@ final class PhabricatorProjectBoardController
|
|||
'project-boards',
|
||||
array(
|
||||
'boardID' => $board_id,
|
||||
'moveURI' => $this->getApplicationURI('move/'.$project->getID().'/'),
|
||||
));
|
||||
|
||||
foreach ($columns as $column) {
|
||||
|
@ -85,7 +86,11 @@ final class PhabricatorProjectBoardController
|
|||
->setCards(true)
|
||||
->setFlush(true)
|
||||
->setAllowEmptyList(true)
|
||||
->addSigil('project-column');
|
||||
->addSigil('project-column')
|
||||
->setMetadata(
|
||||
array(
|
||||
'columnPHID' => $column->getPHID(),
|
||||
));
|
||||
$task_phids = idx($task_map, $column->getPHID(), array());
|
||||
foreach (array_select_keys($tasks, $task_phids) as $task) {
|
||||
$cards->addItem($this->renderTaskCard($task));
|
||||
|
@ -164,6 +169,10 @@ final class PhabricatorProjectBoardController
|
|||
->setGrippable($can_edit)
|
||||
->setHref('/T'.$task->getID())
|
||||
->addSigil('project-card')
|
||||
->setMetadata(
|
||||
array(
|
||||
'objectPHID' => $task->getPHID(),
|
||||
))
|
||||
->addAction(
|
||||
id(new PHUIListItemView())
|
||||
->setName(pht('Edit'))
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
final class PhabricatorProjectMoveController
|
||||
extends PhabricatorProjectController {
|
||||
|
||||
private $id;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->id = $data['id'];
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$viewer = $request->getUser();
|
||||
|
||||
$project = id(new PhabricatorProjectQuery())
|
||||
->setViewer($viewer)
|
||||
->requireCapabilities(
|
||||
array(
|
||||
PhabricatorPolicyCapability::CAN_VIEW,
|
||||
PhabricatorPolicyCapability::CAN_EDIT,
|
||||
))
|
||||
->withIDs(array($this->id))
|
||||
->executeOne();
|
||||
if (!$project) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
return id(new AphrontAjaxResponse())->setContent(array());
|
||||
}
|
||||
}
|
|
@ -3,6 +3,8 @@
|
|||
* @requires javelin-behavior
|
||||
* javelin-dom
|
||||
* javelin-util
|
||||
* javelin-stratcom
|
||||
* javelin-workflow
|
||||
* phabricator-draggable-list
|
||||
*/
|
||||
|
||||
|
@ -16,6 +18,31 @@ JX.behavior('project-boards', function(config) {
|
|||
JX.DOM.alterClass(node, 'project-column-empty', !this.findItems().length);
|
||||
}
|
||||
|
||||
function onresponse(response) {
|
||||
|
||||
}
|
||||
|
||||
function ondrop(list, item, after, from) {
|
||||
list.lock();
|
||||
JX.DOM.alterClass(item, 'drag-sending', true);
|
||||
|
||||
var data = {
|
||||
objectPHID: JX.Stratcom.getData(item).objectPHID,
|
||||
columnPHID: JX.Stratcom.getData(list.getRootNode()).columnPHID,
|
||||
afterPHID: after && JX.Stratcom.getData(after).objectPHID
|
||||
};
|
||||
|
||||
var workflow = new JX.Workflow(config.moveURI, data)
|
||||
.setHandler(function(response) {
|
||||
onresponse(response);
|
||||
list.unlock();
|
||||
|
||||
JX.DOM.alterClass(item, 'drag-sending', false);
|
||||
});
|
||||
|
||||
workflow.start();
|
||||
}
|
||||
|
||||
var lists = [];
|
||||
var ii;
|
||||
var cols = JX.DOM.scry(JX.$(config.boardID), 'ul', 'project-column');
|
||||
|
@ -27,6 +54,8 @@ JX.behavior('project-boards', function(config) {
|
|||
list.listen('didSend', JX.bind(list, onupdate, cols[ii]));
|
||||
list.listen('didReceive', JX.bind(list, onupdate, cols[ii]));
|
||||
|
||||
list.listen('didDrop', JX.bind(null, ondrop, list));
|
||||
|
||||
lists.push(list);
|
||||
}
|
||||
|
||||
|
|
|
@ -420,6 +420,13 @@ JX.install('DraggableList', {
|
|||
},
|
||||
|
||||
lock : function() {
|
||||
for (var ii = 0; ii < this._group.length; ii++) {
|
||||
this._group[ii]._lock();
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
_lock : function() {
|
||||
this._locked++;
|
||||
if (this._locked === 1) {
|
||||
this.invoke('didLock');
|
||||
|
@ -427,7 +434,14 @@ JX.install('DraggableList', {
|
|||
return this;
|
||||
},
|
||||
|
||||
unlock : function() {
|
||||
unlock: function() {
|
||||
for (var ii = 0; ii < this._group.length; ii++) {
|
||||
this._group[ii]._unlock();
|
||||
}
|
||||
return this;
|
||||
},
|
||||
|
||||
_unlock : function() {
|
||||
if (__DEV__) {
|
||||
if (!this._locked) {
|
||||
JX.$E("JX.Draggable.unlock(): Draggable is not locked!");
|
||||
|
|
Loading…
Reference in a new issue