@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Mostly replace the old panel "Edit" controller with the new "Editpro" controller

Summary:
Depends on D20370. Ref T13272. This tries to get panel editing fully on the newer "Modular Transactions" + "EditEngine" flow.

This breaks tab panels a bit, but I'll fix that in a followup. And they weren't exactly in great shape before.

Also makes the flow prettier. :3

Test Plan: {F6332746}

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13272

Differential Revision: https://secure.phabricator.com/D20371

+124 -440
-2
src/__phutil_library_map__.php
··· 2933 2933 'PhabricatorDashboardPanelEditConduitAPIMethod' => 'applications/dashboard/conduit/PhabricatorDashboardPanelEditConduitAPIMethod.php', 2934 2934 'PhabricatorDashboardPanelEditController' => 'applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php', 2935 2935 'PhabricatorDashboardPanelEditEngine' => 'applications/dashboard/editor/PhabricatorDashboardPanelEditEngine.php', 2936 - 'PhabricatorDashboardPanelEditproController' => 'applications/dashboard/controller/panel/PhabricatorDashboardPanelEditproController.php', 2937 2936 'PhabricatorDashboardPanelHasDashboardEdgeType' => 'applications/dashboard/edge/PhabricatorDashboardPanelHasDashboardEdgeType.php', 2938 2937 'PhabricatorDashboardPanelListController' => 'applications/dashboard/controller/panel/PhabricatorDashboardPanelListController.php', 2939 2938 'PhabricatorDashboardPanelNameTransaction' => 'applications/dashboard/xaction/panel/PhabricatorDashboardPanelNameTransaction.php', ··· 8915 8914 'PhabricatorDashboardPanelEditConduitAPIMethod' => 'PhabricatorEditEngineAPIMethod', 8916 8915 'PhabricatorDashboardPanelEditController' => 'PhabricatorDashboardController', 8917 8916 'PhabricatorDashboardPanelEditEngine' => 'PhabricatorEditEngine', 8918 - 'PhabricatorDashboardPanelEditproController' => 'PhabricatorDashboardController', 8919 8917 'PhabricatorDashboardPanelHasDashboardEdgeType' => 'PhabricatorEdgeType', 8920 8918 'PhabricatorDashboardPanelListController' => 'PhabricatorDashboardController', 8921 8919 'PhabricatorDashboardPanelNameTransaction' => 'PhabricatorDashboardPanelTransactionType',
+2 -4
src/applications/dashboard/application/PhabricatorDashboardApplication.php
··· 57 57 'PhabricatorDashboardQueryPanelInstallController', 58 58 '(?:query/(?P<queryKey>[^/]+)/)?' 59 59 => 'PhabricatorDashboardPanelListController', 60 - 'create/' => 'PhabricatorDashboardPanelEditController', 61 - $this->getEditRoutePattern('editpro/') 62 - => 'PhabricatorDashboardPanelEditproController', 63 - 'edit/(?:(?P<id>\d+)/)?' => 'PhabricatorDashboardPanelEditController', 60 + $this->getEditRoutePattern('edit/') 61 + => 'PhabricatorDashboardPanelEditController', 64 62 'render/(?P<id>\d+)/' => 'PhabricatorDashboardPanelRenderController', 65 63 'archive/(?P<id>\d+)/' 66 64 => 'PhabricatorDashboardPanelArchiveController',
+59 -320
src/applications/dashboard/controller/panel/PhabricatorDashboardPanelEditController.php
··· 4 4 extends PhabricatorDashboardController { 5 5 6 6 public function handleRequest(AphrontRequest $request) { 7 - $viewer = $request->getViewer(); 8 - $id = $request->getURIData('id'); 9 - 10 - // If the user is trying to create a panel directly on a dashboard, make 11 - // sure they have permission to see and edit the dashboard. 12 - 13 - $dashboard_id = $request->getInt('dashboardID'); 14 - $dashboard = null; 15 - if ($dashboard_id) { 16 - $dashboard = id(new PhabricatorDashboardQuery()) 17 - ->setViewer($viewer) 18 - ->withIDs(array($dashboard_id)) 19 - ->requireCapabilities( 20 - array( 21 - PhabricatorPolicyCapability::CAN_VIEW, 22 - PhabricatorPolicyCapability::CAN_EDIT, 23 - )) 24 - ->executeOne(); 25 - if (!$dashboard) { 26 - return new Aphront404Response(); 27 - } 7 + $viewer = $this->getViewer(); 28 8 29 - $manage_uri = $this->getApplicationURI('arrange/'.$dashboard_id.'/'); 30 - } 9 + $engine = id(new PhabricatorDashboardPanelEditEngine()) 10 + ->setController($this); 31 11 32 - if ($id) { 33 - $is_create = false; 12 + $id = $request->getURIData('id'); 13 + if (!$id) { 14 + $dashboard_id = $request->getStr('dashboardID'); 15 + $column_id = $request->getStr('columnID'); 34 16 35 - if ($dashboard) { 36 - $capabilities = array( 37 - PhabricatorPolicyCapability::CAN_VIEW, 38 - ); 17 + if (strlen($dashboard_id)) { 18 + $dashboard = id(new PhabricatorDashboardQuery()) 19 + ->setViewer($viewer) 20 + ->withIDs(array($dashboard_id)) 21 + ->requireCapabilities( 22 + array( 23 + PhabricatorPolicyCapability::CAN_VIEW, 24 + PhabricatorPolicyCapability::CAN_EDIT, 25 + )) 26 + ->executeOne(); 27 + if (!$dashboard) { 28 + return new Aphront404Response(); 29 + } 39 30 } else { 40 - $capabilities = array( 41 - PhabricatorPolicyCapability::CAN_VIEW, 42 - PhabricatorPolicyCapability::CAN_EDIT, 43 - ); 44 - } 45 - 46 - $panel = id(new PhabricatorDashboardPanelQuery()) 47 - ->setViewer($viewer) 48 - ->withIDs(array($id)) 49 - ->requireCapabilities($capabilities) 50 - ->executeOne(); 51 - if (!$panel) { 52 - return new Aphront404Response(); 31 + $dashboard = null; 53 32 } 54 33 55 - } else { 56 - $is_create = true; 57 - 58 - $panel = PhabricatorDashboardPanel::initializeNewPanel($viewer); 59 - $types = PhabricatorDashboardPanelType::getAllPanelTypes(); 60 - $type = $request->getStr('type'); 61 - if (empty($types[$type])) { 62 - return $this->processPanelTypeRequest($request); 63 - } 64 - 65 - $panel->setPanelType($type); 66 - } 67 - 68 - if ($is_create) { 69 - $title = pht('Create New Panel'); 70 - $button = pht('Create Panel'); 71 - $header_icon = 'fa-plus-square'; 72 34 if ($dashboard) { 73 - $cancel_uri = $manage_uri; 35 + $cancel_uri = $dashboard->getURI(); 74 36 } else { 75 37 $cancel_uri = $this->getApplicationURI('panel/'); 76 38 } 77 - } else { 78 - $title = pht('Edit Panel: %s', $panel->getName()); 79 - $button = pht('Save Panel'); 80 - $header_icon = 'fa-pencil'; 81 - if ($dashboard) { 82 - $cancel_uri = $manage_uri; 83 - } else { 84 - $cancel_uri = '/'.$panel->getMonogram(); 85 - } 86 - } 87 - 88 - $v_name = $panel->getName(); 89 - $e_name = true; 90 39 91 - $field_list = PhabricatorCustomField::getObjectFields( 92 - $panel, 93 - PhabricatorCustomField::ROLE_EDIT); 94 - $field_list 95 - ->setViewer($viewer) 96 - ->readFieldsFromStorage($panel); 97 - 98 - if ($is_create && !$request->isFormPost()) { 99 - $panel->requireImplementation()->initializeFieldsFromRequest( 100 - $panel, 101 - $field_list, 102 - $request); 103 - } 104 - 105 - $validation_exception = null; 106 - 107 - // NOTE: We require 'edit' to distinguish between the "Choose a Type" 108 - // and "Create a Panel" dialogs. 109 - 110 - if ($request->isFormPost() && $request->getBool('edit')) { 111 - $v_name = $request->getStr('name'); 112 - $v_view_policy = $request->getStr('viewPolicy'); 113 - $v_edit_policy = $request->getStr('editPolicy'); 114 - 115 - $type_name = PhabricatorDashboardPanelNameTransaction::TRANSACTIONTYPE; 116 - $type_view_policy = PhabricatorTransactions::TYPE_VIEW_POLICY; 117 - $type_edit_policy = PhabricatorTransactions::TYPE_EDIT_POLICY; 118 - 119 - $xactions = array(); 120 - 121 - $xactions[] = id(new PhabricatorDashboardPanelTransaction()) 122 - ->setTransactionType($type_name) 123 - ->setNewValue($v_name); 124 - 125 - $xactions[] = id(new PhabricatorDashboardPanelTransaction()) 126 - ->setTransactionType($type_view_policy) 127 - ->setNewValue($v_view_policy); 128 - 129 - $xactions[] = id(new PhabricatorDashboardPanelTransaction()) 130 - ->setTransactionType($type_edit_policy) 131 - ->setNewValue($v_edit_policy); 132 - 133 - $field_xactions = $field_list->buildFieldTransactionsFromRequest( 134 - new PhabricatorDashboardPanelTransaction(), 135 - $request); 136 - $xactions = array_merge($xactions, $field_xactions); 137 - 138 - try { 139 - $editor = id(new PhabricatorDashboardPanelTransactionEditor()) 140 - ->setActor($viewer) 141 - ->setContinueOnNoEffect(true) 142 - ->setContentSourceFromRequest($request) 143 - ->applyTransactions($panel, $xactions); 144 - 145 - // If we're creating a panel directly on a dashboard, add it now. 146 - if ($dashboard && $is_create) { 147 - PhabricatorDashboardTransactionEditor::addPanelToDashboard( 148 - $viewer, 149 - PhabricatorContentSource::newFromRequest($request), 150 - $panel, 151 - $dashboard, 152 - $request->getInt('column', 0)); 153 - } 154 - 155 - if ($dashboard) { 156 - $done_uri = $manage_uri; 157 - } else { 158 - $done_uri = '/'.$panel->getMonogram(); 159 - } 160 - 161 - return id(new AphrontRedirectResponse())->setURI($done_uri); 162 - } catch (PhabricatorApplicationTransactionValidationException $ex) { 163 - $validation_exception = $ex; 164 - 165 - $e_name = $validation_exception->getShortMessage($type_name); 166 - 167 - $panel->setViewPolicy($v_view_policy); 168 - $panel->setEditPolicy($v_edit_policy); 40 + $panel_type = $request->getStr('panelType'); 41 + $panel_types = PhabricatorDashboardPanelType::getAllPanelTypes(); 42 + if (empty($panel_types[$panel_type])) { 43 + return $this->buildPanelTypeResponse($cancel_uri); 169 44 } 170 - } 171 45 172 - // NOTE: We're setting the submit URI explicitly because we need to edit 173 - // a different panel if we just cloned the original panel. 174 - if ($is_create) { 175 - $submit_uri = $this->getApplicationURI('panel/edit/'); 176 - } else { 177 - $submit_uri = $this->getApplicationURI('panel/edit/'.$panel->getID().'/'); 46 + $engine 47 + ->addContextParameter('panelType', $panel_type) 48 + ->addContextParameter('dashboardID', $dashboard_id) 49 + ->addContextParameter('columnID', $column_id) 50 + ->setPanelType($panel_type) 51 + ->setDashboard($dashboard) 52 + ->setColumnID($column_id); 178 53 } 179 54 180 - $policies = id(new PhabricatorPolicyQuery()) 181 - ->setViewer($viewer) 182 - ->setObject($panel) 183 - ->execute(); 184 - 185 - $form = id(new AphrontFormView()) 186 - ->setUser($viewer) 187 - ->setAction($submit_uri) 188 - ->addHiddenInput('edit', true) 189 - ->addHiddenInput('dashboardID', $request->getInt('dashboardID')) 190 - ->addHiddenInput('column', $request->getInt('column')) 191 - ->appendChild( 192 - id(new AphrontFormTextControl()) 193 - ->setLabel(pht('Name')) 194 - ->setName('name') 195 - ->setValue($v_name) 196 - ->setError($e_name)); 197 - 198 - if (!$request->isAjax() || !$is_create) { 199 - $form 200 - ->appendChild( 201 - id(new AphrontFormPolicyControl()) 202 - ->setName('viewPolicy') 203 - ->setPolicyObject($panel) 204 - ->setCapability(PhabricatorPolicyCapability::CAN_VIEW) 205 - ->setPolicies($policies)) 206 - ->appendChild( 207 - id(new AphrontFormPolicyControl()) 208 - ->setName('editPolicy') 209 - ->setPolicyObject($panel) 210 - ->setCapability(PhabricatorPolicyCapability::CAN_EDIT) 211 - ->setPolicies($policies)); 212 - } 213 - 214 - $field_list->appendFieldsToForm($form); 215 - 216 - $crumbs = $this->buildApplicationCrumbs(); 217 - $crumbs->addTextCrumb( 218 - pht('Panels'), 219 - $this->getApplicationURI('panel/')); 220 - if ($is_create) { 221 - $crumbs->addTextCrumb(pht('New Panel')); 222 - $form->addHiddenInput('type', $panel->getPanelType()); 223 - } else { 224 - $crumbs->addTextCrumb( 225 - $panel->getMonogram(), 226 - '/'.$panel->getMonogram()); 227 - $crumbs->addTextCrumb(pht('Edit')); 228 - } 229 - $crumbs->setBorder(true); 230 - 231 - if ($request->isAjax()) { 232 - return $this->newDialog() 233 - ->setTitle($title) 234 - ->setSubmitURI($submit_uri) 235 - ->setWidth(AphrontDialogView::WIDTH_FORM) 236 - ->setValidationException($validation_exception) 237 - ->appendChild($form->buildLayoutView()) 238 - ->addCancelButton($cancel_uri) 239 - ->addSubmitButton($button); 240 - } else { 241 - $form 242 - ->appendChild( 243 - id(new AphrontFormSubmitControl()) 244 - ->setValue($button) 245 - ->addCancelButton($cancel_uri)); 246 - } 247 - 248 - $box = id(new PHUIObjectBoxView()) 249 - ->setHeaderText(pht('Panel')) 250 - ->setValidationException($validation_exception) 251 - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 252 - ->setForm($form); 253 - 254 - $header = id(new PHUIHeaderView()) 255 - ->setHeader($title) 256 - ->setHeaderIcon($header_icon); 257 - 258 - $view = id(new PHUITwoColumnView()) 259 - ->setHeader($header) 260 - ->setFooter($box); 261 - 262 - return $this->newPage() 263 - ->setTitle($title) 264 - ->setCrumbs($crumbs) 265 - ->appendChild($view); 55 + return $engine->buildResponse(); 266 56 } 267 57 268 - private function processPanelTypeRequest(AphrontRequest $request) { 269 - $viewer = $request->getUser(); 58 + private function buildPanelTypeResponse($cancel_uri) { 59 + $viewer = $this->getViewer(); 60 + $request = $this->getRequest(); 270 61 271 - $types = PhabricatorDashboardPanelType::getAllPanelTypes(); 62 + $base_uri = $request->getRequestURI(); 63 + $base_uri = new PhutilURI($base_uri); 272 64 273 - $v_type = null; 274 - $errors = array(); 275 - if ($request->isFormPost()) { 276 - $v_type = $request->getStr('type'); 277 - if (!isset($types[$v_type])) { 278 - $errors[] = pht('You must select a type of panel to create.'); 279 - } 280 - } 65 + $menu = id(new PHUIObjectItemListView()) 66 + ->setViewer($viewer) 67 + ->setFlush(true) 68 + ->setBig(true); 281 69 282 - $cancel_uri = $this->getApplicationURI('panel/'); 70 + $panel_types = PhabricatorDashboardPanelType::getAllPanelTypes(); 71 + foreach ($panel_types as $panel_type) { 72 + $item = id(new PHUIObjectItemView()) 73 + ->setClickable(true) 74 + ->setImageIcon($panel_type->getIcon()) 75 + ->setHeader($panel_type->getPanelTypeName()) 76 + ->addAttribute($panel_type->getPanelTypeDescription()); 283 77 284 - if (!$v_type) { 285 - $v_type = key($types); 286 - } 78 + $type_uri = id(clone $base_uri) 79 + ->replaceQueryParam('panelType', $panel_type->getPanelTypeKey()); 287 80 288 - $panel_types = id(new AphrontFormRadioButtonControl()) 289 - ->setName('type') 290 - ->setValue($v_type); 81 + $item->setHref($type_uri); 291 82 292 - foreach ($types as $key => $type) { 293 - $panel_types->addButton( 294 - $key, 295 - $type->getPanelTypeName(), 296 - $type->getPanelTypeDescription()); 297 - } 298 - 299 - $form = id(new AphrontFormView()) 300 - ->setUser($viewer) 301 - ->addHiddenInput('dashboardID', $request->getInt('dashboardID')) 302 - ->addHiddenInput('column', $request->getInt('column')) 303 - ->appendRemarkupInstructions( 304 - pht( 305 - 'Choose the type of dashboard panel to create:')) 306 - ->appendChild($panel_types); 307 - 308 - if ($request->isAjax()) { 309 - return $this->newDialog() 310 - ->setTitle(pht('Add New Panel')) 311 - ->setWidth(AphrontDialogView::WIDTH_FORM) 312 - ->setErrors($errors) 313 - ->appendChild($form->buildLayoutView()) 314 - ->addCancelbutton($cancel_uri) 315 - ->addSubmitButton(pht('Continue')); 316 - } else { 317 - $form->appendChild( 318 - id(new AphrontFormSubmitControl()) 319 - ->setValue(pht('Continue')) 320 - ->addCancelButton($cancel_uri)); 83 + $menu->addItem($item); 321 84 } 322 85 323 - $title = pht('Create Dashboard Panel'); 324 - $header_icon = 'fa-plus-square'; 325 - 326 - $crumbs = $this->buildApplicationCrumbs(); 327 - $crumbs->addTextCrumb( 328 - pht('Panels'), 329 - $this->getApplicationURI('panel/')); 330 - $crumbs->addTextCrumb(pht('New Panel')); 331 - $crumbs->setBorder(true); 332 - 333 - $box = id(new PHUIObjectBoxView()) 334 - ->setHeaderText(pht('Panel')) 335 - ->setFormErrors($errors) 336 - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 337 - ->setForm($form); 338 - 339 - $header = id(new PHUIHeaderView()) 340 - ->setHeader($title) 341 - ->setHeaderIcon($header_icon); 342 - 343 - $view = id(new PHUITwoColumnView()) 344 - ->setHeader($header) 345 - ->setFooter($box); 346 - 347 - return $this->newPage() 348 - ->setTitle($title) 349 - ->setCrumbs($crumbs) 350 - ->appendChild($view); 86 + return $this->newDialog() 87 + ->setTitle(pht('Choose Panel Type')) 88 + ->setWidth(AphrontDialogView::WIDTH_FORM) 89 + ->appendChild($menu) 90 + ->addCancelButton($cancel_uri); 351 91 } 352 - 353 92 354 93 }
-105
src/applications/dashboard/controller/panel/PhabricatorDashboardPanelEditproController.php
··· 1 - <?php 2 - 3 - final class PhabricatorDashboardPanelEditproController 4 - extends PhabricatorDashboardController { 5 - 6 - public function handleRequest(AphrontRequest $request) { 7 - $engine = id(new PhabricatorDashboardPanelEditEngine()) 8 - ->setController($this); 9 - 10 - $id = $request->getURIData('id'); 11 - if (!$id) { 12 - $list_uri = $this->getApplicationURI('panel/'); 13 - 14 - $panel_type = $request->getStr('panelType'); 15 - $panel_types = PhabricatorDashboardPanelType::getAllPanelTypes(); 16 - if (empty($panel_types[$panel_type])) { 17 - return $this->buildPanelTypeResponse($list_uri); 18 - } 19 - 20 - $engine 21 - ->addContextParameter('panelType', $panel_type) 22 - ->setPanelType($panel_type); 23 - } 24 - 25 - return $engine->buildResponse(); 26 - } 27 - 28 - private function buildPanelTypeResponse($cancel_uri) { 29 - $panel_types = PhabricatorDashboardPanelType::getAllPanelTypes(); 30 - 31 - $viewer = $this->getViewer(); 32 - $request = $this->getRequest(); 33 - 34 - $e_type = null; 35 - $errors = array(); 36 - if ($request->isFormPost()) { 37 - $e_type = pht('Required'); 38 - $errors[] = pht( 39 - 'To create a new dashboard panel, you must select a panel type.'); 40 - } 41 - 42 - $type_control = id(new AphrontFormRadioButtonControl()) 43 - ->setLabel(pht('Panel Type')) 44 - ->setName('panelType') 45 - ->setError($e_type); 46 - 47 - foreach ($panel_types as $key => $type) { 48 - $type_control->addButton( 49 - $key, 50 - $type->getPanelTypeName(), 51 - $type->getPanelTypeDescription()); 52 - } 53 - 54 - $form = id(new AphrontFormView()) 55 - ->setUser($viewer) 56 - ->appendRemarkupInstructions( 57 - pht('Choose the type of dashboard panel to create:')) 58 - ->appendChild($type_control); 59 - 60 - if ($request->isAjax()) { 61 - return $this->newDialog() 62 - ->setTitle(pht('Add New Panel')) 63 - ->setWidth(AphrontDialogView::WIDTH_FORM) 64 - ->setErrors($errors) 65 - ->appendForm($form) 66 - ->addCancelButton($cancel_uri) 67 - ->addSubmitButton(pht('Continue')); 68 - } 69 - 70 - $form->appendChild( 71 - id(new AphrontFormSubmitControl()) 72 - ->setValue(pht('Continue')) 73 - ->addCancelButton($cancel_uri)); 74 - 75 - $title = pht('Create Dashboard Panel'); 76 - $header_icon = 'fa-plus-square'; 77 - 78 - $crumbs = $this->buildApplicationCrumbs(); 79 - $crumbs->addTextCrumb( 80 - pht('Panels'), 81 - $this->getApplicationURI('panel/')); 82 - $crumbs->addTextCrumb(pht('New Panel')); 83 - $crumbs->setBorder(true); 84 - 85 - $box = id(new PHUIObjectBoxView()) 86 - ->setHeaderText(pht('Panel')) 87 - ->setFormErrors($errors) 88 - ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) 89 - ->setForm($form); 90 - 91 - $header = id(new PHUIHeaderView()) 92 - ->setHeader($title) 93 - ->setHeaderIcon($header_icon); 94 - 95 - $view = id(new PHUITwoColumnView()) 96 - ->setHeader($header) 97 - ->setFooter($box); 98 - 99 - return $this->newPage() 100 - ->setTitle($title) 101 - ->setCrumbs($crumbs) 102 - ->appendChild($view); 103 - } 104 - 105 - }
+2 -2
src/applications/dashboard/controller/panel/PhabricatorDashboardPanelListController.php
··· 43 43 id(new PHUIListItemView()) 44 44 ->setIcon('fa-plus-square') 45 45 ->setName(pht('Create Panel')) 46 - ->setHref($this->getApplicationURI().'panel/create/')); 46 + ->setHref($this->getApplicationURI().'panel/edit/')); 47 47 48 48 return $crumbs; 49 49 } ··· 52 52 $create_button = id(new PHUIButtonView()) 53 53 ->setTag('a') 54 54 ->setText(pht('Create a Panel')) 55 - ->setHref('/dashboard/panel/create/') 55 + ->setHref('/dashboard/panel/edit/') 56 56 ->setColor(PHUIButtonView::GREEN); 57 57 58 58 $icon = $this->getApplication()->getIcon();
+54
src/applications/dashboard/editor/PhabricatorDashboardPanelEditEngine.php
··· 6 6 const ENGINECONST = 'dashboard.panel'; 7 7 8 8 private $panelType; 9 + private $dashboard; 10 + private $columnID; 9 11 10 12 public function setPanelType($panel_type) { 11 13 $this->panelType = $panel_type; ··· 14 16 15 17 public function getPanelType() { 16 18 return $this->panelType; 19 + } 20 + 21 + public function setDashboard(PhabricatorDashboard $dashboard) { 22 + $this->dashboard = $dashboard; 23 + return $this; 24 + } 25 + 26 + public function getDashboard() { 27 + return $this->dashboard; 28 + } 29 + 30 + public function setColumnID($column_id) { 31 + $this->columnID = $column_id; 32 + return $this; 33 + } 34 + 35 + public function getColumnID() { 36 + return $this->columnID; 17 37 } 18 38 19 39 public function isEngineConfigurable() { ··· 63 83 return pht('Create Panel'); 64 84 } 65 85 86 + protected function getObjectCreateCancelURI($object) { 87 + $dashboard = $this->getDashboard(); 88 + if ($dashboard) { 89 + return $dashboard->getURI(); 90 + } 91 + 92 + return parent::getObjectCreateCancelURI($object); 93 + } 94 + 95 + public function getEffectiveObjectEditDoneURI($object) { 96 + $dashboard = $this->getDashboard(); 97 + if ($dashboard) { 98 + return $dashboard->getURI(); 99 + } 100 + 101 + return parent::getEffectiveObjectDoneURI($object); 102 + } 103 + 66 104 protected function getObjectEditTitleText($object) { 67 105 return pht('Edit Panel: %s', $object->getName()); 68 106 } ··· 81 119 82 120 protected function getObjectViewURI($object) { 83 121 return $object->getURI(); 122 + } 123 + 124 + protected function didApplyTransactions($object, array $xactions) { 125 + $dashboard = $this->getDashboard(); 126 + if ($dashboard) { 127 + $viewer = $this->getViewer(); 128 + $controller = $this->getController(); 129 + $request = $controller->getRequest(); 130 + 131 + PhabricatorDashboardTransactionEditor::addPanelToDashboard( 132 + $viewer, 133 + PhabricatorContentSource::newFromRequest($request), 134 + $object, 135 + $dashboard, 136 + (int)$this->getColumnID()); 137 + } 84 138 } 85 139 86 140 protected function buildCustomEditFields($object) {
+3 -3
src/applications/dashboard/engine/PhabricatorDashboardRenderingEngine.php
··· 112 112 private function renderAddPanelUI($column) { 113 113 $dashboard_id = $this->dashboard->getID(); 114 114 115 - $create_uri = id(new PhutilURI('/dashboard/panel/create/')) 115 + $create_uri = id(new PhutilURI('/dashboard/panel/edit/')) 116 116 ->replaceQueryParam('dashboardID', $dashboard_id) 117 - ->replaceQueryParam('column', $column); 117 + ->replaceQueryParam('columnID', $column); 118 118 119 119 $add_uri = id(new PhutilURI('/dashboard/addpanel/'.$dashboard_id.'/')) 120 - ->replaceQueryParam('column', $column); 120 + ->replaceQueryParam('columnID', $column); 121 121 122 122 $create_button = id(new PHUIButtonView()) 123 123 ->setTag('a')
+1 -1
src/applications/dashboard/paneltype/PhabricatorDashboardTabsPanelType.php
··· 12 12 } 13 13 14 14 public function getIcon() { 15 - return 'fa-window-maximize'; 15 + return 'fa-columns'; 16 16 } 17 17 18 18 public function getPanelTypeDescription() {
+3 -3
src/applications/dashboard/paneltype/PhabricatorDashboardTextPanelType.php
··· 12 12 } 13 13 14 14 public function getIcon() { 15 - return 'fa-paragraph'; 15 + return 'fa-file-text-o'; 16 16 } 17 17 18 18 public function getPanelTypeDescription() { 19 19 return pht( 20 - 'Add some static text to the dashboard. This can be used to '. 21 - 'provide instructions or context.'); 20 + 'Add a text panel to the dashboard to provide instructions or '. 21 + 'context.'); 22 22 } 23 23 24 24 public function getFieldSpecifications() {