1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-10 14:51:06 +01:00

(stable) Make dashboard arrange actions (move, add, remove) work again after read locking from "chaos reduction"

Summary:
See PHI385. Ref T13054. Ref T13083. The dashboard "arrange" operations (add, remove, move) rely on doing `$dashboard->setThing(...)` and then applying transactions.

This no longer works after the read locking change from T13054. To make this function again, just add an explicit `save()` after layout adjustment. This should be more nuanced eventually, but all arrange operations are nonfunctional in a corrupting way at HEAD of `master`/`stable`, so stop the bleeding first.

Test Plan:
  - Created new empty and template dashboards.
  - Moved panels.
  - Added new and existing panels.
  - Removed panels.

Maniphest Tasks: T13083, T13054

Differential Revision: https://secure.phabricator.com/D19123
This commit is contained in:
epriestley 2018-02-20 17:06:09 -08:00
parent 362ccedf8a
commit 33b77e4abf
2 changed files with 11 additions and 1 deletions

View file

@ -74,7 +74,15 @@ final class PhabricatorDashboard extends PhabricatorDashboardDAO
public function setLayoutConfigFromObject(
PhabricatorDashboardLayoutConfig $object) {
$this->setLayoutConfig($object->toDictionary());
// See PHI385. Dashboard panel mutations rely on changes to the Dashboard
// object persisting when transactions are applied, but this assumption is
// no longer valid after T13054. For now, just save the dashboard
// explicitly.
$this->save();
return $this;
}

View file

@ -34,8 +34,10 @@ final class PhabricatorDashboardPanelDatasource
$impl = $panel->getImplementation();
if ($impl) {
$type_text = $impl->getPanelTypeName();
$icon = $impl->getIcon();
} else {
$type_text = nonempty($panel->getPanelType(), pht('Unknown Type'));
$icon = 'fa-question';
}
$id = $panel->getID();
$monogram = $panel->getMonogram();
@ -44,7 +46,7 @@ final class PhabricatorDashboardPanelDatasource
$result = id(new PhabricatorTypeaheadResult())
->setName($monogram.' '.$panel->getName())
->setPHID($id)
->setIcon($impl->getIcon())
->setIcon($icon)
->addAttribute($type_text);
if (!empty($properties['class'])) {