Christopher Johnson (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/185177
Change subject: adds IconNavView to Sprint Board and Burndown View ...................................................................... adds IconNavView to Sprint Board and Burndown View adds .arclint includes changes from arc lint patches updates compatibility with 2015-01-15 version phabricator https://secure.phabricator.com/D11397 includes new workboard classes Change-Id: I304a6ebc6d1604bd44a1e696150e8d63d2abcddf --- A .arclint A scripts/20150105.sprint.sql M src/__phutil_library_map__.php M src/application/SprintApplication.php M src/controller/SprintController.php M src/controller/SprintDataViewController.php M src/controller/SprintListController.php M src/controller/board/SprintBoardColumnDetailController.php M src/controller/board/SprintBoardColumnEditController.php M src/controller/board/SprintBoardColumnHideController.php M src/controller/board/SprintBoardController.php M src/controller/board/SprintBoardImportController.php M src/controller/board/SprintBoardMoveController.php M src/controller/board/SprintBoardReorderController.php M src/controller/board/SprintBoardViewController.php M src/tests/SprintControllerTest.php 16 files changed, 204 insertions(+), 97 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/phabricator/extensions/Sprint refs/changes/77/185177/1 diff --git a/.arclint b/.arclint new file mode 100644 index 0000000..21baaf8 --- /dev/null +++ b/.arclint @@ -0,0 +1,57 @@ +{ + "exclude": [], + "linters": { + "chmod": { + "type": "chmod" + }, + "filename": { + "type": "filename" + }, + "generated": { + "type": "generated" + }, + "json": { + "type": "json", + "include": [ + "(^\\.arcconfig$)", + "(^\\.arclint$)", + "(\\.json$)" + ] + }, + "merge-conflict": { + "type": "merge-conflict" + }, + "nolint": { + "type": "nolint" + }, + "phutil-library": { + "type": "phutil-library", + "include": "(^\\.php$)" + }, + "phutil-xhpast": { + "type": "phutil-xhpast" + }, + "spelling": { + "type": "spelling" + }, + "text": { + "type": "text" + }, + "text-without-length": { + "type": "text", + "severity": { + "3": "disabled" + } + }, + "xhpast": { + "type": "xhpast", + "include": "(\\.php$)", + "severity": { + "16": "advice", + "34": "error" + }, + "xhpast.php-version": "5.2.3", + "xhpast.php-version.windows": "5.3.0" + } + } +} diff --git a/scripts/20150105.sprint.sql b/scripts/20150105.sprint.sql new file mode 100644 index 0000000..29a7a91 --- /dev/null +++ b/scripts/20150105.sprint.sql @@ -0,0 +1,16 @@ +CREATE DATABASE /*!32312 IF NOT EXISTS*/ `{$NAMESPACE}_sprint` /*!40100 DEFAULT CHARACTER SET {$CHARSET} COLLATE {$COLLATE_TEXT} */; + +USE `{$NAMESPACE}_sprint`; + +CREATE TABLE `sprint_query` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `phid` varbinary(64) NOT NULL, + `name` varchar(128) COLLATE {$COLLATE_TEXT} NOT NULL, + `mailKey` binary(20) NOT NULL, + `viewPolicy` varbinary(64) NOT NULL, + `editPolicy` varbinary(64) NOT NULL, + `dateCreated` int(10) unsigned NOT NULL, + `dateModified` int(10) unsigned NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `key_phid` (`phid`) +) ENGINE=InnoDB DEFAULT CHARSET={$CHARSET} COLLATE={$COLLATE_TEXT}; diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 7a8185b..1488bc4 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -62,12 +62,10 @@ 'SprintTestCase' => 'tests/SprintTestCase.php', 'SprintTransaction' => 'storage/SprintTransaction.php', 'SprintUIEventListener' => 'events/SprintUIEventListener.php', - 'SprintUIInterface' => 'controller/SprintUIInterface.php', 'SprintValidator' => 'util/SprintValidator.php', 'SprintView' => 'view/SprintView.php', 'TasksTableView' => 'view/burndown/TasksTableView.php', 'UserOpenTasksView' => 'view/reports/UserOpenTasksView.php', - 'ViewController' => 'controller/ViewController.php', ), 'function' => array(), 'xmap' => array( @@ -86,7 +84,7 @@ 'SprintBoardColumnHideController' => 'SprintBoardController', 'SprintBoardController' => 'PhabricatorProjectController', 'SprintBoardImportController' => 'SprintBoardController', - 'SprintBoardMoveController' => 'SprintController', + 'SprintBoardMoveController' => 'PhabricatorProjectController', 'SprintBoardReorderController' => 'SprintBoardController', 'SprintBoardTaskEditController' => 'ManiphestController', 'SprintBoardViewController' => 'SprintBoardController', diff --git a/src/application/SprintApplication.php b/src/application/SprintApplication.php index 53c08e2..67602bc 100644 --- a/src/application/SprintApplication.php +++ b/src/application/SprintApplication.php @@ -82,6 +82,13 @@ '/tag/' => array( '(?P<slug>[^/]+)/sboard/' => 'SprintBoardViewController', ), + '/project/' => array( + 'sboard/(?P<id>[1-9]\d*)/'. + '(?P<filter>filter/)?'. + '(?:query/(?P<queryKey>[^/]+)/)?' + => 'SprintBoardViewController', + 'burn/(?P<id>\d+)/' => 'SprintDataViewController', + ), ); } diff --git a/src/controller/SprintController.php b/src/controller/SprintController.php index 61b7ff1..f1d20cf 100644 --- a/src/controller/SprintController.php +++ b/src/controller/SprintController.php @@ -112,4 +112,44 @@ return $view; } + public function buildIconNavView(PhabricatorProject $project) { + $id = $project->getID(); + $nav = $this->buildSprintIconNavView($project); + $nav->selectFilter("board/{$id}/"); + return $nav; + } + + public function buildSprintIconNavView(PhabricatorProject $project) { + $user = $this->getRequest()->getUser(); + $id = $project->getID(); + $picture = $project->getProfileImageURI(); + $name = $project->getName(); + + $columns = id(new PhabricatorProjectColumnQuery()) + ->setViewer($user) + ->withProjectPHIDs(array($project->getPHID())) + ->execute(); + if ($columns) { + $board_icon = 'fa-columns'; + } else { + $board_icon = 'fa-columns grey'; + } + + $nav = new AphrontSideNavFilterView(); + $nav->setIconNav(true); + $nav->setBaseURI(new PhutilURI($this->getProjectApplicationURI())); + $nav->addIcon("profile/{$id}/", $name, null, $picture); + $nav->addIcon("burn/{$id}/", pht('Burndown'), 'fa-fire'); + $nav->addIcon("sboard/{$id}/", pht('Sprint Board'), $board_icon); + $nav->addIcon("feed/{$id}/", pht('Feed'), 'fa-newspaper-o'); + $nav->addIcon("members/{$id}/", pht('Members'), 'fa-group'); + $nav->addIcon("edit/{$id}/", pht('Edit'), 'fa-pencil'); + + return $nav; + } + + public function getProjectApplicationURI() { + return '/project/'; + } + } diff --git a/src/controller/SprintDataViewController.php b/src/controller/SprintDataViewController.php index 0526ed4..de20c7c 100644 --- a/src/controller/SprintDataViewController.php +++ b/src/controller/SprintDataViewController.php @@ -30,12 +30,14 @@ $can_create = $this->hasApplicationCapability( ProjectCreateProjectsCapability::CAPABILITY); $crumbs = $this->getCrumbs($project, $can_create); + $nav = $this->buildIconNavView($project); + $nav->appendChild($crumbs); + $nav->appendChild($error_box); + $nav->appendChild($burndown_view); return $this->buildApplicationPage( array( - $crumbs, - $error_box, - $burndown_view, + $nav, ), array( 'title' => array(pht('Burndown'), $project->getName()), @@ -48,6 +50,7 @@ $project = id(new PhabricatorProjectQuery()) ->setViewer($viewer) ->withIDs(array($pid)) + ->needImages(true) ->executeOne(); return $project; } @@ -82,4 +85,4 @@ ->setErrors(array($e->getMessage())); return $error_box; } -} \ No newline at end of file +} diff --git a/src/controller/SprintListController.php b/src/controller/SprintListController.php index 370eb11..b5b386f 100644 --- a/src/controller/SprintListController.php +++ b/src/controller/SprintListController.php @@ -33,7 +33,7 @@ $help = id(new PHUIBoxView()) ->appendChild(phutil_tag('p', array(), - "To have a project show up in this list, make sure it's name includes" + "To have a project show up in this list, make sure its name includes" ."\"".SprintConstants::MAGIC_WORD."\" and then edit it to set the start and end date." )) ->addMargin(PHUI::MARGIN_LARGE); diff --git a/src/controller/board/SprintBoardColumnDetailController.php b/src/controller/board/SprintBoardColumnDetailController.php index c843aff..7f7a580 100644 --- a/src/controller/board/SprintBoardColumnDetailController.php +++ b/src/controller/board/SprintBoardColumnDetailController.php @@ -22,6 +22,7 @@ PhabricatorPolicyCapability::CAN_VIEW, )) ->withIDs(array($this->projectID)) + ->needImages(true) ->executeOne(); if (!$project) { @@ -41,25 +42,12 @@ return new Aphront404Response(); } - $xactions = id(new PhabricatorProjectColumnTransactionQuery()) - ->setViewer($viewer) - ->withObjectPHIDs(array($column->getPHID())) - ->execute(); - - id(new PhabricatorMarkupEngine()) - ->setViewer($viewer); - - $timeline = id(new PhabricatorApplicationTransactionView()) - ->setUser($viewer) - ->setObjectPHID($column->getPHID()) - ->setTransactions($xactions); + $timeline = $this->buildTransactionTimeline( + $column, + new PhabricatorProjectColumnTransactionQuery()); + $timeline->setShouldTerminate(true); $title = pht('%s', $column->getDisplayName()); - $crumbs = $this->buildApplicationCrumbs(); - $crumbs->addTextCrumb( - pht('board'), - $this->getApplicationURI('board/'.$project->getID().'/')); - $crumbs->addTextCrumb($title); $header = $this->buildHeaderView($column); $actions = $this->buildActionView($column); @@ -69,11 +57,13 @@ ->setHeader($header) ->addPropertyList($properties); + $nav = $this->buildIconNavView($project); + $nav->appendChild($box); + $nav->appendChild($timeline); + return $this->buildApplicationPage( array( - $crumbs, - $box, - $timeline, + $nav, ), array( 'title' => $title, @@ -95,9 +85,6 @@ return $header; } - /** - * @return PhabricatorProjectColumn - */ private function buildActionView(PhabricatorProjectColumn $column) { $viewer = $this->getRequest()->getUser(); diff --git a/src/controller/board/SprintBoardColumnEditController.php b/src/controller/board/SprintBoardColumnEditController.php index c51304a..30e6a09 100644 --- a/src/controller/board/SprintBoardColumnEditController.php +++ b/src/controller/board/SprintBoardColumnEditController.php @@ -23,6 +23,7 @@ PhabricatorPolicyCapability::CAN_EDIT, )) ->withIDs(array($this->projectID)) + ->needImages(true) ->executeOne(); if (!$project) { @@ -98,7 +99,7 @@ ->setNewValue($v_limit); try { - id(new PhabricatorProjectColumnTransactionEditor()) + $editor = id(new PhabricatorProjectColumnTransactionEditor()) ->setActor($viewer) ->setContinueOnNoEffect(true) ->setContentSourceFromRequest($request) @@ -135,11 +136,9 @@ if ($is_new) { $title = pht('Create Column'); $submit = pht('Create Column'); - $crumb_text = pht('Create Column'); } else { $title = pht('Edit %s', $column->getDisplayName()); $submit = pht('Save Column'); - $crumb_text = pht('Edit'); } $form->appendChild( @@ -147,28 +146,17 @@ ->setValue($submit) ->addCancelButton($view_uri)); - $crumbs = $this->buildApplicationCrumbs(); - $crumbs->addTextCrumb( - pht('board'), - $this->getApplicationURI('board/'.$project->getID().'/')); - - if (!$is_new) { - $crumbs->addTextCrumb( - $column->getDisplayName(), - $view_uri); - } - - $crumbs->addTextCrumb($crumb_text); - $form_box = id(new PHUIObjectBoxView()) ->setHeaderText($title) ->setValidationException($validation_exception) ->setForm($form); + $nav = $this->buildIconNavView($project); + $nav->appendChild($form_box); + return $this->buildApplicationPage( array( - $crumbs, - $form_box, + $nav, ), array( 'title' => $title, diff --git a/src/controller/board/SprintBoardColumnHideController.php b/src/controller/board/SprintBoardColumnHideController.php index 28ff6cf..3aaaeb3 100644 --- a/src/controller/board/SprintBoardColumnHideController.php +++ b/src/controller/board/SprintBoardColumnHideController.php @@ -42,6 +42,8 @@ return new Aphront404Response(); } + $column_phid = $column->getPHID(); + $view_uri = $this->getApplicationURI('/board/'.$this->projectID.'/'); $view_uri = new PhutilURI($view_uri); foreach ($request->getPassthroughRequestData() as $key => $value) { @@ -69,7 +71,7 @@ ->setNewValue($new_status), ); - id(new PhabricatorProjectColumnTransactionEditor()) + $editor = id(new PhabricatorProjectColumnTransactionEditor()) ->setActor($viewer) ->setContinueOnNoEffect(true) ->setContentSourceFromRequest($request) diff --git a/src/controller/board/SprintBoardController.php b/src/controller/board/SprintBoardController.php index 322cc9f..50fefcd 100644 --- a/src/controller/board/SprintBoardController.php +++ b/src/controller/board/SprintBoardController.php @@ -1,13 +1,9 @@ <?php abstract class SprintBoardController - extends PhabricatorProjectController { + extends SprintController { private $project; - - public function shouldAllowPublic() { - return true; - } protected function setProject(PhabricatorProject $project) { $this->project = $project; @@ -16,13 +12,4 @@ protected function getProject() { return $this->project; } - - protected function buildApplicationCrumbs() { - $project = $this->getProject(); - $crumbs = parent::buildApplicationCrumbs(); - $crumbs->addTextCrumb( - $project->getName(), - $this->getApplicationURI('view/'.$project->getID().'/')); - return $crumbs; - } -} \ No newline at end of file +} diff --git a/src/controller/board/SprintBoardImportController.php b/src/controller/board/SprintBoardImportController.php index 6c21631..41bd803 100644 --- a/src/controller/board/SprintBoardImportController.php +++ b/src/controller/board/SprintBoardImportController.php @@ -56,7 +56,7 @@ if ($import_column->isHidden()) { continue; } - PhabricatorProjectColumn::initializeNewColumn($viewer) + $new_column = PhabricatorProjectColumn::initializeNewColumn($viewer) ->setSequence($import_column->getSequence()) ->setProjectPHID($project->getPHID()) ->setName($import_column->getName()) diff --git a/src/controller/board/SprintBoardMoveController.php b/src/controller/board/SprintBoardMoveController.php index 6ce6faa..6f78722 100644 --- a/src/controller/board/SprintBoardMoveController.php +++ b/src/controller/board/SprintBoardMoveController.php @@ -1,7 +1,7 @@ <?php final class SprintBoardMoveController - extends SprintController { + extends PhabricatorProjectController { private $id; diff --git a/src/controller/board/SprintBoardReorderController.php b/src/controller/board/SprintBoardReorderController.php index 301458f..d34ac8e 100644 --- a/src/controller/board/SprintBoardReorderController.php +++ b/src/controller/board/SprintBoardReorderController.php @@ -54,6 +54,7 @@ return new Aphront404Response(); } + $target_column = $columns[$column_phid]; $new_sequence = $request->getInt('sequence'); if ($new_sequence < 0) { return new Aphront404Response(); diff --git a/src/controller/board/SprintBoardViewController.php b/src/controller/board/SprintBoardViewController.php index 13acae7..013ffff 100644 --- a/src/controller/board/SprintBoardViewController.php +++ b/src/controller/board/SprintBoardViewController.php @@ -11,16 +11,13 @@ private $sortKey; private $showHidden; - public function willProcessRequest(array $data) { - $this->id = idx($data, 'id'); - $this->slug = idx($data, 'slug'); - $this->queryKey = idx($data, 'queryKey'); - $this->filter = (bool)idx($data, 'filter'); + public function shouldAllowPublic() { + return true; } - public function processRequest() { - $request = $this->getRequest(); + public function handleRequest(AphrontRequest $request) { $viewer = $request->getUser(); + $id = $request->getURIData('id'); $show_hidden = $request->getBool('hidden'); $this->showHidden = $show_hidden; @@ -28,10 +25,12 @@ $project = id(new PhabricatorProjectQuery()) ->setViewer($viewer) ->needImages(true); - if ($this->slug) { - $project->withSlugs(array($this->slug)); + $id = $request->getURIData('id'); + $slug = $request->getURIData('slug'); + if ($slug) { + $project->withSlugs(array($slug)); } else { - $project->withIDs(array($this->id)); + $project->withIDs(array($id)); } $project = $project->executeOne(); if (!$project) { @@ -83,8 +82,10 @@ return id(new AphrontRedirectResponse()) ->setURI( $this->getApplicationURI('board/'.$project->getID().'/import/')); + break; default: return $this->initializeWorkboardDialog($project); + break; } } @@ -105,7 +106,7 @@ $engine->getQueryResultsPageURI($saved->getQueryKey()))); } - $query_key = $this->queryKey; + $query_key = $request->getURIData('queryKey'); if (!$query_key) { $query_key = 'open'; } @@ -127,7 +128,7 @@ $custom_query = $saved; } - if ($this->filter) { + if ($request->getURIData('filter')) { $filter_form = id(new AphrontFormView()) ->setUser($viewer); $engine->buildSearchForm($filter_form, $saved); @@ -267,12 +268,9 @@ $owner = $this->handles[$task->getOwnerPHID()]; } $can_edit = idx($task_can_edit_map, $task->getPHID(), false); - $task_node_id = celerity_generate_unique_node_id(); $cards->addItem(id(new SprintBoardTaskCard()) ->setViewer($viewer) - ->setProject($project) ->setTask($task) - ->setNode($task_node_id) ->setOwner($owner) ->setCanEdit($can_edit) ->getItem()); @@ -300,16 +298,14 @@ $header_link = phutil_tag( 'a', array( - 'href' => $this->getApplicationURI('view/'.$project->getID().'/'), + 'href' => $this->getApplicationURI('profile/'.$project->getID().'/'), ), $project->getName()); $header = id(new PHUIHeaderView()) - ->setHeader($header_link) + ->setHeader(pht('%s Workboard', $header_link)) ->setUser($viewer) ->setNoBackground(true) - ->setImage($project->getProfileImageURI()) - ->setImageURL($this->getApplicationURI('view/'.$project->getID().'/')) ->addActionLink($sort_menu) ->addActionLink($filter_menu) ->addActionLink($manage_menu) @@ -319,13 +315,16 @@ ->appendChild($board) ->addClass('project-board-wrapper'); + $nav = $this->buildIconNavView($project); + $nav->appendChild($header); + $nav->appendChild($board_box); + return $this->buildApplicationPage( array( - $header, - $board_box, + $nav, ), array( - 'title' => pht('%s board', $project->getName()), + 'title' => pht('%s Board', $project->getName()), 'showFooter' => false, )); } @@ -344,10 +343,7 @@ $base_uri = $this->getURIWithState(); - $items = array(); - $active_order = null; - foreach ($named as $key => $name) { $is_selected = ($key == $sort_key); if ($is_selected) { @@ -407,8 +403,6 @@ } $items = array(); - $active_filter = null; - foreach ($named as $key => $name) { $is_selected = ($key == $query_key); if ($is_selected) { @@ -520,7 +514,7 @@ } $manage_button = id(new PHUIButtonView()) - ->setText(pht('Manage board')) + ->setText(pht('Manage Board')) ->setIcon($manage_icon) ->setTag('a') ->setHref('#') @@ -615,7 +609,7 @@ ->setValue('backlog-only') ->addButton( 'backlog-only', - pht('New Empty board'), + pht('New Empty Board'), pht('Create a new board with just a backlog column.')) ->addButton( 'import', diff --git a/src/tests/SprintControllerTest.php b/src/tests/SprintControllerTest.php index a165c93..a015f35 100644 --- a/src/tests/SprintControllerTest.php +++ b/src/tests/SprintControllerTest.php @@ -41,4 +41,31 @@ $errorbox = $dv->getErrorBox($e); $this->assertInstanceOf('AphrontErrorView', $errorbox); } -} \ No newline at end of file + + public function testprocessRequestFail() { + $dvcontroller = new SprintDataViewController(); + $sprint = new SprintApplication(); + $dvcontroller->setCurrentApplication($sprint); + $request = new AphrontRequest('phab.wmde.de', '/sprint/view/18'); + $data['id'] = 3; + $request->setRequestdata($data); + $viewer = $this->generateNewTestUser(); + $request->setUser($viewer); + $dvcontroller->willProcessRequest($data); + $dvcontroller->setRequest($request); + $response = $dvcontroller->processRequest(); + $this->assertInstanceOf('Aphront404Response', $response); + } + + public function testprocessRequestListController() { + $lcontroller = new SprintListController(); + $sprint = new SprintApplication(); + $lcontroller->setCurrentApplication($sprint); + $request = new AphrontRequest('phab.wmde.de', '/sprint/view/18'); + $viewer = $this->generateNewTestUser(); + $request->setUser($viewer); + $lcontroller->setRequest($request); + $response = $lcontroller->processRequest(); + $this->assertInstanceOf('AphrontWebpageResponse', $response); + } +} -- To view, visit https://gerrit.wikimedia.org/r/185177 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I304a6ebc6d1604bd44a1e696150e8d63d2abcddf 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
