diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index fe0d89ad3b316bbd0100375659a87f0a7d3953f4..3abcf030ebd2301deafffc1bbe0d079ac0aa172a 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -39,7 +39,6 @@ phutil_register_library_map(array( 'SprintGetIsSprintConduitAPIMethod' => 'conduit/SprintGetIsSprintConduitAPIMethod.php', 'SprintGetStartEndDatesConduitAPIMethod' => 'conduit/SprintGetStartEndDatesConduitAPIMethod.php', 'SprintGetTaskProjectHistoryConduitAPIMethod' => 'conduit/SprintGetTaskProjectHistoryConduitAPIMethod.php', - 'SprintHistoryController' => 'controller/SprintHistoryController.php', 'SprintHistoryDataProvider' => 'storage/SprintHistoryDataProvider.php', 'SprintHistoryTableView' => 'view/reports/SprintHistoryTableView.php', 'SprintInfoConduitAPIMethod' => 'conduit/SprintInfoConduitAPIMethod.php', @@ -99,7 +98,6 @@ phutil_register_library_map(array( 'SprintGetIsSprintConduitAPIMethod' => 'SprintConduitAPIMethod', 'SprintGetStartEndDatesConduitAPIMethod' => 'SprintConduitAPIMethod', 'SprintGetTaskProjectHistoryConduitAPIMethod' => 'SprintConduitAPIMethod', - 'SprintHistoryController' => 'SprintController', 'SprintHistoryTableView' => 'SprintView', 'SprintInfoConduitAPIMethod' => 'SprintManiphestConduitAPIMethod', 'SprintIsSprintField' => 'SprintProjectCustomField', @@ -113,7 +111,7 @@ phutil_register_library_map(array( 'PhabricatorProjectCustomField', 'PhabricatorStandardCustomFieldInterface', ), - 'SprintProjectProfilePanel' => 'PhabricatorProfilePanel', + 'SprintProjectProfilePanel' => 'PhabricatorProfileMenuItem', 'SprintProjectViewController' => 'SprintController', 'SprintQuery' => 'SprintDAO', 'SprintQueryTest' => 'SprintTestCase', diff --git a/src/controller/SprintDataViewController.php b/src/controller/SprintDataViewController.php index ffa6d8fa7bf33d1534171dcafc0b81994e318baf..ec00f5df201c11e570e31668000592f6cbb2300a 100644 --- a/src/controller/SprintDataViewController.php +++ b/src/controller/SprintDataViewController.php @@ -13,7 +13,7 @@ final class SprintDataViewController extends SprintController { if ($project) { $viewer = $this->getViewer(); - $engine = id(new PhabricatorProjectProfilePanelEngine()) + $engine = id(new PhabricatorProjectProfileMenuEngine()) ->setViewer($viewer) ->setProfileObject($project); diff --git a/src/profilepanel/SprintProjectProfilePanel.php b/src/profilepanel/SprintProjectProfilePanel.php index b782371d208fa14f7c4cca3f454ce1250d019403..8fbafcdfcb88c2e628684a7680fa77dba511c4fb 100644 --- a/src/profilepanel/SprintProjectProfilePanel.php +++ b/src/profilepanel/SprintProjectProfilePanel.php @@ -1,11 +1,11 @@ <?php final class SprintProjectProfilePanel - extends PhabricatorProfilePanel { + extends PhabricatorProfileMenuItem { - const PANELKEY = 'project.sprint'; + const MENUITEMKEY = 'project.sprint'; - public function getPanelTypeName() { + public function getMenuItemTypeName() { return pht('Project Burndown'); } @@ -14,12 +14,25 @@ final class SprintProjectProfilePanel } public function shouldEnableForObject($object) { + $sprint = id(new SprintQuery()) + ->setViewer($this->getViewer()) + ->setPHID($object->getPHID()); + + if (!$sprint) { + return null; + } + + $is_sprint = $sprint->getIsSprint(); + if (!$is_sprint) { + return false; + } + return true; } public function getDisplayName( - PhabricatorProfilePanelConfiguration $config) { - $name = $config->getPanelProperty('name'); + PhabricatorProfileMenuItemConfiguration $config) { + $name = $config->getMenuItemProperty('name'); if (strlen($name)) { return $name; @@ -29,7 +42,7 @@ final class SprintProjectProfilePanel } public function buildEditEngineFields( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { return array( id(new PhabricatorTextEditField()) ->setKey('name') @@ -40,15 +53,9 @@ final class SprintProjectProfilePanel } protected function newNavigationMenuItems( - PhabricatorProfilePanelConfiguration $config) { + PhabricatorProfileMenuItemConfiguration $config) { $project = $config->getProfileObject(); - - $query = id(new SprintQuery()) - ->setViewer($this->getViewer()) - ->setPHID($project->getPHID()); - $is_sprint = $query->getIsSprint(); - $id = $project->getID(); $name = $this->getDisplayName($config); @@ -58,7 +65,6 @@ final class SprintProjectProfilePanel $item = $this->newItem() ->setHref($href) ->setName($name) - ->setDisabled(!$is_sprint) ->setIcon($icon); return array(